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 GjallSummoner v1.2.0
GjallSummoner.dll
Decompiled 3 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("GjallStaff")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Hewlett-Packard Company")] [assembly: AssemblyProduct("GjallStaff")] [assembly: AssemblyCopyright("Copyright © Hewlett-Packard Company 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ff0ad91f-daf2-4851-a245-7f5371304e28")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("youdied.gjallsummoner", "Gjall Summoner", "1.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class GjallStaffMod : BaseUnityPlugin { [HarmonyPatch(typeof(Player), "OnSpawned")] public static class PlayerSpawnedPatch { private static void Postfix(Player __instance) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer) { currentGjall = 0; lastCastTime = -999f; Logger.LogInfo((object)"[GjallStaff] Player spawned — Gjall counters reset."); } } } [HarmonyPatch(typeof(Character), "OnDeath")] public static class GjallDeathPatch { private static void Prefix(Character __instance) { if ((Object)(object)((Component)__instance).GetComponent<SummonedGjallTag>() != (Object)null) { currentGjall = Mathf.Max(0, currentGjall - 1); Logger.LogInfo((object)"Summoned Gjall died — currentGjall decremented."); } } } [HarmonyPatch(typeof(Character), "Awake")] public static class TickTamerPatch { private static void Postfix(Character __instance) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_0063: 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_00de: Unknown result type (might be due to invalid IL or missing references) if (!((Object)__instance).name.StartsWith("Tick")) { return; } foreach (Character allCharacter in Character.GetAllCharacters()) { if (!((Object)allCharacter).name.StartsWith("Gjall") || (int)allCharacter.m_faction != 0 || !(Vector3.Distance(((Component)allCharacter).transform.position, ((Component)__instance).transform.position) < 20f)) { continue; } if (DisableTicks.Value) { ZNetView component = ((Component)__instance).GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.IsOwner()) { ZNetScene.instance.Destroy(((Component)__instance).gameObject); } else { Object.Destroy((Object)(object)((Component)__instance).gameObject); } } else { __instance.m_faction = (Faction)0; } break; } } } [HarmonyPatch(typeof(VisEquipment), "SetLeftHandEquipped")] public static class VisEquipLeftHandPatch { private class TickHandFX : MonoBehaviour { } private static void Postfix(VisEquipment __instance) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0157: 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_01e3: 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_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Expected O, but got Unknown //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) Transform val = (Transform)(typeof(VisEquipment).GetField("m_leftHand", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(__instance)); if ((Object)(object)val == (Object)null) { return; } TickVisualMarker componentInChildren = ((Component)val).GetComponentInChildren<TickVisualMarker>(); TickHandFX componentInChildren2 = ((Component)val).GetComponentInChildren<TickHandFX>(); if ((Object)(object)componentInChildren == (Object)null) { if ((Object)(object)componentInChildren2 != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren2).gameObject); } } else { if ((Object)(object)componentInChildren2 != (Object)null) { return; } GameObject prefab = PrefabManager.Instance.GetPrefab("StaffSkeleton"); if ((Object)(object)prefab == (Object)null) { Logger.LogWarning((object)"[GjallStaff] StaffSkeleton prefab not found"); return; } Transform val2 = null; Transform[] componentsInChildren = prefab.GetComponentsInChildren<Transform>(true); foreach (Transform val3 in componentsInChildren) { if (((Object)val3).name == "equiped") { val2 = val3; break; } } if ((Object)(object)val2 == (Object)null) { Logger.LogWarning((object)"[GjallStaff] equiped child not found in StaffSkeleton"); return; } GameObject val4 = Object.Instantiate<GameObject>(((Component)val2).gameObject, val, false); ((Object)val4).name = "TickHandFX"; val4.AddComponent<TickHandFX>(); val4.transform.localPosition = new Vector3(0f, -0.02f, 0.05f); val4.transform.localRotation = Quaternion.identity; val4.SetActive(true); ParticleSystem[] componentsInChildren2 = val4.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val5 in componentsInChildren2) { if (!(((Object)((Component)val5).gameObject).name == "flames") && !(((Object)((Component)val5).gameObject).name == "embers")) { continue; } ((Component)val5).gameObject.SetActive(true); MainModule main = val5.main; ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.3f, 0f, 0.8f, 1f), new Color(0.15f, 0f, 0.6f, 0.8f)); ParticleSystemRenderer component = ((Component)val5).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).material = new Material(((Renderer)component).material); ((Renderer)component).material.color = new Color(0.3f, 0f, 0.8f, 1f); if (((Renderer)component).material.HasProperty("_TintColor")) { ((Renderer)component).material.SetColor("_TintColor", new Color(0.2f, 0f, 0.7f, 0.5f)); } if (((Renderer)component).material.HasProperty("_Color")) { ((Renderer)component).material.SetColor("_Color", new Color(0.3f, 0f, 0.8f, 1f)); } if (((Renderer)component).material.HasProperty("_EmissionColor")) { ((Renderer)component).material.SetColor("_EmissionColor", new Color(0.3f, 0f, 0.8f) * 2f); } } val5.Play(true); } Logger.LogInfo((object)"[GjallStaff] StaffSkeleton equiped FX attached to tick"); } } } [HarmonyPatch(typeof(Player), "PlayerAttackInput")] public static class BlockSkeletonAttackPatch { private static bool Prefix(Player __instance) { if ((Object)(object)Player.m_localPlayer != (Object)(object)__instance) { return true; } ItemData currentWeapon = ((Humanoid)__instance).GetCurrentWeapon(); if (currentWeapon != null && (Object)(object)currentWeapon.m_dropPrefab != (Object)null && ((Object)currentWeapon.m_dropPrefab).name == "gjall_summoning_staff") { return false; } return true; } } [HarmonyPatch(typeof(Player), "Update")] public static class UpdatePatch { private static void Postfix(Player __instance) { if (!((Object)(object)Player.m_localPlayer != (Object)(object)__instance) && !InventoryGui.IsVisible() && !Menu.IsVisible() && Input.GetMouseButtonDown(0)) { ItemData currentWeapon = ((Humanoid)__instance).GetCurrentWeapon(); if (currentWeapon != null && (Object)(object)currentWeapon.m_dropPrefab != (Object)null && ((Object)currentWeapon.m_dropPrefab).name == "gjall_summoning_staff") { SummonGjall(__instance, currentWeapon.m_quality); } } } } [CompilerGenerated] private sealed class <SpawnGjallDelayed>d__13 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Player player; public GameObject prefab; public int staffQuality; public float delay; private Vector3 <spawnPos>5__1; private Camera <cam>5__2; private GameObject <gjall>5__3; private Character <character>5__4; private Ray <ray>5__5; private RaycastHit <hit>5__6; private int <starLevel>5__7; private string <starStr>5__8; private FieldInfo <zdoField>5__9; private ZNetView <nview>5__10; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpawnGjallDelayed>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <cam>5__2 = null; <gjall>5__3 = null; <character>5__4 = null; <starStr>5__8 = null; <zdoField>5__9 = null; <nview>5__10 = null; <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_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_01b9: 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_011b: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)player == (Object)null) { currentGjall--; return false; } <cam>5__2 = Camera.main; if ((Object)(object)<cam>5__2 != (Object)null) { <ray>5__5 = new Ray(((Component)<cam>5__2).transform.position, ((Component)<cam>5__2).transform.forward); if (Physics.Raycast(<ray>5__5, ref <hit>5__6, 30f, ~LayerMask.GetMask(new string[3] { "character", "CharacterTrigger", "piece_nonsolid" }))) { <spawnPos>5__1 = ((RaycastHit)(ref <hit>5__6)).point + Vector3.up * 3f; } else { <spawnPos>5__1 = ((Component)<cam>5__2).transform.position + ((Component)<cam>5__2).transform.forward * 30f; } } else { <spawnPos>5__1 = ((Component)player).transform.position + ((Component)player).transform.forward * 10f + Vector3.up * 8f; } <gjall>5__3 = Object.Instantiate<GameObject>(prefab, <spawnPos>5__1, Quaternion.identity); <gjall>5__3.transform.localScale = Vector3.one * 0.7f; <character>5__4 = <gjall>5__3.GetComponent<Character>(); if ((Object)(object)<character>5__4 != (Object)null) { <character>5__4.m_faction = (Faction)0; <starLevel>5__7 = Mathf.Clamp(staffQuality - 1, 0, 2); if (<starLevel>5__7 > 0) { <zdoField>5__9 = typeof(Character).GetField("m_nview", BindingFlags.Instance | BindingFlags.NonPublic); ref ZNetView reference = ref <nview>5__10; object? obj = <zdoField>5__9?.GetValue(<character>5__4); reference = (ZNetView)((obj is ZNetView) ? obj : null); ZNetView obj2 = <nview>5__10; if (obj2 != null) { ZDO zDO = obj2.GetZDO(); if (zDO != null) { zDO.Set(ZDOVars.s_level, <starLevel>5__7 + 1, false); } } <character>5__4.SetLevel(<starLevel>5__7 + 1); <zdoField>5__9 = null; <nview>5__10 = null; } <gjall>5__3.AddComponent<TamedGjallAI>().Init(player, <character>5__4); if (DespawnTime.Value > 0f) { <gjall>5__3.AddComponent<GjallDespawn>().Init(DespawnTime.Value); } <gjall>5__3.AddComponent<SummonedGjallTag>(); <starStr>5__8 = ((<starLevel>5__7 == 0) ? "" : ((<starLevel>5__7 == 1) ? " ⭐" : " ⭐⭐")); ((Character)player).Message((MessageType)2, "Gjall summoned!" + <starStr>5__8, 0, (Sprite)null); <starStr>5__8 = null; } else { currentGjall--; Object.Destroy((Object)(object)<gjall>5__3); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static ConfigEntry<int> MaxGjall; public static ConfigEntry<float> Cooldown; public static ConfigEntry<float> DespawnTime; public static ConfigEntry<float> EitrCost; public static ConfigEntry<bool> DisableTicks; private static float lastCastTime = -999f; public static int currentGjall = 0; private static GjallStaffMod instance; private const string STAFF_PREFAB_NAME = "gjall_summoning_staff"; private void Awake() { instance = this; MaxGjall = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxGjall", 1, "Maximum active Gjall"); Cooldown = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Cooldown", 30f, "Cooldown in seconds"); DespawnTime = ((BaseUnityPlugin)this).Config.Bind<float>("General", "DespawnTime", 120f, "Lifetime of Gjall in seconds"); EitrCost = ((BaseUnityPlugin)this).Config.Bind<float>("General", "EitrCost", 100f, "Eitr cost per cast"); DisableTicks = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DisableTicks", false, "Disable Tick spawning from summoned Gjall"); PrefabManager.OnVanillaPrefabsAvailable += CreateStaff; Harmony.CreateAndPatchAll(typeof(GjallStaffMod).Assembly, "com.rob.gjallsummoner"); } private void CreateStaff() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: 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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Expected O, but got Unknown //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: 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_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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_0202: Expected O, but got Unknown //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: 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_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Expected O, but got Unknown //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) PrefabManager.OnVanillaPrefabsAvailable -= CreateStaff; Sprite val = null; Assembly executingAssembly = Assembly.GetExecutingAssembly(); using (Stream stream = executingAssembly.GetManifestResourceStream("GjallSummoner.tick.png")) { if (stream != null) { byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val2 = new Texture2D(64, 64, (TextureFormat)4, false); MethodInfo methodInfo = Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule")?.GetMethod("LoadImage", new Type[2] { typeof(Texture2D), typeof(byte[]) }); if (methodInfo != null && (bool)methodInfo.Invoke(null, new object[2] { val2, array })) { val = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f)); Logger.LogInfo((object)"Gjall Staff: icon loaded from assembly."); } } else { Logger.LogWarning((object)"Gjall Staff: embedded tick.png not found in assembly."); } } ItemConfig val3 = new ItemConfig(); val3.Name = "Gjall Summoner"; val3.Description = "Summons a loyal Gjall to fight for you. Upgrade the staff to summon stronger Gjall."; val3.CraftingStation = CraftingStations.GaldrTable; val3.MinStationLevel = 1; val3.Icons = (Sprite[])(object)((!((Object)(object)val != (Object)null)) ? null : new Sprite[1] { val }); val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig { Item = "BlackCore", Amount = 5, AmountPerLevel = 5 }, new RequirementConfig { Item = "GiantBloodSack", Amount = 4, AmountPerLevel = 2 }, new RequirementConfig { Item = "Bilebag", Amount = 3, AmountPerLevel = 2 }, new RequirementConfig { Item = "TrophyGjall", Amount = 2, AmountPerLevel = 1 } }; ItemConfig val4 = val3; CustomItem val5 = new CustomItem("gjall_summoning_staff", "StaffSkeleton", val4); if (val5 != null && val5.IsValid()) { SharedData shared = val5.ItemDrop.m_itemData.m_shared; shared.m_attack.m_attackEitr = EitrCost.Value; SwapHeldVisualToTick(((Component)val5.ItemDrop).gameObject); ItemManager.Instance.AddItem(val5); Logger.LogInfo((object)"Gjall Summoner Loaded."); } } private static void SwapHeldVisualToTick(GameObject itemPrefab) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0161: 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_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: 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_01ce: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Expected O, but got Unknown //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Expected O, but got Unknown //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Expected O, but got Unknown //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) Transform val = itemPrefab.transform.Find("attach"); if ((Object)(object)val == (Object)null) { Logger.LogWarning((object)"Gjall Staff: could not find 'attach' child on item prefab."); return; } List<GameObject> list = new List<GameObject>(); foreach (Transform item in val) { Transform val2 = item; if (((Object)val2).name.StartsWith("fi_vil_combs")) { list.Add(((Component)val2).gameObject); } } foreach (GameObject item2 in list) { Object.DestroyImmediate((Object)(object)item2); } GameObject prefab = PrefabManager.Instance.GetPrefab("Tick"); if ((Object)(object)prefab == (Object)null) { Logger.LogWarning((object)"Gjall Staff: could not find Tick prefab."); return; } Transform val3 = prefab.transform.Find("Visual"); if ((Object)(object)val3 == (Object)null) { Logger.LogWarning((object)"Gjall Staff: could not find Visual child on Tick prefab."); return; } GameObject val4 = new GameObject("TickVisual"); val4.AddComponent<TickVisualMarker>(); val4.transform.SetParent(val, false); val4.transform.localPosition = new Vector3(0f, -0.05f, -0.006f); val4.transform.localRotation = new Quaternion(0.6107058f, -0.3564245f, -0.6107058f, -0.3564245f); val4.transform.localScale = Vector3.one * 0.25f; SkinnedMeshRenderer[] componentsInChildren = ((Component)val3).GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val5 in componentsInChildren) { Mesh val6 = new Mesh(); val5.BakeMesh(val6); GameObject val7 = new GameObject(((Object)val5).name); val7.transform.SetParent(val4.transform, false); MeshFilter val8 = val7.AddComponent<MeshFilter>(); val8.sharedMesh = val6; MeshRenderer val9 = val7.AddComponent<MeshRenderer>(); ((Renderer)val9).sharedMaterials = ((Renderer)val5).sharedMaterials; Material[] materials = ((Renderer)val9).materials; Material[] array = materials; foreach (Material val10 in array) { val10.EnableKeyword("_EMISSION"); val10.SetColor("_EmissionColor", new Color(0.25f, 0.05f, 0.7f) * 0.25f); } ((Renderer)val9).materials = materials; } GameObject val11 = new GameObject("GlowLight"); val11.transform.SetParent(val, false); val11.transform.localPosition = Vector3.zero; Light val12 = val11.AddComponent<Light>(); val12.type = (LightType)2; val12.color = new Color(0.69f, 0.265f, 0.816f, 1f); val12.intensity = 0.4f; val12.range = 0.6f; val12.shadows = (LightShadows)0; GameObject prefab2 = PrefabManager.Instance.GetPrefab("StaffSkeleton"); if (!((Object)(object)prefab2 != (Object)null)) { return; } Transform val13 = prefab2.transform.Find("attach"); Transform val14 = ((val13 != null) ? val13.Find("equiped") : null); if (!((Object)(object)val14 != (Object)null)) { return; } foreach (Transform item3 in val14) { Transform val15 = item3; if ((Object)(object)((Component)val15).GetComponent<ParticleSystem>() != (Object)null) { GameObject val16 = Object.Instantiate<GameObject>(((Component)val15).gameObject, val); ((Object)val16).name = ((Object)val15).name; val16.transform.localPosition = Vector3.zero; val16.transform.localRotation = Quaternion.identity; val16.transform.localScale = Vector3.one * 0.5f; val16.SetActive(true); ParticleSystem component = val16.GetComponent<ParticleSystem>(); if ((Object)(object)component != (Object)null) { component.Play(true); } } } } public static void SummonGjall(Player player, int staffQuality = 1) { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown if (Time.time - lastCastTime < Cooldown.Value) { ((Character)player).Message((MessageType)2, $"Cooldown: {Mathf.CeilToInt(Cooldown.Value - (Time.time - lastCastTime))}s", 0, (Sprite)null); return; } if (currentGjall >= MaxGjall.Value) { ((Character)player).Message((MessageType)2, "Maximum Gjall reached", 0, (Sprite)null); return; } if (player.GetEitr() < EitrCost.Value) { ((Character)player).Message((MessageType)2, "Not enough Eitr", 0, (Sprite)null); return; } GameObject prefab = PrefabManager.Instance.GetPrefab("Gjall"); if ((Object)(object)prefab == (Object)null) { return; } FieldInfo field = typeof(Character).GetField("m_zanim", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { ZSyncAnimation val = (ZSyncAnimation)field.GetValue(player); if ((Object)(object)val != (Object)null) { val.SetTrigger("staff_summon"); } } ((Character)player).UseEitr(EitrCost.Value); currentGjall++; lastCastTime = Time.time; ((MonoBehaviour)instance).StartCoroutine(SpawnGjallDelayed(player, prefab, staffQuality, 1f)); } [IteratorStateMachine(typeof(<SpawnGjallDelayed>d__13))] private static IEnumerator SpawnGjallDelayed(Player player, GameObject prefab, int staffQuality, float delay) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SpawnGjallDelayed>d__13(0) { player = player, prefab = prefab, staffQuality = staffQuality, delay = delay }; } } public class SummonedGjallTag : MonoBehaviour { } public class TickVisualMarker : MonoBehaviour { } public class GjallDespawn : MonoBehaviour { private float timer; public void Init(float time) { timer = time; } private void Update() { timer -= Time.deltaTime; if (timer <= 0f) { GjallStaffMod.currentGjall = Mathf.Max(0, GjallStaffMod.currentGjall - 1); ZNetView component = ((Component)this).GetComponent<ZNetView>(); if (Object.op_Implicit((Object)(object)component) && component.IsOwner()) { ZNetScene.instance.Destroy(((Component)this).gameObject); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } } } public class TamedGjallAI : MonoBehaviour { private Character character; private Player owner; private float scanTimer; public void Init(Player player, Character charRef) { owner = player; character = charRef; BaseAI component = ((Component)this).GetComponent<BaseAI>(); if ((Object)(object)component != (Object)null) { FieldInfo field = typeof(BaseAI).GetField("m_followTarget", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(component, ((Component)player).gameObject); } MethodInfo method = typeof(BaseAI).GetMethod("SetAlerted", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(component, new object[1] { true }); } } } private void Update() { //IL_002d: 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_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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)owner == (Object)null || (Object)(object)character == (Object)null) { return; } if (Vector3.Distance(((Component)this).transform.position, ((Component)owner).transform.position) > 85f) { ((Component)this).transform.position = ((Component)owner).transform.position + Vector3.up * 10f; } scanTimer += Time.deltaTime; if (scanTimer >= 2f) { scanTimer = 0f; Character val = FindClosestEnemy(50f); if ((Object)(object)val != (Object)null) { character.StartAttack(val, false); } } } private Character FindClosestEnemy(float range) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_003e: 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) Character result = null; float num = range; foreach (Character allCharacter in Character.GetAllCharacters()) { if ((Object)(object)allCharacter != (Object)null && (int)allCharacter.m_faction > 0) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)allCharacter).transform.position); if (num2 < num) { result = allCharacter; num = num2; } } } return result; } }