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 StaffWhirls v1.7.0
StaffWhirls.dll
Decompiled an hour ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("StaffWhirls")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.7.0.0")] [assembly: AssemblyInformationalVersion("1.7.0")] [assembly: AssemblyProduct("StaffWhirls")] [assembly: AssemblyTitle("StaffWhirls")] [assembly: AssemblyVersion("1.7.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace StaffWhirls { public sealed class GroundRing : MonoBehaviour { public Material Material; public Color Color; public float Delay; public float Lifetime; private LineRenderer _line; private float _age; public static Vector3 Surface(Vector3 position) { //IL_0000: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) float num = position.y; int mask = LayerMask.GetMask(new string[5] { "Default", "static_solid", "terrain", "piece", "vehicle" }); RaycastHit val = default(RaycastHit); if (Physics.Raycast(position + Vector3.up * 2f, Vector3.down, ref val, 10f, mask, (QueryTriggerInteraction)1)) { num = ((RaycastHit)(ref val)).point.y; } else if ((Object)(object)ZoneSystem.instance != (Object)null) { num = ZoneSystem.instance.GetGroundHeight(position); } float liquidLevel = Floating.GetLiquidLevel(position, 1f, (LiquidType)0); return new Vector3(position.x, Mathf.Max(num, liquidLevel), position.z); } private void Start() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0038: 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_0042: 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_0051: 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_012d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Material == (Object)null)) { GameObject val = new GameObject("reach_ring"); val.transform.SetParent(((Component)this).transform, false); val.transform.position = Surface(((Component)this).transform.position) + Vector3.up * 0.05f; val.transform.rotation = Quaternion.Euler(-90f, 0f, 0f); _line = val.AddComponent<LineRenderer>(); ((Renderer)_line).sharedMaterial = Material; _line.useWorldSpace = false; _line.loop = true; _line.alignment = (LineAlignment)1; _line.widthMultiplier = 0.08f; ((Renderer)_line).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)_line).receiveShadows = false; _line.positionCount = 72; for (int i = 0; i < 72; i++) { float num = (float)i * (float)Math.PI * 2f / 72f; _line.SetPosition(i, new Vector3(Mathf.Cos(num) * 6.75f, Mathf.Sin(num) * 6.75f, 0f)); } UpdateColor(); } } private void Update() { _age += Time.deltaTime; UpdateColor(); } private void UpdateColor() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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) if (!((Object)(object)_line == (Object)null)) { Color color = Color; color.a *= ((_age < Delay) ? 0f : Mathf.Clamp01(1f - (_age - Delay) / Lifetime)); _line.startColor = color; _line.endColor = color; } } } [BepInPlugin("groshyr.staffwhirls", "StaffWhirls", "1.7.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { private enum ElementKind { Fire, Frost, Lightning, Poison } private sealed class Element { public readonly string Id; public readonly string Source; public readonly string Prefix; public readonly string FieldName; public readonly ElementKind Kind; public readonly Color Color; public GameObject Whirl; public GameObject Field; public Element(ElementKind kind, string source, Color color) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) Kind = kind; Id = kind.ToString().ToLowerInvariant(); Prefix = "StaffWhirls_" + Id + "_"; FieldName = Prefix + "field"; Source = source; Color = color; } } private sealed class StaffSpec { public readonly string Prefab; public readonly ElementKind Kind; public GameObject PatchedPrefab; public StaffSpec(string prefab, ElementKind kind) { Prefab = prefab; Kind = kind; } } [HarmonyPatch(typeof(ObjectDB), "Awake")] private static class DatabaseReady { [HarmonyPriority(0)] [HarmonyAfter(new string[] { "treextr.pathofvalheiman" })] private static void Postfix() { Instance?.Apply(); } } [HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")] private static class DatabaseCopied { [HarmonyPriority(0)] [HarmonyAfter(new string[] { "treextr.pathofvalheiman" })] private static void Postfix() { Instance?.Apply(); } } [HarmonyPatch(typeof(ZNetScene), "Awake")] private static class SceneReady { [HarmonyPriority(0)] [HarmonyAfter(new string[] { "treextr.pathofvalheiman" })] private static void Postfix() { Instance?.Apply(); } } [HarmonyPatch(typeof(Aoe), "Setup")] private static class SetupPatch { [HarmonyPriority(0)] private static void Postfix(Aoe __instance, Character owner, Vector3 velocity, float hitNoise, HitData hitData, ItemData item, ItemData ammo) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Instance?.OnSetup(__instance, owner, velocity, hitNoise, hitData, item, ammo); } } [HarmonyPatch(typeof(Aoe), "GetDamage", new Type[] { typeof(int) })] private static class DamagePatch { private static bool Prefix(Aoe __instance, ref DamageTypes __result) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!Own(__instance)) { return true; } __result = __instance.m_damage; return false; } } [HarmonyPatch(typeof(Attack), "GetAttackEitr", new Type[] { typeof(Character), typeof(ItemData) })] private static class EitrPatch { [HarmonyPriority(801)] [HarmonyBefore(new string[] { "treextr.pathofvalheiman" })] private static void Postfix(Attack __instance, Character character, ItemData weapon, ref float __result) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (Spin(__instance)) { float attackEitr = weapon.m_shared.m_attack.m_attackEitr; float num = SpinCost(weapon); __result = ((attackEitr > 0f) ? (__result * num / attackEitr) : (num * (1f - 0.33f * character.GetSkillFactor(weapon.m_shared.m_skillType)))); } } } [HarmonyPatch(typeof(Attack), "DoAreaAttack")] private static class TriggerPatch { private static bool Prefix(Attack __instance, Humanoid ___m_character, ItemData ___m_weapon, ItemData ___m_lastUsedAmmo) { //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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0076: Unknown result type (might be due to invalid IL or missing references) if (!Spin(__instance)) { return true; } if ((Object)(object)Instance != (Object)null && (Object)(object)__instance.m_spawnOnTrigger == (Object)(object)Instance._storm) { Instance.CastStorm(___m_character, ___m_weapon); ((Character)___m_character).AddNoise(__instance.m_attackHitNoise); return false; } Vector3 val = GroundRing.Surface(((Component)___m_character).transform.position); Object.Instantiate<GameObject>(__instance.m_spawnOnTrigger, val, Quaternion.identity).GetComponent<Aoe>().Setup((Character)(object)___m_character, ((Component)___m_character).transform.forward, __instance.m_attackHitNoise, (HitData)null, ___m_weapon, ___m_lastUsedAmmo); ((Character)___m_character).AddNoise(__instance.m_attackHitNoise); return false; } } public const string Guid = "groshyr.staffwhirls"; public const float Radius = 6.75f; private const string Slow = "StaffWhirls_FrostSlow"; private const string BossSlow = "StaffWhirls_FrostSlowBoss"; private static Plugin Instance; private static readonly FieldRef<ZNetScene, Dictionary<int, GameObject>> Named = AccessTools.FieldRefAccess<ZNetScene, Dictionary<int, GameObject>>("m_namedPrefabs"); private readonly Element[] _elements = new Element[4] { new Element(ElementKind.Fire, "DvergerStaffFire_fire_aoe", new Color(0.95f, 0.43f, 0.16f)), new Element(ElementKind.Frost, "DvergerStaffNova_aoe", new Color(0.6f, 0.79f, 0.91f)), new Element(ElementKind.Lightning, "DvergerStaffNova_aoe", new Color(0.7f, 0.8f, 1f)), new Element(ElementKind.Poison, "DvergerStaffFire_fire_aoe", new Color(0.54f, 0.76f, 0.31f)) }; private readonly StaffSpec[] _staves = new StaffSpec[10] { new StaffSpec("StaffFireball", ElementKind.Fire), new StaffSpec("StaffIceShards", ElementKind.Frost), new StaffSpec("StaffLightning", ElementKind.Lightning), new StaffSpec("StaffGreenRoots", ElementKind.Poison), new StaffSpec("PT_StaffKindling", ElementKind.Fire), new StaffSpec("PT_StaffCinder", ElementKind.Fire), new StaffSpec("PT_StaffRot", ElementKind.Poison), new StaffSpec("PT_StaffRime", ElementKind.Frost), new StaffSpec("PT_StaffStorm", ElementKind.Lightning), new StaffSpec("PT_Unique_StormStaff", ElementKind.Lightning) }; private readonly HashSet<string> _warnings = new HashSet<string>(); private GameObject _holder; private ConfigEntry<bool> _ring; private ConfigEntry<bool> _trail; private ConfigEntry<bool> _burst; private ConfigEntry<float> _brightness; private SE_Stats _slow; private SE_Stats _bossSlow; private Func<Attack, object> _povProvider; private static readonly FieldRef<MeleeWeaponTrail, Material> TrailMaterial = AccessTools.FieldRefAccess<MeleeWeaponTrail, Material>("_material"); private static readonly FieldRef<MeleeWeaponTrail, Color[]> TrailColors = AccessTools.FieldRefAccess<MeleeWeaponTrail, Color[]>("_colors"); private static readonly FieldRef<MeleeWeaponTrail, float> TrailLife = AccessTools.FieldRefAccess<MeleeWeaponTrail, float>("_lifeTime"); private static readonly FieldRef<MeleeWeaponTrail, Transform> TrailBase = AccessTools.FieldRefAccess<MeleeWeaponTrail, Transform>("_base"); private static readonly FieldRef<MeleeWeaponTrail, Transform> TrailTip = AccessTools.FieldRefAccess<MeleeWeaponTrail, Transform>("_tip"); private const string ThunderStaff = "StaffThunderBlood"; private const string ThunderDonor = "staff_thunderblood_projectile"; private const string StormName = "StaffWhirls_storm"; private const string StrikeName = "StaffWhirls_storm_strike"; private const string FlashName = "StaffWhirls_storm_flash"; private const float StrikeShare = 0.75f; private const float StrikeRadius = 3f; internal const float StormRadius = 9f; internal const float StormLife = 10f; internal const float StormInterval = 1f; internal const float StormEitrFactor = 2.5f; internal const float StormStamina = 100f; internal const int GroundBoltsMin = 1; internal const int GroundBoltsMax = 2; private const float SkillPerEitr = 0.005f; private static readonly Color BloodRed = new Color(0.9f, 0.18f, 0.3f); private static readonly Color BoltRed = new Color(1f, 0.32f, 0.36f); private const string BurstFx = "fx_redlightning_burst"; private GameObject _storm; private GameObject _strike; private GameObject _flash; private GameObject _thunderPatched; private GameObject _activeStorm; private float Brightness => Mathf.Clamp(_brightness.Value, 0f, 2f); private void Awake() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown Instance = this; _ring = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "Ring", true, "Show the reach ring. Local appearance only; restart the game after changes."); _trail = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "Trail", true, "Show a trail at the staff head during the swing. Local appearance only; restart required."); _burst = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "Centre burst", true, "Show one visual-only elemental burst. Local appearance only; restart required."); _brightness = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "Effects brightness", 1f, new ConfigDescription("Local particle, trail and ring brightness; restart required.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); Harmony val = new Harmony("groshyr.staffwhirls"); val.PatchAll(); PatchPovRegistration(val); PrefabManager.OnPrefabsRegistered += Apply; ItemManager.OnItemsRegistered += Apply; Apply(); } private void OnDestroy() { PrefabManager.OnPrefabsRegistered -= Apply; ItemManager.OnItemsRegistered -= Apply; Harmony.UnpatchID("groshyr.staffwhirls"); Instance = null; } private GameObject Holder() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if ((Object)(object)_holder != (Object)null) { return _holder; } _holder = new GameObject("StaffWhirls_prefabs"); _holder.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_holder); return _holder; } private void PatchPovRegistration(Harmony harmony) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown Type type = AccessTools.TypeByName("PassiveTree.AltAttacks"); MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "MadeBy", new Type[1] { typeof(Attack) }, (Type[])null)); if (methodInfo != null) { _povProvider = (Func<Attack, object>)Delegate.CreateDelegate(typeof(Func<Attack, object>), methodInfo); } Type type2 = AccessTools.TypeByName("PassiveTree.Content"); if (!(type2 == null)) { MethodInfo methodInfo2 = AccessTools.Method(type2, "Item", new Type[1] { typeof(GameObject) }, (Type[])null); if (methodInfo2 == null) { Warn("PoV registration", "Content.Item hook unavailable; using late database/scene hooks"); return; } harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "AfterPovItem", (Type[])null) { priority = 0 }, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static void AfterPovItem(GameObject go) { if ((Object)(object)Instance == (Object)null || (Object)(object)go == (Object)null) { return; } string name = ((Object)go).name; StaffSpec[] staves = Instance._staves; for (int i = 0; i < staves.Length; i++) { if (staves[i].Prefab == name) { Instance.Apply(); break; } } } private void Apply() { //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) ZNetScene instance = ZNetScene.instance; ObjectDB instance2 = ObjectDB.instance; if ((Object)(object)instance2 != (Object)null) { EnsureStatuses(instance2); } if ((Object)(object)instance == (Object)null || (Object)(object)instance2 == (Object)null) { return; } Element[] elements = _elements; foreach (Element element in elements) { if ((Object)(object)element.Whirl == (Object)null) { element.Whirl = MakeAura(instance, element, field: false); } if ((Object)(object)element.Field == (Object)null) { element.Field = MakeAura(instance, element, field: true); } Register(instance, element.Whirl); Register(instance, element.Field); } StaffSpec[] staves = _staves; foreach (StaffSpec staffSpec in staves) { GameObject itemPrefab = instance2.GetItemPrefab(staffSpec.Prefab); ItemDrop val = (((Object)(object)itemPrefab != (Object)null) ? itemPrefab.GetComponent<ItemDrop>() : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)staffSpec.PatchedPrefab == (Object)(object)itemPrefab) && (_povProvider == null || _povProvider(val.m_itemData.m_shared.m_secondaryAttack) == null)) { Element element2 = _elements[(int)staffSpec.Kind]; if (!((Object)(object)element2.Whirl == (Object)null) && !((Object)(object)element2.Field == (Object)null)) { AddTrail(instance, itemPrefab, element2.Color); Assign(val.m_itemData, element2); staffSpec.PatchedPrefab = itemPrefab; DamageTypes primary = PrimaryDamage(val.m_itemData); ManualLogSource logger = ((BaseUnityPlugin)this).Logger; object[] obj = new object[6] { staffSpec.Prefab, ((DamageTypes)(ref primary)).GetTotalDamage(), null, null, null, null }; DamageTypes val2 = Damage(primary, element2.Kind, field: false); obj[2] = ((DamageTypes)(ref val2)).GetTotalDamage(); val2 = Damage(primary, element2.Kind, field: true); obj[3] = ((DamageTypes)(ref val2)).GetTotalDamage(); obj[4] = SpinCost(val.m_itemData); obj[5] = SpinStamina(val.m_itemData); logger.LogInfo((object)string.Format("{0}: primary per cast {1:0.##}, whirl {2:0.##}, field {3:0.##}; eitr {4}, stamina {5}", obj)); } } } ApplyThunder(instance, instance2); } private GameObject MakeAura(ZNetScene scene, Element e, bool field) { //IL_0112: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Expected O, but got Unknown //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Expected O, but got Unknown //IL_0289: Unknown result type (might be due to invalid IL or missing references) GameObject val = Find(scene, e.Source); if ((Object)(object)val == (Object)null || (Object)(object)val.GetComponent<Aoe>() == (Object)null || (Object)(object)val.GetComponent<ZNetView>() == (Object)null) { Warn(e.Source, "networked vanilla Aoe source missing"); return null; } GameObject val2 = Object.Instantiate<GameObject>(val, Holder().transform, false); ((Object)val2).name = "StaffWhirls_" + e.Id + (field ? "_field" : "_whirl"); Transform[] array = ((IEnumerable)val2.transform).Cast<Transform>().ToArray(); for (int i = 0; i < array.Length; i++) { Object.DestroyImmediate((Object)(object)((Component)array[i]).gameObject); } MonoBehaviour[] components = val2.GetComponents<MonoBehaviour>(); foreach (MonoBehaviour val3 in components) { if (!(val3 is Aoe) && !(val3 is ZNetView)) { Object.DestroyImmediate((Object)(object)val3); } } Collider[] components2 = val2.GetComponents<Collider>(); for (int i = 0; i < components2.Length; i++) { Object.DestroyImmediate((Object)(object)components2[i]); } Aoe component = val2.GetComponent<Aoe>(); component.m_useAttackSettings = false; component.m_damage = default(DamageTypes); component.m_damagePerLevel = default(DamageTypes); component.m_scaleDamageByDistance = false; component.m_dodgeable = true; component.m_blockable = false; component.m_attackForce = 0f; component.m_knockBackForce = 0f; component.m_hitOwner = false; component.m_hitParent = false; component.m_hitSame = false; component.m_hitFriendly = false; component.m_hitEnemy = true; component.m_hitCharacters = true; component.m_hitProps = false; component.m_hitTerrain = false; component.m_useTriggers = false; component.m_useCollider = null; component.m_attachToCaster = false; component.m_skill = (SkillType)9; component.m_canRaiseSkill = true; component.m_radius = 6.75f; component.m_activationDelay = (field ? 3f : 0f); component.m_ttl = (field ? 8f : 3f); component.m_ttlMax = 0f; component.m_hitAfterTtl = false; component.m_hitInterval = 1f; component.m_hitOnEnable = false; component.m_spawnOnHitTerrain = null; component.m_chainObj = null; component.m_chainStartChance = 0f; component.m_damageSelf = 0f; component.m_statusEffect = ((e.Kind == ElementKind.Frost) ? "StaffWhirls_FrostSlow" : ""); component.m_statusEffectIfBoss = ((e.Kind == ElementKind.Frost) ? "StaffWhirls_FrostSlowBoss" : ""); component.m_statusEffectIfPlayer = ""; component.m_hitEffects = new EffectList(); component.m_initiateEffect = new EffectList(); AddPresentation(scene, val2, e.Kind, field, e.Color); return val2; } private void Assign(ItemData item, Element e) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0045: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_014d: Expected O, but got Unknown //IL_014d: Expected O, but got Unknown if (!((Object)(object)e.Whirl == (Object)null)) { item.m_shared.m_secondaryAttack = new Attack { m_attackType = (AttackType)4, m_attackAnimation = "atgeir_secondary", m_attackRandomAnimations = 0, m_attackChainLevels = 0, m_attackRange = 0f, m_attackHeight = 0.6f, m_speedFactor = 0.2f, m_speedFactorRotation = 0.2f, m_attackStartNoise = 10f, m_attackHitNoise = 30f, m_attackStamina = SpinStamina(item), m_attackEitr = SpinCost(item), m_attackAdrenaline = 0f, m_damageMultiplier = 0f, m_forceMultiplier = 0f, m_raiseSkillAmount = 0f, m_hitTerrain = false, m_requiresReload = false, m_spawnOnTrigger = e.Whirl, m_startEffect = (EffectList)((item.m_shared.m_startEffect.m_effectPrefabs.Length == 0) ? ((object)((e.Kind == ElementKind.Poison) ? item.m_shared.m_attack.m_startEffect : Effects(Find(ZNetScene.instance, (e.Kind == ElementKind.Fire) ? "sfx_firestaff_launch" : ((e.Kind == ElementKind.Lightning) ? "sfx_StaffLightning_charge" : "sfx_icestaff_start"))))) : ((object)new EffectList())) }; ManualLogSource logger = ((BaseUnityPlugin)this).Logger; object[] array = new object[4]; GameObject dropPrefab = item.m_dropPrefab; array[0] = ((dropPrefab != null) ? ((Object)dropPrefab).name : null) ?? item.m_shared.m_name; array[1] = SpinCost(item); array[2] = SpinStamina(item); array[3] = ((Object)e.Whirl).name; logger.LogInfo((object)string.Format("Assigned {0}: atgeir_secondary, eitr {1}, stamina {2}, {3}", array)); } } private static int ProjectilesPerCast(ItemData item) { Attack attack = item.m_shared.m_attack; return Mathf.Max(1, attack.m_projectiles) * (attack.m_perBurstResourceUsage ? 1 : Mathf.Max(1, attack.m_projectileBursts)); } private static float SpinCost(ItemData item) { Attack attack = item.m_shared.m_attack; if (item.m_shared.m_name == "$item_staffgreenroots") { return attack.m_attackEitr; } if (item.m_shared.m_name == "$item_staff_thunderblood") { return Mathf.Round(attack.m_attackEitr * 2.5f); } return Mathf.Round(((attack.m_attackEitr > 0f) ? attack.m_attackEitr : attack.m_reloadEitrDrain) * 30f / 13f); } private static float SpinStamina(ItemData item) { return Mathf.Round(item.m_shared.m_attack.m_attackStamina * 1.5f); } private static DamageTypes PrimaryDamage(ItemData item) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) DamageTypes damage = item.GetDamage(); ((DamageTypes)(ref damage)).Modify((float)ProjectilesPerCast(item)); return damage; } private static DamageTypes Damage(DamageTypes primary, ElementKind kind, bool field) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_009a: Unknown result type (might be due to invalid IL or missing references) float totalDamage = ((DamageTypes)(ref primary)).GetTotalDamage(); float num = (field ? 0.69f : 1.14f); switch (kind) { case ElementKind.Fire: if (field) { return new DamageTypes { m_fire = totalDamage * num }; } return new DamageTypes { m_blunt = primary.m_blunt * num, m_fire = (totalDamage - primary.m_blunt) * num }; case ElementKind.Frost: return new DamageTypes { m_frost = totalDamage * num }; case ElementKind.Poison: if (field) { return new DamageTypes { m_poison = totalDamage * num }; } ((DamageTypes)(ref primary)).Modify(num); return primary; default: return new DamageTypes { m_lightning = totalDamage * num }; } } private void OnSetup(Aoe aoe, Character owner, Vector3 velocity, float noise, HitData hit, ItemData item, ItemData ammo) { //IL_002c: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00a3: 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) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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_0147: Unknown result type (might be due to invalid IL or missing references) if (!Own(aoe)) { return; } if (item == null || (Object)(object)owner == (Object)null) { Warn("setup", "whirl setup has no attacker/item; damage disabled"); aoe.m_damage = default(DamageTypes); return; } Element element = null; string name = ((Object)aoe).name; Element[] elements = _elements; foreach (Element element2 in elements) { if (name.StartsWith(element2.Prefix, StringComparison.Ordinal)) { element = element2; break; } } if (element == null) { return; } bool flag = name.StartsWith(element.FieldName, StringComparison.Ordinal); DamageTypes primary = PrimaryDamage(item); aoe.m_damage = Damage(primary, element.Kind, flag); aoe.m_skill = (SkillType)9; float num = aoe.m_radius / 6.75f; if (!Mathf.Approximately(num, 1f) && num > 0f) { ParticleSystem[] componentsInChildren = ((Component)aoe).GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val in componentsInChildren) { Transform parent = ((Component)val).transform.parent; while ((Object)(object)parent != (Object)null && (Object)(object)parent != (Object)(object)((Component)aoe).transform && (Object)(object)((Component)parent).GetComponent<ParticleSystem>() == (Object)null) { parent = parent.parent; } if ((Object)(object)parent == (Object)(object)((Component)aoe).transform) { Transform transform = ((Component)val).transform; transform.localScale /= num; } } } aoe.m_radius = 6.75f; if (flag) { return; } Vector3 val2 = GroundRing.Surface(((Component)owner).transform.position); ((Component)aoe).transform.position = val2; ZNetView component = ((Component)aoe).GetComponent<ZNetView>(); if (component != null) { ZDO zDO = component.GetZDO(); if (zDO != null) { zDO.SetPosition(val2); } } Object.Instantiate<GameObject>(element.Field, val2, Quaternion.identity).GetComponent<Aoe>().Setup(owner, velocity, noise, hit, item, ammo); } private void EnsureStatuses(ObjectDB db) { if ((Object)(object)_slow == (Object)null) { _slow = MakeSlow(db, "StaffWhirls_FrostSlow", -0.5f); } if ((Object)(object)_bossSlow == (Object)null) { _bossSlow = MakeSlow(db, "StaffWhirls_FrostSlowBoss", -0.2f); } if ((Object)(object)_slow != (Object)null && (Object)(object)db.GetStatusEffect(StringExtensionMethods.GetStableHashCode("StaffWhirls_FrostSlow")) == (Object)null) { db.m_StatusEffects.Add((StatusEffect)(object)_slow); } if ((Object)(object)_bossSlow != (Object)null && (Object)(object)db.GetStatusEffect(StringExtensionMethods.GetStableHashCode("StaffWhirls_FrostSlowBoss")) == (Object)null) { db.m_StatusEffects.Add((StatusEffect)(object)_bossSlow); } } private SE_Stats MakeSlow(ObjectDB db, string name, float speed) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown StatusEffect statusEffect = db.GetStatusEffect(StringExtensionMethods.GetStableHashCode("Slimed")); SE_Stats val = (SE_Stats)(object)((statusEffect is SE_Stats) ? statusEffect : null); if (val == null) { Warn("Slimed", "slow source unavailable"); return null; } SE_Stats obj = Object.Instantiate<SE_Stats>(val); ((Object)obj).name = name; ((StatusEffect)obj).m_name = "$se_frost"; ((StatusEffect)obj).m_ttl = 1.5f; obj.m_speedModifier = speed; ((StatusEffect)obj).m_startEffects = new EffectList(); ((StatusEffect)obj).m_stopEffects = new EffectList(); ((Object)obj).hideFlags = (HideFlags)32; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Status {name}: speed {speed:P0}, 1.5 s, no slime visuals"); return obj; } private static bool Own(Aoe aoe) { string name = ((Object)aoe).name; if (!name.StartsWith("StaffWhirls_fire_", StringComparison.Ordinal) && !name.StartsWith("StaffWhirls_frost_", StringComparison.Ordinal) && !name.StartsWith("StaffWhirls_lightning_", StringComparison.Ordinal) && !name.StartsWith("StaffWhirls_poison_", StringComparison.Ordinal)) { return name.StartsWith("StaffWhirls_storm_", StringComparison.Ordinal); } return true; } private static bool Spin(Attack attack) { if ((Object)(object)attack.m_spawnOnTrigger != (Object)null) { return ((Object)attack.m_spawnOnTrigger).name.StartsWith("StaffWhirls_", StringComparison.Ordinal); } return false; } private static GameObject Find(ZNetScene scene, string name) { if (!((Object)(object)scene != (Object)null)) { return null; } return scene.GetPrefab(name) ?? PrefabManager.Instance.GetPrefab(name); } private static EffectList Effects(GameObject prefab) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //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_0024: 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_0033: Expected O, but got Unknown EffectList val = new EffectList(); val.m_effectPrefabs = (EffectData[])(((Object)(object)prefab == (Object)null) ? ((Array)Array.Empty<EffectData>()) : ((Array)new EffectData[1] { new EffectData { m_prefab = prefab, m_enabled = true, m_variant = -1 } })); return val; } private void Warn(string key, string message) { if (_warnings.Add(key)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)(key + ": " + message)); } } private static void Register(ZNetScene scene, GameObject prefab) { if (!((Object)(object)prefab == (Object)null)) { int stableHashCode = StringExtensionMethods.GetStableHashCode(((Object)prefab).name); if (!Named.Invoke(scene).ContainsKey(stableHashCode)) { scene.m_prefabs.Add(prefab); Named.Invoke(scene)[stableHashCode] = prefab; } } } private void AddPresentation(ZNetScene scene, GameObject aura, ElementKind kind, bool field, Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("local_element_effects"); val.transform.SetParent(aura.transform, false); val.SetActive(false); PhaseEffects phaseEffects = aura.AddComponent<PhaseEffects>(); phaseEffects.Visuals = val; phaseEffects.Delay = (field ? 3f : 0f); phaseEffects.Lifetime = (field ? 8f : 3f); switch (kind) { case ElementKind.Fire: AddGround(scene, "DvergerStaffFire_fire_aoe", "low_flames", val.transform, field, 95f, 0.9f, 1.6f, 1.4f, 0.05f); AddGround(scene, "DvergerStaffFire_fire_aoe", "flames (2)", val.transform, field, 20f, 1f, 1.6f, 1.8f, 0.08f); AddGround(scene, "DvergerStaffFire_fire_aoe", "smoke", val.transform, field, 10f, 1.8f, 2.8f, 2.5f, 0.15f); AddGround(scene, "fx_fireball_staff_explosion", "Sparks", val.transform, field, 14f, 0.05f, 0.12f, 1.6f, 0.3f); CopySound(Find(scene, "DvergerStaffFire_fire_aoe"), "sfx_fire_loop", val.transform, field ? 0.4f : 0.65f); if (!field) { AddBurst(scene, "fx_fireball_staff_explosion", val.transform); CopySound(Find(scene, "fx_fireball_staff_explosion"), "sfx", val.transform, 1f); } break; case ElementKind.Frost: AddGround(scene, "fx_DvergerMage_Nova_ring", "ground_poof", val.transform, field, 24f, 1.6f, 2.4f, 2f, 0.06f); AddGround(scene, "fx_DvergerMage_Nova_ring", "poff sparks", val.transform, field, 14f, 0.09f, 0.18f, 1.8f, 0.08f); if (!field) { AddGround(scene, "fx_DvergerMage_Nova_ring", "flames_world", val.transform, field: false, 18f, 0.35f, 0.7f, 1.6f, 0.08f); AddBurst(scene, "fx_DvergerMage_Nova_ring", val.transform); CopySound(Find(scene, "fx_DvergerMage_Nova_ring"), "sfx_shockwave", val.transform, 1f); } break; case ElementKind.Lightning: AddGround(scene, "StaffLightning", "Clouds", val.transform, field, 12f, 1.5f, 2.5f, 3f, 0.02f); AddLightningField(scene, val.transform, field); if (!field) { AddLightningBurst(scene, val.transform); CopySound(Find(scene, "sfx_StaffLightning_fire"), "sfx_StaffLightning_fire", val.transform, 1f); } break; case ElementKind.Poison: AddGround(scene, "StaffGreenRoots", "Spores", val.transform, field, 12f, 0.06f, 0.13f, 3f, 0.08f); AddGround(scene, "StaffGreenRoots", "Spores_World", val.transform, field, 6f, 0.05f, 0.1f, 2.5f, 0.02f); AddGround(scene, "fx_greenroots_projectile_hit", "fx_greenroots_projectile_hit", val.transform, field, 9f, 1.2f, 2.1f, 2.6f, 0.05f); if (field) { CopySound(Find(scene, "sfx_staff_elder_grow"), "sfx_staff_elder_grow", val.transform, 0.4f); break; } AddBurst(scene, "fx_greenroots_projectile_hit", val.transform); CopySound(Find(scene, "sfx_staff_elder_burst"), "sfx_staff_elder_burst", val.transform, 1f); break; } if (_ring.Value) { GameObject obj = Find(scene, "AtgeirIron"); MeleeWeaponTrail val2 = ((obj != null) ? obj.GetComponentsInChildren<MeleeWeaponTrail>(true).FirstOrDefault() : null); if ((Object)(object)val2 == (Object)null) { Warn("ring", "AtgeirIron trail material missing"); return; } GroundRing groundRing = aura.AddComponent<GroundRing>(); groundRing.Material = TrailMaterial.Invoke(val2); color.a = (field ? 0.22f : 0.4f) * Brightness; groundRing.Color = color; groundRing.Delay = phaseEffects.Delay; groundRing.Lifetime = phaseEffects.Lifetime; } } private void AddBurst(ZNetScene scene, string name, Transform phase) { //IL_0038: 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) if (!_burst.Value) { return; } GameObject val = CopyPart(Find(scene, name), name, phase); if (!((Object)(object)val == (Object)null)) { ParticleSystem[] componentsInChildren = val.GetComponentsInChildren<ParticleSystem>(true); for (int i = 0; i < componentsInChildren.Length; i++) { MainModule main = componentsInChildren[i].main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).prewarm = false; } } } private void AddLightningBurst(ZNetScene scene, Transform phase) { //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_00ae: Unknown result type (might be due to invalid IL or missing references) if (!_burst.Value) { return; } GameObject source = Find(scene, "lightningAOE"); string[] array = new string[4] { "Lighting", "Lighting_rod", "shockwave_plane", "shockwave" }; foreach (string text in array) { GameObject val = CopyPart(source, text, phase); if ((Object)(object)val == (Object)null) { continue; } ParticleSystem[] componentsInChildren = val.GetComponentsInChildren<ParticleSystem>(true); for (int j = 0; j < componentsInChildren.Length; j++) { MainModule main = componentsInChildren[j].main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).prewarm = false; if (text == "Lighting" || text == "Lighting_rod") { ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.45f); } } } } private void AddLightningField(ZNetScene scene, Transform phase, bool field) { //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) //IL_0062: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) GameObject val = CopyPart(Find(scene, "vfx_lever"), "Sparks", phase); if ((Object)(object)val == (Object)null) { return; } ParticleSystem component = val.GetComponent<ParticleSystem>(); if ((Object)(object)component == (Object)null) { Warn("lightning/arcs", "vfx_lever/Sparks has no particle system"); return; } MainModule main = component.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).prewarm = false; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.25f); ((MainModule)(ref main)).startSize = new MinMaxCurve(1f, 1.6f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).maxParticles = 4; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = component.emission; ((EmissionModule)(ref emission)).enabled = false; ShapeModule shape = component.shape; ((ShapeModule)(ref shape)).enabled = false; GameObject val2 = CopySound(Find(scene, "sfx_weapons_lightning_chain"), "sfx_weapons_lightning_chain", phase, field ? 0.25f : 0.4f); ZSFX[] array = (((Object)(object)val2 != (Object)null) ? val2.GetComponentsInChildren<ZSFX>(true) : Array.Empty<ZSFX>()); ZSFX[] array2 = array; foreach (ZSFX obj in array2) { obj.m_playOnAwake = false; obj.m_fadeOutOnAwake = false; obj.m_fadeInDuration = 0f; AudioSource component2 = ((Component)obj).GetComponent<AudioSource>(); if ((Object)(object)component2 != (Object)null) { component2.loop = false; } } LightningField lightningField = ((Component)phase).gameObject.AddComponent<LightningField>(); lightningField.Arcs = component; lightningField.Sounds = array; lightningField.Interval = (field ? 1.1f : 0.65f); } private void AddGround(ZNetScene scene, string prefab, string part, Transform phase, bool field, float rate, float sizeMin, float sizeMax, float lifetime, float speed) { //IL_0031: 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_0051: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_0118: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: 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_01eb: 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_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) GameObject val = CopyPart(Find(scene, prefab), part, phase, children: false); if (!((Object)(object)val == (Object)null)) { val.transform.localPosition = new Vector3(0f, 0.12f, 0f); val.transform.localRotation = Quaternion.identity; val.transform.localScale = Vector3.one; ParticleSystem[] componentsInChildren = val.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem obj in componentsInChildren) { MainModule main = obj.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).prewarm = true; ((MainModule)(ref main)).duration = (field ? 8f : 3f); ((MainModule)(ref main)).startDelay = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startLifetime = new MinMaxCurve(lifetime * 0.75f, lifetime); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(speed * (field ? 0.5f : 1f)); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startSize3D = false; float num = (field ? 0.7f : 1f); ((MainModule)(ref main)).startSize = new MinMaxCurve(sizeMin * num, sizeMax * num); ((MainModule)(ref main)).maxParticles = Mathf.CeilToInt(rate * lifetime) + 8; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)0; ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)1; EmissionModule emission = obj.emission; ((EmissionModule)(ref emission)).enabled = true; ((EmissionModule)(ref emission)).SetBursts(Array.Empty<Burst>()); ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(rate * (field ? 0.45f : 1f)); ((EmissionModule)(ref emission)).rateOverDistance = MinMaxCurve.op_Implicit(0f); ShapeModule shape = obj.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10; ((ShapeModule)(ref shape)).radius = 6.75f; ((ShapeModule)(ref shape)).radiusThickness = 1f; ((ShapeModule)(ref shape)).position = Vector3.zero; ((ShapeModule)(ref shape)).rotation = new Vector3(90f, 0f, 0f); ((ShapeModule)(ref shape)).scale = Vector3.one; VelocityOverLifetimeModule velocityOverLifetime = obj.velocityOverLifetime; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = false; ForceOverLifetimeModule forceOverLifetime = obj.forceOverLifetime; ((ForceOverLifetimeModule)(ref forceOverLifetime)).enabled = false; NoiseModule noise = obj.noise; ((NoiseModule)(ref noise)).enabled = false; } } } private GameObject CopyPart(GameObject source, string name, Transform parent, bool children = true) { //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_019a: 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) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) Transform val = (((Object)(object)source != (Object)null) ? ((IEnumerable<Transform>)source.GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == name)) : null); if ((Object)(object)val == (Object)null) { Warn((((Object)(object)source != (Object)null) ? ((Object)source).name : "missing") + "/" + name, "visual part missing"); return null; } GameObject val2 = CopyChild(((Component)val).gameObject, parent, active: false); if (!children) { Transform[] array = ((IEnumerable)val2.transform).Cast<Transform>().ToArray(); for (int num = 0; num < array.Length; num++) { Object.DestroyImmediate((Object)(object)((Component)array[num]).gameObject); } } foreach (MonoBehaviour item in val2.GetComponentsInChildren<MonoBehaviour>(true).Reverse()) { Object.DestroyImmediate((Object)(object)item); } foreach (Component item2 in val2.GetComponentsInChildren<Component>(true).Reverse()) { if ((Object)(object)item2 != (Object)null && !(item2 is Transform) && !(item2 is ParticleSystem) && !(item2 is ParticleSystemRenderer)) { Object.DestroyImmediate((Object)(object)item2); } } ParticleSystem[] componentsInChildren = val2.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem obj in componentsInChildren) { obj.Stop(false, (ParticleSystemStopBehavior)0); LightsModule lights = obj.lights; ((LightsModule)(ref lights)).enabled = false; SubEmittersModule subEmitters = obj.subEmitters; ((SubEmittersModule)(ref subEmitters)).enabled = false; CollisionModule collision = obj.collision; ((CollisionModule)(ref collision)).enabled = false; TriggerModule trigger = obj.trigger; ((TriggerModule)(ref trigger)).enabled = false; MainModule main = obj.main; ((MainModule)(ref main)).playOnAwake = true; ((Component)obj).gameObject.SetActive(true); ((MainModule)(ref main)).stopAction = (ParticleSystemStopAction)0; ScaleAlpha(obj, Brightness); } val2.SetActive(true); return val2; } private GameObject CopySound(GameObject source, string name, Transform parent, float volume) { Transform val = (((Object)(object)source != (Object)null) ? ((IEnumerable<Transform>)source.GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == name)) : null); if ((Object)(object)val == (Object)null) { Warn("sound/" + name, "element sound missing"); return null; } GameObject val2 = CopyChild(((Component)val).gameObject, parent, active: false); foreach (MonoBehaviour item in val2.GetComponentsInChildren<MonoBehaviour>(true).Reverse()) { if (!(item is ZSFX)) { Object.DestroyImmediate((Object)(object)item); } } foreach (Component item2 in val2.GetComponentsInChildren<Component>(true).Reverse()) { if ((Object)(object)item2 != (Object)null && !(item2 is Transform) && !(item2 is ZSFX) && !(item2 is AudioSource)) { Object.DestroyImmediate((Object)(object)item2); } } ZSFX[] componentsInChildren = val2.GetComponentsInChildren<ZSFX>(true); foreach (ZSFX obj in componentsInChildren) { obj.m_minVol *= volume; obj.m_maxVol *= volume; } val2.SetActive(true); return val2; } private GameObject CopyChild(GameObject source, Transform parent, bool active = true) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate<GameObject>(source, Holder().transform, false); obj.SetActive(false); ((Object)obj).name = ((Object)source).name; obj.transform.SetParent(parent, false); obj.transform.localPosition = Vector3.zero; obj.transform.localRotation = Quaternion.identity; obj.SetActive(active); return obj; } private static void ScaleAlpha(ParticleSystem ps, float multiplier) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected I4, but got Unknown //IL_003f: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) if (multiplier != 1f) { MainModule main = ps.main; MinMaxGradient startColor = ((MainModule)(ref main)).startColor; ParticleSystemGradientMode mode = ((MinMaxGradient)(ref startColor)).mode; switch ((int)mode) { case 0: { Color color = ((MinMaxGradient)(ref startColor)).color; color.a *= multiplier; ((MinMaxGradient)(ref startColor)).color = color; break; } case 2: { Color colorMin = ((MinMaxGradient)(ref startColor)).colorMin; Color colorMax = ((MinMaxGradient)(ref startColor)).colorMax; colorMin.a *= multiplier; colorMax.a *= multiplier; ((MinMaxGradient)(ref startColor)).colorMin = colorMin; ((MinMaxGradient)(ref startColor)).colorMax = colorMax; break; } case 3: ((MinMaxGradient)(ref startColor)).gradientMin = ScaleAlpha(((MinMaxGradient)(ref startColor)).gradientMin, multiplier); ((MinMaxGradient)(ref startColor)).gradientMax = ScaleAlpha(((MinMaxGradient)(ref startColor)).gradientMax, multiplier); break; default: ((MinMaxGradient)(ref startColor)).gradient = ScaleAlpha(((MinMaxGradient)(ref startColor)).gradient, multiplier); break; } ((MainModule)(ref main)).startColor = startColor; } } private static Gradient ScaleAlpha(Gradient source, float multiplier) { //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_002d: 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_0045: Expected O, but got Unknown GradientAlphaKey[] alphaKeys = source.alphaKeys; for (int i = 0; i < alphaKeys.Length; i++) { alphaKeys[i].alpha *= multiplier; } Gradient val = new Gradient { mode = source.mode }; val.SetKeys(source.colorKeys, alphaKeys); return val; } private void AddTrail(ZNetScene scene, GameObject staff, Color color) { //IL_00cd: 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_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: 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_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) if (!_trail.Value) { return; } GameObject obj = Find(scene, "AtgeirIron"); MeleeWeaponTrail val = ((obj != null) ? obj.GetComponentsInChildren<MeleeWeaponTrail>(true).FirstOrDefault() : null); Transform val2 = staff.transform.Find("attach/default (1)") ?? staff.transform.Find("attach/default") ?? staff.transform.Find("attach"); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { Warn(((Object)staff).name + "/trail", "staff mesh or AtgeirIron trail missing"); } else { if ((Object)(object)val2.Find("StaffWhirls_trail") != (Object)null) { return; } GameObject val3 = CopyChild(((Component)val).gameObject, val2); ((Object)val3).name = "StaffWhirls_trail"; val3.transform.localScale = Vector3.one; MeleeWeaponTrail component = val3.GetComponent<MeleeWeaponTrail>(); Transform val4 = TrailBase.Invoke(component); Transform val5 = TrailTip.Invoke(component); if ((Object)(object)val4 == (Object)null || (Object)(object)val5 == (Object)null || !val4.IsChildOf(val3.transform) || !val5.IsChildOf(val3.transform)) { Object.DestroyImmediate((Object)(object)val3); Warn(((Object)staff).name + "/trail-ends", "invalid donor trail endpoints"); return; } Transform upgradeGlow = staff.transform.Find("attach/UpgraderGlow"); Light val6 = ((IEnumerable<Light>)((Component)val2).GetComponentsInChildren<Light>(true)).FirstOrDefault((Func<Light, bool>)((Light light) => (Object)(object)upgradeGlow == (Object)null || !((Component)light).transform.IsChildOf(upgradeGlow))); Vector3 val7 = (val5.localPosition = (Vector3)(((Object)(object)val6 != (Object)null) ? val2.InverseTransformPoint(((Component)val6).transform.position) : new Vector3(0f, 1.8f, 0f))); val4.localPosition = (Vector3)((((Vector3)(ref val7)).magnitude > 0.5f) ? (val7 * (1f - 0.45f / ((Vector3)(ref val7)).magnitude)) : new Vector3(0f, 1.35f, 0f)); color.a = 0.3f * Brightness; Color val9 = color; val9.a = 0f; TrailColors.Invoke(component) = (Color[])(object)new Color[2] { color, val9 }; TrailLife.Invoke(component) = 0.35f; component.Emit = false; } } private void ApplyThunder(ZNetScene scene, ObjectDB db) { //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Expected O, but got Unknown //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) GameObject val = Find(scene, "staff_thunderblood_projectile"); if ((Object)(object)val == (Object)null) { Warn("staff_thunderblood_projectile", "Lightning Strike projectile missing; no storm"); return; } if ((Object)(object)_flash == (Object)null) { _flash = MakeFlash(scene); } if ((Object)(object)_strike == (Object)null) { _strike = MakeStrike(scene); } if ((Object)(object)_storm == (Object)null) { _storm = MakeStorm(scene, val); } GameObject[] array = (GameObject[])(object)new GameObject[3] { _flash, _strike, _storm }; foreach (GameObject prefab in array) { Register(scene, prefab); } if (!((Object)(object)_flash == (Object)null) && !((Object)(object)_strike == (Object)null) && !((Object)(object)_storm == (Object)null)) { GameObject itemPrefab = db.GetItemPrefab("StaffThunderBlood"); ItemDrop val2 = (((Object)(object)itemPrefab != (Object)null) ? itemPrefab.GetComponent<ItemDrop>() : null); if (!((Object)(object)val2 == (Object)null) && !((Object)(object)_thunderPatched == (Object)(object)itemPrefab) && (_povProvider == null || _povProvider(val2.m_itemData.m_shared.m_secondaryAttack) == null)) { SharedData shared = val2.m_itemData.m_shared; shared.m_secondaryAttack = new Attack { m_attackType = (AttackType)4, m_attackAnimation = "staff_summon", m_attackRange = 0f, m_attackHeight = 1f, m_speedFactor = 0.2f, m_speedFactorRotation = 0.2f, m_attackStartNoise = 10f, m_attackHitNoise = 30f, m_attackStamina = 100f, m_attackEitr = SpinCost(val2.m_itemData), m_damageMultiplier = 0f, m_forceMultiplier = 0f, m_raiseSkillAmount = 0f, m_hitTerrain = false, m_spawnOnTrigger = _storm, m_startEffect = shared.m_attack.m_startEffect }; _thunderPatched = itemPrefab; DamageTypes val3 = PrimaryDamage(val2.m_itemData); ((BaseUnityPlugin)this).Logger.LogInfo((object)(string.Format("{0}: storm {1} s, every {2} s one bolt at a random enemy and ", "StaffThunderBlood", 10f, 1f) + $"{1}-{2} at the ground within {9f} m, {SpinCost(val2.m_itemData)} eitr + {100f} stamina; " + $"quality-1 bolt {((DamageTypes)(ref val3)).GetTotalDamage() * 0.75f:0.#} before Path of Valheiman bonuses; block unchanged")); } } } private GameObject NetworkedShell(ZNetScene scene, string name) { GameObject val = Find(scene, "DvergerStaffNova_aoe"); if ((Object)(object)val == (Object)null || (Object)(object)val.GetComponent<ZNetView>() == (Object)null) { Warn("shell", "networked shell source missing"); return null; } GameObject val2 = Object.Instantiate<GameObject>(val, Holder().transform, false); ((Object)val2).name = name; Transform[] array = ((IEnumerable)val2.transform).Cast<Transform>().ToArray(); for (int i = 0; i < array.Length; i++) { Object.DestroyImmediate((Object)(object)((Component)array[i]).gameObject); } MonoBehaviour[] components = val2.GetComponents<MonoBehaviour>(); foreach (MonoBehaviour val3 in components) { if (!(val3 is ZNetView)) { Object.DestroyImmediate((Object)(object)val3); } } Collider[] components2 = val2.GetComponents<Collider>(); for (int i = 0; i < components2.Length; i++) { Object.DestroyImmediate((Object)(object)components2[i]); } return val2; } private ParticleSystem Part(ZNetScene scene, string prefab, string part, Transform parent, Color? colour, float life = 1f) { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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) //IL_007f: 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_00a3: Unknown result type (might be due to invalid IL or missing references) GameObject val = Find(scene, prefab); GameObject val2 = CopyPart(val, part, parent, children: false); ParticleSystem val3 = (((Object)(object)val2 != (Object)null) ? val2.GetComponent<ParticleSystem>() : null); if ((Object)(object)val3 == (Object)null) { return null; } Transform val4 = ((IEnumerable<Transform>)val.GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == part)); if ((Object)(object)val4 != (Object)null && (Object)(object)val4 != (Object)(object)val.transform) { val2.transform.localPosition = val4.localPosition; val2.transform.localRotation = val4.localRotation; val2.transform.localScale = val4.localScale; } MainModule main = val3.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).prewarm = false; ((MainModule)(ref main)).startLifetimeMultiplier = ((MainModule)(ref main)).startLifetimeMultiplier * life; if (colour.HasValue) { Color value = colour.Value; MinMaxGradient startColor = ((MainModule)(ref main)).startColor; value.a = ((MinMaxGradient)(ref startColor)).color.a; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(value); TrailModule trails = val3.trails; if (((TrailModule)(ref trails)).enabled) { ((TrailModule)(ref trails)).inheritParticleColor = true; } } return val3; } private GameObject MakeFlash(ZNetScene scene) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_009f: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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) //IL_0179: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_012b: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) GameObject val = NetworkedShell(scene, "StaffWhirls_storm_flash"); if ((Object)(object)val == (Object)null) { return null; } Part(scene, "lightningAOE", "Lighting", val.transform, BoltRed, 0.15f); Part(scene, "lightningAOE", "Lighting_rod", val.transform, BoltRed, 0.1f); Part(scene, "lightningAOE", "lightning", val.transform, BoltRed, 0.4f); Part(scene, "lightningAOE", "Sparcs", val.transform, BoltRed, 0.6f); ParticleSystem val2 = Part(scene, "lightningAOE", "shockwave_plane", val.transform, BloodRed, 0.6f); if ((Object)(object)val2 != (Object)null) { MainModule main = val2.main; ((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * 0.3f; } GameObject val3 = CopyPart(Find(scene, "fx_redlightning_burst"), "fx_redlightning_burst", val.transform); if ((Object)(object)val3 != (Object)null) { val3.transform.localPosition = Vector3.up * 0.5f; ParticleSystem[] componentsInChildren = val3.GetComponentsInChildren<ParticleSystem>(true); for (int i = 0; i < componentsInChildren.Length; i++) { MainModule main2 = componentsInChildren[i].main; ((MainModule)(ref main2)).loop = false; } } GameObject val4 = new GameObject("flash"); val4.transform.SetParent(val.transform, false); val4.transform.localPosition = Vector3.up * 2f; Light obj = val4.AddComponent<Light>(); obj.type = (LightType)2; obj.color = BoltRed; obj.intensity = 4f * Brightness; obj.range = 14f; obj.shadows = (LightShadows)0; val4.AddComponent<LightPulse>().Duration = 0.35f; CopySound(Find(scene, "sfx_staffthunderblood_thunder"), "sfx_staffthunderblood_thunder", val.transform, 0.55f); CopySound(Find(scene, "fx_redlightning_burst"), "sfx", val.transform, 0.8f); TimedDestruction obj2 = val.AddComponent<TimedDestruction>(); obj2.m_timeout = 4f; obj2.m_triggerOnAwake = true; return val; } private GameObject MakeStrike(ZNetScene scene) { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Expected O, but got Unknown GameObject val = Find(scene, "DvergerStaffNova_aoe"); if ((Object)(object)val == (Object)null || (Object)(object)val.GetComponent<Aoe>() == (Object)null) { Warn("strike", "Aoe source missing"); return null; } GameObject val2 = Object.Instantiate<GameObject>(val, Holder().transform, false); ((Object)val2).name = "StaffWhirls_storm_strike"; Transform[] array = ((IEnumerable)val2.transform).Cast<Transform>().ToArray(); for (int i = 0; i < array.Length; i++) { Object.DestroyImmediate((Object)(object)((Component)array[i]).gameObject); } MonoBehaviour[] components = val2.GetComponents<MonoBehaviour>(); foreach (MonoBehaviour val3 in components) { if (!(val3 is Aoe) && !(val3 is ZNetView)) { Object.DestroyImmediate((Object)(object)val3); } } Collider[] components2 = val2.GetComponents<Collider>(); for (int i = 0; i < components2.Length; i++) { Object.DestroyImmediate((Object)(object)components2[i]); } Aoe component = val2.GetComponent<Aoe>(); component.m_useAttackSettings = false; component.m_damage = default(DamageTypes); component.m_damagePerLevel = default(DamageTypes); component.m_scaleDamageByDistance = false; component.m_dodgeable = true; component.m_blockable = false; component.m_attackForce = 0f; component.m_knockBackForce = 0f; component.m_hitOwner = false; component.m_hitParent = false; component.m_hitSame = false; component.m_hitFriendly = false; component.m_hitEnemy = true; component.m_hitCharacters = true; component.m_hitProps = false; component.m_hitTerrain = false; component.m_useTriggers = false; component.m_useCollider = null; component.m_attachToCaster = false; component.m_skill = (SkillType)9; component.m_canRaiseSkill = false; component.m_radius = 3f; component.m_activationDelay = 0f; component.m_ttl = 1.2f; component.m_ttlMax = 0f; component.m_hitAfterTtl = false; component.m_hitInterval = 0f; component.m_hitOnEnable = false; component.m_spawnOnHitTerrain = null; component.m_chainObj = null; component.m_chainStartChance = 0f; component.m_damageSelf = 0f; component.m_statusEffect = ""; component.m_statusEffectIfBoss = ""; component.m_statusEffectIfPlayer = ""; component.m_hitEffects = new EffectList(); component.m_initiateEffect = new EffectList(); return val2; } private void CloudLayer(ZNetScene scene, string prefab, string part, Transform deck, Color colour, float rate, Vector2 size, Vector2 life, float radius, float turn) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_009d: 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_00da: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_0123: 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_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_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0200: 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_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028b: 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_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: 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_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) GameObject val = CopyPart(Find(scene, prefab), part, deck, children: false); ParticleSystem val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<ParticleSystem>() : null); if (!((Object)(object)val2 == (Object)null)) { MainModule main = val2.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).prewarm = false; ((MainModule)(ref main)).duration = 5f; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)0; ((MainModule)(ref main)).startSize3D = false; ((MainModule)(ref main)).startSize = new MinMaxCurve(size.x, size.y); ((MainModule)(ref main)).startLifetime = new MinMaxCurve(life.x, life.y); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0f); colour.a *= Mathf.Clamp(Brightness, 0f, 1.5f); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(colour); ((MainModule)(ref main)).maxParticles = Mathf.CeilToInt(rate * life.y) + 30; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).enabled = true; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(rate); ((EmissionModule)(ref emission)).rateOverDistance = MinMaxCurve.op_Implicit(0f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)Mathf.CeilToInt(rate * 1.5f)) }); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10; ((ShapeModule)(ref shape)).radius = radius; ((ShapeModule)(ref shape)).radiusThickness = 1f; ((ShapeModule)(ref shape)).rotation = new Vector3(90f, 0f, 0f); ((ShapeModule)(ref shape)).position = Vector3.zero; VelocityOverLifetimeModule velocityOverLifetime = val2.velocityOverLifetime; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = MinMaxCurve.op_Implicit(0f); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = MinMaxCurve.op_Implicit(0f); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = MinMaxCurve.op_Implicit(0f); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalX = MinMaxCurve.op_Implicit(0f); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalY = MinMaxCurve.op_Implicit(turn); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).orbitalZ = MinMaxCurve.op_Implicit(0f); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).radial = MinMaxCurve.op_Implicit(0f); NoiseModule noise = val2.noise; ((NoiseModule)(ref noise)).enabled = false; ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val3 = new Gradient(); val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[4] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(1f, 0.25f), new GradientAlphaKey(1f, 0.7f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3); } } private GameObject MakeStorm(ZNetScene scene, GameObject donor) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_0217: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: 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_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) GameObject val = NetworkedShell(scene, "StaffWhirls_storm"); if ((Object)(object)val == (Object)null) { return null; } ZSyncTransform obj = val.GetComponent<ZSyncTransform>() ?? val.AddComponent<ZSyncTransform>(); obj.m_syncPosition = true; obj.m_syncRotation = false; GameObject val2 = new GameObject("cloud_deck"); val2.transform.SetParent(val.transform, false); val2.transform.localPosition = new Vector3(0f, 8f, 0f); CloudLayer(scene, "staff_thunderblood_projectile", "Clouds", val2.transform, new Color(0.16f, 0.12f, 0.17f, 0.9f), 22f, new Vector2(7f, 11f), new Vector2(3f, 4.5f), 8.5f, 0.25f); CloudLayer(scene, "fx_tick_death", "Blood Cloud", val2.transform, new Color(0.45f, 0.06f, 0.1f, 0.8f), 14f, new Vector2(6f, 9f), new Vector2(2.5f, 4f), 7f, 0.35f); CloudLayer(scene, "staff_thunderblood_projectile", "Clouds", val2.transform, new Color(0.3f, 0.07f, 0.1f, 0.7f), 10f, new Vector2(4f, 6f), new Vector2(2f, 3f), 4f, -0.3f); val2.AddComponent<EmitFor>().Seconds = 10f; GameObject val3 = CopyPart(Find(scene, "fx_redlightning_burst"), "Lightning", val2.transform, children: false); ParticleSystem val4 = (((Object)(object)val3 != (Object)null) ? val3.GetComponent<ParticleSystem>() : null); if ((Object)(object)val4 != (Object)null) { MainModule main = val4.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * 4f; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)0; EmissionModule emission = val4.emission; ((EmissionModule)(ref emission)).enabled = false; } GameObject val5 = new GameObject("cloud_light"); val5.transform.SetParent(val2.transform, false); Light val6 = val5.AddComponent<Light>(); val6.type = (LightType)2; val6.color = BoltRed; val6.intensity = 0f; val6.range = 26f; val6.shadows = (LightShadows)0; StormFlicker stormFlicker = val2.AddComponent<StormFlicker>(); stormFlicker.Arcs = val4; stormFlicker.Light = val6; stormFlicker.Peak = 3f * Brightness; stormFlicker.Radius = 7f; stormFlicker.Until = 10f; GameObject obj2 = Find(scene, "AtgeirIron"); MeleeWeaponTrail val7 = ((obj2 != null) ? obj2.GetComponentsInChildren<MeleeWeaponTrail>(true).FirstOrDefault() : null); if ((Object)(object)val7 != (Object)null) { ReachRing reachRing = val.AddComponent<ReachRing>(); reachRing.Material = TrailMaterial.Invoke(val7); Color bloodRed = BloodRed; bloodRed.a = 0.3f * Brightness; reachRing.Color = bloodRed; reachRing.Radius = 9f; reachRing.Until = 10f; } val.AddComponent<ThunderStorm>(); return val; } private void CastStorm(Humanoid character, ItemData weapon) { //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_0068: 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_008e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_storm == (Object)null || (Object)(object)character == (Object)null || weapon == null) { return; } if ((Object)(object)_activeStorm != (Object)null) { ZNetView component = _activeStorm.GetComponent<ZNetView>(); if (component != null && component.IsOwner()) { ZNetScene.instance.Destroy(_activeStorm); } } GameObject val = Object.Instantiate<GameObject>(_storm, GroundRing.Surface(((Component)character).transform.position), Quaternion.identity); ThunderStorm component2 = val.GetComponent<ThunderStorm>(); component2.Owner = (Character)(object)character; component2.Item = weapon; component2.Damage = StormDamage(character, weapon); _activeStorm = val; Player val2 = (Player)(object)((character is Player) ? character : null); if (val2 != null) { ((Character)val2).RaiseSkill((SkillType)9, 0.005f * SpinCost(weapon)); } } private static DamageTypes StormDamage(Humanoid character, ItemData weapon) { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0047: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0068: 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_008f: 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) HitData val = new HitData { m_toolTier = (short)weapon.m_shared.m_toolTier, m_skill = (SkillType)9, m_skillLevel = ((Character)character).GetSkillLevel((SkillType)9), m_itemLevel = (short)weapon.m_quality, m_itemWorldLevel = (byte)weapon.m_worldLevel, m_ranged = true, m_hitType = (HitType)((!(character is Player)) ? 1 : 2) }; ((DamageTypes)(ref val.m_damage)).Add(PrimaryDamage(weapon), 1); val.SetAttacker((Character)(object)character); ((Character)character).GetSEMan().ModifyAttack((SkillType)9, ref val); DamageTypes damage = val.m_damage; ((DamageTypes)(ref damage)).Modify(0.75f); return damage; } internal static void StormPulse(Character owner, ItemData item, DamageTypes damage, Vector3 centre) { //IL_000c: 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) Instance?.Pulse(owner, item, damage, centre); } private void Pulse(Character owner, ItemData item, DamageTypes damage, Vector3 centre) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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) //IL_007f: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00ab: 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) if (!((Object)(object)owner == (Object)null)) { List<Character> list = (from c in Character.GetAllCharacters() where (Object)(object)c != (Object)null && (Object)(object)c != (Object)(object)owner && !c.IsDead() && BaseAI.IsEnemy(owner, c) && Flat(((Component)c).transform.position, centre) <= 9f select c).ToList(); if (list.Count > 0) { Strike(owner, item, damage, ((Component)list[Random.Range(0, list.Count)]).transform.position); } int num = Random.Range(1, 3); for (int num2 = 0; num2 < num; num2++) { Vector2 val = Random.insideUnitCircle * 9f; Strike(owner, item, damage, centre + new Vector3(val.x, 0f, val.y)); } } } private void Strike(Character owner, ItemData item, DamageTypes damage, Vector3 at) { //IL_0000: 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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0021: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = GroundRing.Surface(at); Object.Instantiate<GameObject>(_flash, val, Quaternion.identity); Aoe component = Object.Instantiate<GameObject>(_strike, val, Quaternion.identity).GetComponent<Aoe>(); component.Setup(owner, Vector3.zero, 30f, (HitData)null, item, (ItemData)null); component.m_damage = damage; component.m_skill = (SkillType)9; } private static float Flat(Vector3 a, Vector3 b) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) a.y = 0f; b.y = 0f; return Vector3.Distance(a, b); } } public sealed class LightningField : MonoBehaviour { public ParticleSystem Arcs; public ZSFX[] Sounds; public float Interval; private static float s_lastSound = -10f; private float _nextArc; private void Update() { //IL_0020: 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) //IL_002f: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (Time.time < _nextArc) { return; } _nextArc = Time.time + Interval; Vector2 val = Random.insideUnitCircle * 6.75f; if ((Object)(object)Arcs != (Object)null) { ((Component)Arcs).transform.localPosition = new Vector3(val.x, 0.15f, val.y); Arcs.Emit(1); } if (!(Time.time - s_lastSound < 0.3f)) { s_lastSound = Time.time; ZSFX[] sounds = Sounds; foreach (ZSFX obj in sounds) { ((Component)obj).transform.position = ((Component)this).transform.TransformPoint(new Vector3(val.x, 0.15f, val.y)); obj.Play(); } } } } public sealed class PhaseEffects : MonoBehaviour { public GameObject Visuals; public float Delay; public float Lifetime; private float _age; private bool _started; private void Start() { if (Delay <= 0f) { Begin(); } } private void Update() { _age += Time.deltaTime; if (!_started && _age >= Delay) { Begin(); } if (_started && _age >= Delay + Lifetime && (Object)(object)Visuals != (Object)null) { Visuals.SetActive(false); } } private void Begin() { _started = true; if ((Object)(object)Visuals != (Object)null) { Visuals.SetActive(true); } } } public sealed class ThunderStorm : MonoBehaviour { public Character Owner; public ItemData Item; public DamageTypes Damage; private ZNetView _view; private float _age; private float _next = 0.5f; private void Awake() { _view = ((Component)this).GetComponent<ZNetView>(); } private void Update() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references)