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 JGRPG v0.6.2
BepInEx/plugins/JGRPG.dll
Decompiled 2 weeks 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.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("JGRPG")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("JGRPG")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("0.6.2")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.6.2.0")] namespace JGRPG; internal static class AbilityBuffStatusEffects { private static bool _registered; private static StatusEffect _huntersMark; private static StatusEffect _explosiveShot; private static StatusEffect _rangersRally; private static StatusEffect _ullrsQuiver; private static StatusEffect _rage; private static StatusEffect _fury; private static StatusEffect _vorpal; private static StatusEffect _thorsHammer; private static StatusEffect _fortify; private static StatusEffect _guardiansRally; private static StatusEffect _retaliation; private static StatusEffect _vanish; private static StatusEffect _killingSpree; private static StatusEffect _haste; private static StatusEffect _chilledFlesh; private static StatusEffect _shamanBlessing; private static StatusEffect _shamanWard; private static StatusEffect _shamanEir; private static StatusEffect _ravagerUlv; private static StatusEffect _ravagerFenring; private static StatusEffect _ravagerSenses; public static void Register() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_010d: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0248: 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_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) if (!_registered) { _registered = true; _huntersMark = CreateStatusEffect("JGRPG_HuntersMarkDisplay", "Hunter's Mark", new Color(0.65f, 0.2f, 0.2f, 1f)); _explosiveShot = CreateStatusEffect("JGRPG_ExplosiveShotDisplay", "Explosive Shot", new Color(0.85f, 0.4f, 0.12f, 1f)); _rangersRally = CreateStatusEffect("JGRPG_RangersRallyDisplay", "Ranger's Rally", new Color(0.2f, 0.6f, 0.25f, 1f)); _ullrsQuiver = CreateStatusEffect("JGRPG_UllrsQuiverDisplay", "Ullr's Quiver", new Color(0.2f, 0.45f, 0.75f, 1f)); _rage = CreateStatusEffect("JGRPG_RageDisplay", "Rage", new Color(0.75f, 0.12f, 0.08f, 1f)); _fury = CreateStatusEffect("JGRPG_FuryDisplay", "Fury", new Color(0.85f, 0.3f, 0.08f, 1f)); _vorpal = CreateStatusEffect("JGRPG_VorpalDisplay", "Vorpal", new Color(0.55f, 0.1f, 0.65f, 1f)); _thorsHammer = CreateStatusEffect("JGRPG_ThorsHammerDisplay", "Thor's Hammer", new Color(0.25f, 0.55f, 0.9f, 1f)); _fortify = CreateStatusEffect("JGRPG_FortifyDisplay", "Fortify", new Color(0.3f, 0.45f, 0.65f, 1f)); _guardiansRally = CreateStatusEffect("JGRPG_GuardiansRallyDisplay", "Guardian's Rally", new Color(0.45f, 0.6f, 0.8f, 1f)); _retaliation = CreateStatusEffect("JGRPG_RetaliationDisplay", "Retaliation", new Color(0.7f, 0.25f, 0.2f, 1f)); _vanish = CreateStatusEffect("JGRPG_VanishDisplay", "Vanish", new Color(0.3f, 0.3f, 0.36f, 1f)); _killingSpree = CreateStatusEffect("JGRPG_KillingSpreeDisplay", "Loki's Gambit", new Color(0.55f, 0.08f, 0.12f, 1f)); _haste = CreateStatusEffect("JGRPG_HasteDisplay", "Haste", new Color(0.75f, 0.55f, 0.95f, 1f)); _chilledFlesh = CreateStatusEffect("JGRPG_ChilledFleshDisplay", "Chilled Flesh", new Color(0.45f, 0.75f, 0.95f, 1f)); _shamanBlessing = CreateStatusEffect("JGRPG_ShamanBlessingDisplay", "Ancestral Blessing", new Color(0.35f, 0.67f, 0.94f)); _shamanWard = CreateStatusEffect("JGRPG_ShamanWardDisplay", "Earthen Ward", new Color(0.62f, 0.51f, 0.32f)); _shamanEir = CreateStatusEffect("JGRPG_ShamanEirDisplay", "Eir's Blessing", new Color(0.45f, 0.8f, 0.6f)); RegisterEffect(_shamanBlessing); RegisterEffect(_shamanWard); RegisterEffect(_shamanEir); _ravagerUlv = CreateStatusEffect("JGRPG_RavagerUlv", "Ulv Aspect", new Color(0.64f, 0.72f, 0.78f)); _ravagerFenring = CreateStatusEffect("JGRPG_RavagerFenring", "Fenring Aspect", new Color(0.58f, 0.4f, 0.42f)); _ravagerSenses = CreateStatusEffect("JGRPG_RavagerSenses", "Alpha Senses", new Color(0.88f, 0.22f, 0.17f)); RegisterEffect(_ravagerUlv); RegisterEffect(_ravagerFenring); RegisterEffect(_ravagerSenses); RegisterEffect(_huntersMark); RegisterEffect(_explosiveShot); RegisterEffect(_rangersRally); RegisterEffect(_ullrsQuiver); RegisterEffect(_rage); RegisterEffect(_fury); RegisterEffect(_vorpal); RegisterEffect(_thorsHammer); RegisterEffect(_fortify); RegisterEffect(_guardiansRally); RegisterEffect(_retaliation); RegisterEffect(_vanish); RegisterEffect(_killingSpree); RegisterEffect(_haste); RegisterEffect(_chilledFlesh); } } public static void ShowHuntersMark(float duration) { ShowOnLocalPlayer(_huntersMark, duration); } public static void ShowExplosiveShot(float duration) { ShowOnLocalPlayer(_explosiveShot, duration); } public static void ShowUllrsQuiver(float duration) { ShowOnLocalPlayer(_ullrsQuiver, duration); } public static void ShowRage(float duration) { ShowOnLocalPlayer(_rage, duration); } public static void ShowFury(float duration) { ShowOnLocalPlayer(_fury, duration); } public static void ShowVorpal(float duration) { ShowOnLocalPlayer(_vorpal, duration); } public static void ShowThorsHammer(float duration) { ShowOnLocalPlayer(_thorsHammer, duration); } public static void ShowFortify(float duration) { ShowOnLocalPlayer(_fortify, duration); } public static void ShowRetaliation(float duration) { ShowOnLocalPlayer(_retaliation, duration); } public static void ShowGuardiansRally(float duration, float radius) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } List<Player> list = new List<Player>(); Player.GetPlayersInRange(((Component)localPlayer).transform.position, radius, list); foreach (Player item in list) { if (TankGuardianRally.Affects(item)) { ShowOnPlayer(item, _guardiansRally, duration); } } } public static void ShowVanish(float duration) { ShowOnLocalPlayer(_vanish, duration); } public static void HideVanish() { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)_vanish == (Object)null)) { ((Character)localPlayer).GetSEMan().RemoveStatusEffect(_vanish.NameHash(), false); } } public static void ShowKillingSpree(float duration) { ShowOnLocalPlayer(_killingSpree, duration); } public static void ShowHaste(float duration) { ShowOnLocalPlayer(_haste, duration); } public static void ShowChilledFlesh(float duration) { ShowOnLocalPlayer(_chilledFlesh, duration); } public static void ShowShamanBlessing(float duration) { ShowOnLocalPlayer(_shamanBlessing, duration); } public static void ShowShamanWard(float duration) { ShowOnLocalPlayer(_shamanWard, duration); } public static void HideShamanWard() { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)_shamanWard == (Object)null)) { SEMan sEMan = ((Character)localPlayer).GetSEMan(); if (sEMan != null) { sEMan.RemoveStatusEffect(_shamanWard.NameHash(), false); } } } public static void ShowShamanEir() { ShowOnLocalPlayer(_shamanEir, 5f); } public static void ShowRavagerUlv() { ShowOnLocalPlayer(_ravagerUlv, 86400f); } public static void ShowRavagerFenring(float duration) { ShowOnLocalPlayer(_ravagerFenring, duration); } public static void HideRavagerTransformations() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } SEMan sEMan = ((Character)localPlayer).GetSEMan(); if (sEMan != null) { if ((Object)(object)_ravagerUlv != (Object)null) { sEMan.RemoveStatusEffect(_ravagerUlv.NameHash(), false); } if ((Object)(object)_ravagerFenring != (Object)null) { sEMan.RemoveStatusEffect(_ravagerFenring.NameHash(), false); } } } public static void ShowForActivatedAbility(int slot) { if (CharacterProgression.Class == CharacterClass.Ravager) { if (slot == 3) { ShowOnLocalPlayer(_ravagerSenses, 10f); } if (slot == 4) { ShowRavagerFenring(RavagerPassiveBonuses.FenringDuration); } if (slot == 5) { ShowRavagerFenring(1.2f); } } else if (CharacterProgression.Class == CharacterClass.Tank) { switch (slot) { case 2: ShowFortify(TankAbilities.GetFortifyDuration()); break; case 4: ShowGuardiansRally(TankGuardianRally.GetDuration(), TankGuardianRally.GetRadius()); break; case 1: case 3: case 5: break; } } else if (CharacterProgression.Class == CharacterClass.Berserker) { switch (slot) { case 1: ShowRage(BerserkerAbilities.GetRageDuration()); break; case 3: ShowFury(BerserkerAbilities.GetFuryDuration()); break; case 4: ShowVorpal(BerserkerAbilities.GetVorpalDuration()); break; case 5: ShowThorsHammer(BerserkerAbilities.GetThorsHammerDuration()); break; case 2: break; } } else if (CharacterProgression.Class == CharacterClass.Rogue) { switch (slot) { case 1: ShowVanish(5f); break; case 5: ShowKillingSpree(2.5f); break; case 2: case 3: case 4: break; } } else if (CharacterProgression.Class == CharacterClass.Sorcerer) { switch (slot) { case 2: if (SorcererPassiveBonuses.GetChilledFleshArmorBonus() > 0f) { ShowChilledFlesh(10f); } break; case 4: ShowHaste(SorcererPassiveBonuses.GetHasteDuration()); break; case 1: case 3: case 5: break; } } else if (CharacterProgression.Class == CharacterClass.Ranger) { switch (slot) { case 1: ShowHuntersMark(10f); break; case 2: ShowExplosiveShot(10f); break; case 4: ShowRangersRally(10f + (float)CharacterProgression.GetTalentRank("Ranger_ExtendedRally"), 20f); break; case 5: ShowUllrsQuiver(10f); break; case 3: break; } } } public static void ShowRangersRally(float duration, float radius) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } List<Player> list = new List<Player>(); Player.GetPlayersInRange(((Component)localPlayer).transform.position, radius, list); foreach (Player item in list) { ShowOnPlayer(item, _rangersRally, duration); } } private static void ShowOnLocalPlayer(StatusEffect effect, float duration) { ShowOnPlayer(Player.m_localPlayer, effect, duration); } private static void ShowOnPlayer(Player player, StatusEffect effect, float duration) { if (!((Object)(object)player == (Object)null) && !((Object)(object)effect == (Object)null) && !(duration <= 0f)) { StatusEffect val = ((Character)player).GetSEMan().AddStatusEffect(effect, true, 0, 0f, (short)(-1)); if (!((Object)(object)val == (Object)null)) { val.m_ttl = duration; val.ResetTime(); } } } private static void RegisterEffect(StatusEffect effect) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(effect, false)); } private static StatusEffect CreateStatusEffect(string internalName, string displayName, Color iconColor) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) StatusEffect obj = ScriptableObject.CreateInstance<StatusEffect>(); ((Object)obj).name = internalName; obj.m_name = displayName; obj.m_icon = CreateIcon(iconColor); obj.m_ttl = 10f; return obj; } private static Sprite CreateIcon(Color fillColor) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_009f: 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_006c: 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) Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false); ((Object)val).name = "JGRPG_AbilityStatusIcon"; ((Texture)val).filterMode = (FilterMode)0; ((Texture)val).wrapMode = (TextureWrapMode)1; Color val2 = default(Color); ((Color)(ref val2))..ctor(0.05f, 0.05f, 0.05f, 1f); for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { bool flag = j < 3 || i < 3 || j >= 29 || i >= 29; val.SetPixel(j, i, flag ? val2 : fillColor); } } val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 100f); } } [HarmonyPatch(typeof(ClassAbilityCooldowns), "StartCooldown")] internal static class AbilityDisplayCooldownPatch { [HarmonyPostfix] private static void Postfix(object[] __args) { if (__args != null && __args.Length >= 1 && __args[0] != null) { int slot; try { slot = Convert.ToInt32(__args[0]); } catch { return; } AbilityBuffStatusEffects.ShowForActivatedAbility(slot); AbilityHUD.Refresh(); } } } [HarmonyPatch(typeof(ClassAbilityManager), "TryActivate")] internal static class ClassAbilityUnlockPatch { [HarmonyPrefix] private static bool Prefix(object[] __args) { if (__args == null || __args.Length < 1 || __args[0] == null) { return true; } if (CharacterProgression.Class == CharacterClass.None) { return true; } int slot; try { slot = Convert.ToInt32(__args[0]); } catch { return true; } return ClassAbilityUnlocks.IsUnlocked(slot); } } [HarmonyPatch(typeof(Player), "UseHotbarItem")] internal static class AbilityHotbarPatch { [HarmonyPrefix] private static bool Prefix(Player __instance, int __0) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return true; } if (CharacterProgression.Class == CharacterClass.None) { return true; } KeyboardShortcut value; switch (__0) { case 1: if (JGRPG.Ability1KeyConfig != null) { value = JGRPG.Ability1KeyConfig.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { return false; } } break; case 2: if (JGRPG.Ability2KeyConfig != null) { value = JGRPG.Ability2KeyConfig.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { return false; } } break; case 3: if (JGRPG.Ability3KeyConfig != null) { value = JGRPG.Ability3KeyConfig.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { return false; } } break; case 4: if (JGRPG.Ability4KeyConfig != null) { value = JGRPG.Ability4KeyConfig.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { return false; } } break; case 5: if (JGRPG.Ability5KeyConfig != null) { value = JGRPG.Ability5KeyConfig.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { return false; } } break; } return true; } } internal static class AbilityHUD { private sealed class SlotView { public GameObject Root; public Image Background; public Text NameText; public Text CooldownText; } private static readonly SlotView[] Slots = new SlotView[6]; private static GameObject _root; private static GameObject _editControls; private static Text _scaleLabel; private static bool _registered; private const float DefaultX = 0f; private const float DefaultY = 135f; private const float DefaultScale = 1f; private const float HudWidth = 900f; private const float HudHeight = 70f; private const float MinScale = 0.45f; private const float MaxScale = 2f; private static ConfigEntry<float> _positionX; private static ConfigEntry<float> _positionY; private static ConfigEntry<float> _scaleConfig; private static readonly Color ReadyColor = new Color(0.08f, 0.08f, 0.08f, 0.82f); private static readonly Color CooldownColor = new Color(0.28f, 0.28f, 0.28f, 0.88f); internal static bool CanEdit { get { if ((Object)(object)_root != (Object)null) { return TalentUI.IsOpen; } return false; } } internal static void BindConfig(ConfigFile config) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown _positionX = config.Bind<float>("Ability HUD", "Position X", 0f, "Horizontal HUD offset from screen center, in UI units. Drag the HUD while the Talent Tree is open to change it."); _positionY = config.Bind<float>("Ability HUD", "Position Y", 135f, "Vertical HUD offset from screen bottom, in UI units. Drag the HUD while the Talent Tree is open to change it."); _scaleConfig = config.Bind<float>("Ability HUD", "Scale", 1f, new ConfigDescription("Scale for the entire five-ability HUD. Resize it while the Talent Tree is open.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.45f, 2f), Array.Empty<object>())); } public static void Register() { if (!_registered) { _registered = true; GUIManager.OnCustomGUIAvailable += Build; } } private static void Build() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_008f: 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_00b9: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) if (GUIManager.IsHeadless()) { return; } if (Object.op_Implicit((Object)(object)_root)) { Object.Destroy((Object)(object)_root); } if (!((Object)(object)GUIManager.CustomGUIFront == (Object)null) && GUIManager.Instance != null) { _root = new GameObject("JGRPG_AbilityHUD", new Type[1] { typeof(RectTransform) }); _root.layer = 5; _root.transform.SetParent(GUIManager.CustomGUIFront.transform, false); RectTransform component = _root.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0f); component.anchorMax = new Vector2(0.5f, 0f); component.pivot = new Vector2(0.5f, 0f); component.anchoredPosition = new Vector2((_positionX != null) ? _positionX.Value : 0f, (_positionY != null) ? _positionY.Value : 135f); component.sizeDelta = new Vector2(900f, 70f); ((Transform)component).localScale = Vector3.one * Mathf.Clamp((_scaleConfig != null) ? _scaleConfig.Value : 1f, 0.45f, 2f); _root.AddComponent<AbilityHUDMoveHandle>(); _root.AddComponent<AbilityHUDUpdater>(); for (int i = 1; i <= 5; i++) { CreateSlot(i); } CreateEditControls(); Refresh(); } } private static void CreateSlot(int slot) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0071: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_013b: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: 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) GameObject val = new GameObject($"JGRPG_Ability_{slot}", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val.layer = 5; val.transform.SetParent(_root.transform, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.sizeDelta = new Vector2(166f, 58f); component.anchoredPosition = new Vector2((float)(slot - 3) * 174f, 0f); Image component2 = val.GetComponent<Image>(); ((Graphic)component2).color = ReadyColor; ((Graphic)component2).raycastTarget = false; Text component3 = GUIManager.Instance.CreateText("", val.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 10f), GUIManager.Instance.AveriaSerifBold, 15, Color.white, true, Color.black, 158f, 28f, false).GetComponent<Text>(); component3.alignment = (TextAnchor)4; ((Graphic)component3).raycastTarget = false; Text component4 = GUIManager.Instance.CreateText("", val.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, -14f), GUIManager.Instance.AveriaSerifBold, 19, Color.white, true, Color.black, 158f, 28f, false).GetComponent<Text>(); component4.alignment = (TextAnchor)4; ((Graphic)component4).raycastTarget = false; Slots[slot] = new SlotView { Root = val, Background = component2, NameText = component3, CooldownText = component4 }; } private static GameObject CreateEditorImage(string name, Transform parent, Color backgroundColor, Vector2 anchor, Vector2 pivot, Vector2 position, Vector2 size) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }) { layer = 5 }; val.transform.SetParent(parent, false); RectTransform val2 = (RectTransform)val.transform; val2.anchorMin = anchor; val2.anchorMax = anchor; val2.pivot = pivot; val2.anchoredPosition = position; val2.sizeDelta = size; Image component = val.GetComponent<Image>(); ((Graphic)component).color = backgroundColor; ((Graphic)component).raycastTarget = true; return val; } private static Text CreateEditorText(Transform parent, string text, Vector2 anchor, Vector2 position, Vector2 size, int fontSize) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_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_0028: Unknown result type (might be due to invalid IL or missing references) Text component = GUIManager.Instance.CreateText(text, parent, anchor, anchor, position, GUIManager.Instance.AveriaSerifBold, fontSize, Color.white, true, Color.black, size.x, size.y, false).GetComponent<Text>(); component.alignment = (TextAnchor)4; ((Graphic)component).raycastTarget = false; return component; } private static void CreateEditorButton(Transform parent, string text, float x, float width, Action onClick) { //IL_002e: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_00bb: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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) GameObject obj = CreateEditorImage("JGRPG_AbilityHUDEdit_" + text, parent, new Color(0.23f, 0.23f, 0.23f, 0.97f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(x, 0f), new Vector2(width, 27f)); Button obj2 = obj.AddComponent<Button>(); ColorBlock colors = ((Selectable)obj2).colors; ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).highlightedColor = new Color(1f, 0.84f, 0.57f, 1f); ((ColorBlock)(ref colors)).pressedColor = new Color(0.74f, 0.68f, 0.6f, 1f); ((Selectable)obj2).colors = colors; ((UnityEvent)obj2.onClick).AddListener((UnityAction)delegate { onClick(); }); CreateEditorText(obj.transform, text, new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(width - 4f, 25f), 14); } private static void CreateEditControls() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) _editControls = new GameObject("JGRPG_AbilityHUDEditControls", new Type[1] { typeof(RectTransform) }); _editControls.layer = 5; _editControls.transform.SetParent(_root.transform, false); RectTransform val = (RectTransform)_editControls.transform; val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.offsetMin = Vector2.zero; val.offsetMax = Vector2.zero; GameObject obj = CreateEditorImage("JGRPG_AbilityHUDDragBar", _editControls.transform, new Color(0.08f, 0.08f, 0.08f, 0.96f), new Vector2(0.5f, 1f), new Vector2(0.5f, 0f), new Vector2(0f, 8f), new Vector2(535f, 38f)); CreateEditorText(obj.transform, "DRAG TO MOVE", new Vector2(0.5f, 0.5f), new Vector2(-165f, 0f), new Vector2(170f, 29f), 15); _scaleLabel = CreateEditorText(obj.transform, "100%", new Vector2(0.5f, 0.5f), new Vector2(-45f, 0f), new Vector2(65f, 28f), 14); CreateEditorButton(obj.transform, "-", 20f, 40f, delegate { ChangeScale(-0.1f); }); CreateEditorButton(obj.transform, "+", 69f, 40f, delegate { ChangeScale(0.1f); }); CreateEditorButton(obj.transform, "RESET", 176f, 86f, ResetLayout); GameObject obj2 = CreateEditorImage("JGRPG_AbilityHUDResizeHandle", _editControls.transform, new Color(0.32f, 0.26f, 0.17f, 0.98f), new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(-2f, -5f), new Vector2(77f, 28f)); obj2.AddComponent<AbilityHUDResizeHandle>(); CreateEditorText(obj2.transform, "RESIZE", new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(71f, 25f), 13); _editControls.SetActive(false); UpdateScaleText(); } private static void UpdateScaleText() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_scaleLabel) && Object.op_Implicit((Object)(object)_root)) { _scaleLabel.text = Mathf.RoundToInt(_root.transform.localScale.x * 100f) + "%"; } } private static Vector2 ClampPosition(Vector2 proposed) { //IL_000c: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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) if (!Object.op_Implicit((Object)(object)_root)) { return proposed; } Transform parent = _root.transform.parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); if (!Object.op_Implicit((Object)(object)val)) { return proposed; } float x = _root.transform.localScale.x; Rect rect = val.rect; float num = Mathf.Max(0f, (((Rect)(ref rect)).width - 900f * x) * 0.5f - 8f); float num2 = 8f + 33f * x; rect = val.rect; float num3 = Mathf.Max(num2, ((Rect)(ref rect)).height - 124f * x - 8f); return new Vector2(Mathf.Clamp(proposed.x, 0f - num, num), Mathf.Clamp(proposed.y, num2, num3)); } internal static void MoveTo(Vector2 position) { //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_0018: Unknown result type (might be due to invalid IL or missing references) if (CanEdit) { ((RectTransform)_root.transform).anchoredPosition = ClampPosition(position); } } internal static void SetScale(float value) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_008c: 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) if (CanEdit) { Transform parent = _root.transform.parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); float num; if (!Object.op_Implicit((Object)(object)val)) { num = 2f; } else { Rect rect = val.rect; num = (((Rect)(ref rect)).width - 16f) / 900f; } float num2 = num; float num3 = Mathf.Max(0.45f, Mathf.Min(2f, num2)); _root.transform.localScale = Vector3.one * Mathf.Clamp(value, 0.45f, num3); ((RectTransform)_root.transform).anchoredPosition = ClampPosition(((RectTransform)_root.transform).anchoredPosition); UpdateScaleText(); } } internal static void SaveLayout() { //IL_0017: 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_002e: 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_0066: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_root)) { Vector2 anchoredPosition = ((RectTransform)_root.transform).anchoredPosition; if (_positionX != null) { _positionX.Value = anchoredPosition.x; } if (_positionY != null) { _positionY.Value = anchoredPosition.y; } if (_scaleConfig != null) { _scaleConfig.Value = _root.transform.localScale.x; } } } private static void ChangeScale(float delta) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (CanEdit) { SetScale(_root.transform.localScale.x + delta); SaveLayout(); } } private static void ResetLayout() { //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_0022: 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_0036: Unknown result type (might be due to invalid IL or missing references) if (CanEdit) { RectTransform val = (RectTransform)_root.transform; val.anchoredPosition = new Vector2(0f, 135f); ((Transform)val).localScale = Vector3.one * 1f; UpdateScaleText(); SaveLayout(); } } public static void Refresh() { //IL_0160: 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_0190: 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) bool canEdit = CanEdit; if (Object.op_Implicit((Object)(object)_editControls) && _editControls.activeSelf != canEdit) { _editControls.SetActive(canEdit); } for (int i = 1; i <= 5; i++) { if (Slots[i] != null && Object.op_Implicit((Object)(object)Slots[i].Background) && ((Graphic)Slots[i].Background).raycastTarget != canEdit) { ((Graphic)Slots[i].Background).raycastTarget = canEdit; } } if (!Object.op_Implicit((Object)(object)_root)) { return; } if ((Object)(object)Player.m_localPlayer == (Object)null || CharacterProgression.Class == CharacterClass.None) { for (int j = 1; j <= 5; j++) { SlotView slotView = Slots[j]; if (slotView != null && Object.op_Implicit((Object)(object)slotView.Root)) { slotView.Root.SetActive(false); } } return; } for (int k = 1; k <= 5; k++) { SlotView slotView2 = Slots[k]; if (slotView2 != null && Object.op_Implicit((Object)(object)slotView2.Root)) { string abilityName = GetAbilityName(CharacterProgression.Class, k); bool flag = !string.IsNullOrEmpty(abilityName) && ClassAbilityUnlocks.IsUnlocked(k); slotView2.Root.SetActive(flag); if (flag) { slotView2.NameText.text = abilityName; float remaining = ClassAbilityCooldowns.GetRemaining(k); bool flag2 = remaining > 0f; ((Graphic)slotView2.Background).color = (flag2 ? CooldownColor : ReadyColor); ((Graphic)slotView2.NameText).color = (Color)(flag2 ? new Color(0.72f, 0.72f, 0.72f, 1f) : Color.white); slotView2.CooldownText.text = (flag2 ? $"{remaining:0.0}s" : ""); } } } } private static string GetAbilityName(CharacterClass characterClass, int slot) { if (characterClass == CharacterClass.Ranger) { switch (slot) { case 1: return "Hunter's Mark"; case 2: return "Explosive Shot"; case 3: return "Rapid Shot"; case 4: return "Ranger's Rally"; case 5: return "Ullr's Quiver"; } } if (characterClass == CharacterClass.Tank) { switch (slot) { case 1: return "Provoke"; case 2: return "Fortify"; case 3: return "Thunderclap"; case 4: return "Guardian's Rally"; case 5: return "Odin's Glare"; } } if (characterClass == CharacterClass.Berserker) { switch (slot) { case 1: return "Rage"; case 2: return "Whirlwind"; case 3: return "Fury"; case 4: return "Vorpal"; case 5: return "Thor's Hammer"; } } if (characterClass == CharacterClass.Rogue) { switch (slot) { case 1: return "Vanish"; case 2: return "Backstab"; case 3: return "Fan of Knives"; case 4: return "Shadow Walk"; case 5: return "Loki's Gambit"; } } if (characterClass == CharacterClass.Shaman) { switch (slot) { case 1: return "Chain Lightning"; case 2: return "Chain Heal"; case 3: return "Ancestral Blessing"; case 4: return "Earthen Ward"; case 5: return "Ancestral Totem"; } } if (characterClass == CharacterClass.Sorcerer) { switch (slot) { case 1: return "Fireball"; case 2: return "Ice Nova"; case 3: return "Gravity Well"; case 4: return "Haste"; case 5: return "Meteor"; } } if (characterClass == CharacterClass.Necromancer) { switch (slot) { case 1: return "Necromantic Blast"; case 2: return "Bone Sentinel"; case 3: return "Bound Spirit"; case 4: return "Plague of the Plains"; case 5: return "Army of the Dead"; } } if (characterClass == CharacterClass.Ravager) { switch (slot) { case 1: return "Feral Pounce"; case 2: return "Ulv Aspect"; case 3: return "Alpha Senses"; case 4: return "Fenring Aspect"; case 5: return "Call of the Pack"; } } return null; } } internal sealed class AbilityHUDMoveHandle : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler { private bool _dragging; private Vector2 _pointerStart; private Vector2 _hudStart; public void OnBeginDrag(PointerEventData eventData) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) _dragging = false; if (AbilityHUD.CanEdit) { Transform parent = ((Component)this).transform.parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); if (val != null && RectTransformUtility.ScreenPointToLocalPointInRectangle(val, eventData.position, eventData.pressEventCamera, ref _pointerStart)) { _hudStart = ((RectTransform)((Component)this).transform).anchoredPosition; _dragging = true; } } } public void OnDrag(PointerEventData eventData) { //IL_0026: 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_0040: 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_0047: 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) if (_dragging && AbilityHUD.CanEdit) { Transform parent = ((Component)this).transform.parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); Vector2 val2 = default(Vector2); if (val != null && RectTransformUtility.ScreenPointToLocalPointInRectangle(val, eventData.position, eventData.pressEventCamera, ref val2)) { AbilityHUD.MoveTo(_hudStart + val2 - _pointerStart); } } } public void OnEndDrag(PointerEventData eventData) { if (_dragging) { AbilityHUD.SaveLayout(); } _dragging = false; } } internal sealed class AbilityHUDResizeHandle : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler { private bool _dragging; private float _scaleStart; private Vector2 _pointerStart; public void OnBeginDrag(PointerEventData eventData) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) _dragging = false; if (AbilityHUD.CanEdit) { Transform parent = ((Component)this).transform.parent.parent.parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); if (val != null && RectTransformUtility.ScreenPointToLocalPointInRectangle(val, eventData.position, eventData.pressEventCamera, ref _pointerStart)) { _scaleStart = ((Component)this).transform.parent.parent.localScale.x; _dragging = true; } } } public void OnDrag(PointerEventData eventData) { //IL_0030: 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) if (_dragging && AbilityHUD.CanEdit) { Transform parent = ((Component)this).transform.parent.parent.parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); Vector2 val2 = default(Vector2); if (val != null && RectTransformUtility.ScreenPointToLocalPointInRectangle(val, eventData.position, eventData.pressEventCamera, ref val2)) { AbilityHUD.SetScale(_scaleStart + (val2.x - _pointerStart.x) / 280f); } } } public void OnEndDrag(PointerEventData eventData) { if (_dragging) { AbilityHUD.SaveLayout(); } _dragging = false; } } internal sealed class AbilityHUDUpdater : MonoBehaviour { private float _nextUpdate; private void Update() { if (!(Time.unscaledTime < _nextUpdate)) { _nextUpdate = Time.unscaledTime + 0.05f; AbilityHUD.Refresh(); } } } [HarmonyPatch(typeof(Player), "OnDestroy")] internal static class AbilityCooldownLogoutResetPatch { [HarmonyPrefix] private static void Prefix(Player __instance) { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { ClassAbilityCooldowns.ClearAll(); RogueAbilities.ClearRuntimeState(); SorcererAbilities.ClearRuntimeState(); SorcererHasteSystem.Clear(); ShamanAbilities.ClearRuntimeState(); ShamanSupportState.Clear(); RavagerAbilities.ClearRuntimeState(); NecromancerAbilities.ClearRuntimeState(); Logger.LogInfo((object)"JGRPG ability cooldowns cleared because the local player was destroyed."); } } } internal static class AbilityTargeting { internal static Ray CenterRay(Camera camera) { //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) return camera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); } internal static Character GetAimedCharacter(Player caster, float maxPlayerDistance, Func<Character, bool> isValid) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0084: 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_00e6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)caster == (Object)null || isValid == null || maxPlayerDistance <= 0f) { return null; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return null; } float num = maxPlayerDistance + Vector3.Distance(((Component)main).transform.position, ((Component)caster).transform.position); RaycastHit[] array = Physics.RaycastAll(CenterRay(main), num, -1, (QueryTriggerInteraction)1); Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); RaycastHit[] array2 = array; for (int num2 = 0; num2 < array2.Length; num2++) { RaycastHit val = array2[num2]; Collider collider = ((RaycastHit)(ref val)).collider; if ((Object)(object)collider == (Object)null || ((Component)collider).transform.IsChildOf(((Component)caster).transform)) { continue; } Character componentInParent = ((Component)collider).GetComponentInParent<Character>(); if (!((Object)(object)componentInParent == (Object)(object)caster)) { if (!((Object)(object)componentInParent != (Object)null)) { return null; } if (isValid(componentInParent) && Vector3.Distance(((Component)caster).transform.position, ((Component)componentInParent).transform.position) <= maxPlayerDistance) { return componentInParent; } } } return null; } } internal static class BerserkerAbilities { private static float _rageEndTime; private static Player _ragePlayer; private static float _furyEndTime; private static Player _furyPlayer; private static float _vorpalEndTime; private static Player _vorpalPlayer; private static float _thorsHammerEndTime; private static Player _thorsHammerPlayer; public static void TryActivate(int abilitySlot) { switch (abilitySlot) { case 1: TryActivateRage(); break; case 2: TryActivateWhirlwind(); break; case 3: TryActivateFury(); break; case 4: TryActivateVorpal(); break; case 5: TryActivateThorsHammer(); break; default: Logger.LogInfo((object)("JGRPG Berserker ability " + $"{abilitySlot} not implemented yet.")); break; } } private static void TryActivateRage() { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && CharacterProgression.Class == CharacterClass.Berserker && ClassAbilityCooldowns.IsReady(1)) { float rageDuration = GetRageDuration(); float rageCooldown = GetRageCooldown(); _ragePlayer = localPlayer; _rageEndTime = Time.time + rageDuration; BerserkerRageVisual.Apply(localPlayer); ClassAbilityCooldowns.StartCooldown(1, rageCooldown); Logger.LogInfo((object)("JGRPG Rage activated. " + $"Duration: {rageDuration:0.0}s. " + "Melee Damage: +50%. Movement Speed: +20%. Two-Handed Attack Speed: +20%. Incoming Damage: " + $"+{GetRageIncomingDamageBonus() * 100f:0}%. " + $"Cooldown: {rageCooldown:0.0}s.")); } } private static void TryActivateWhirlwind() { //IL_0031: 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_0086: 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_00e7: Expected O, but got Unknown //IL_00ea: 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_0127: 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_0183: 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_0191: 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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_01e2: 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_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || CharacterProgression.Class != CharacterClass.Berserker || !ClassAbilityCooldowns.IsReady(2)) { return; } ItemData currentWeapon = ((Humanoid)localPlayer).GetCurrentWeapon(); if (currentWeapon == null || !BerserkerPassiveBonuses.IsBerserkerMeleeWeaponSkill(currentWeapon.m_shared.m_skillType) || !((Character)localPlayer).HaveStamina(30f)) { return; } float whirlwindRadius = GetWhirlwindRadius(); float whirlwindCooldown = GetWhirlwindCooldown(); BerserkerWhirlwindVisual.Play(localPlayer); float randomSkillFactor = ((Character)localPlayer).GetRandomSkillFactor(currentWeapon.m_shared.m_skillType); float totalMeleeDamageMultiplier = BerserkerPassiveBonuses.GetTotalMeleeDamageMultiplier(localPlayer); List<Character> list = new List<Character>(); Character.GetCharactersInRange(((Component)localPlayer).transform.position, whirlwindRadius, list); int num = 0; foreach (Character item in list) { if (!((Object)(object)item == (Object)null) && !((Object)(object)item == (Object)(object)localPlayer) && !item.IsDead() && BaseAI.IsEnemy((Character)(object)localPlayer, item)) { HitData val = new HitData(); val.m_damage = currentWeapon.GetDamage(); ((DamageTypes)(ref val.m_damage)).Modify(0.75f * randomSkillFactor * totalMeleeDamageMultiplier); val.m_toolTier = (short)currentWeapon.m_shared.m_toolTier; val.m_skillLevel = ((Character)localPlayer).GetSkillLevel(currentWeapon.m_shared.m_skillType); val.m_itemLevel = (short)currentWeapon.m_quality; val.m_itemWorldLevel = (byte)currentWeapon.m_worldLevel; val.m_blockable = currentWeapon.m_shared.m_blockable; val.m_dodgeable = currentWeapon.m_shared.m_dodgeable; val.m_skill = currentWeapon.m_shared.m_skillType; val.m_point = item.GetCenterPoint(); Vector3 dir = ((Component)item).transform.position - ((Component)localPlayer).transform.position; dir.y = 0f; if (((Vector3)(ref dir)).sqrMagnitude > 0.001f) { ((Vector3)(ref dir)).Normalize(); } else { dir = ((Component)localPlayer).transform.forward; } val.m_dir = dir; val.SetAttacker((Character)(object)localPlayer); val.m_hitType = (HitType)2; item.Damage(val); num++; } } ((Character)localPlayer).UseStamina(30f); ClassAbilityCooldowns.StartCooldown(2, whirlwindCooldown); Logger.LogInfo((object)("JGRPG Whirlwind activated. " + $"Radius: {whirlwindRadius:0.0}m. " + "Damage: 75% weapon damage. " + $"Targets hit: {num}. " + $"Stamina: {30f:0}. " + $"Cooldown: {whirlwindCooldown:0.0}s.")); } private static void TryActivateFury() { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && CharacterProgression.Class == CharacterClass.Berserker && ClassAbilityCooldowns.IsReady(3) && ((Character)localPlayer).HaveStamina(40f)) { float furyHealthFraction = GetFuryHealthFraction(); float num = ((Character)localPlayer).GetMaxHealth() * furyHealthFraction; if (((Character)localPlayer).GetHealth() > num) { ((Character)localPlayer).SetHealth(num); } _furyPlayer = localPlayer; _furyEndTime = Time.time + GetFuryDuration(); BerserkerFuryVisual.Play(localPlayer); localPlayer.m_foodRegenTimer = 0f; ((Character)localPlayer).UseStamina(40f); float furyCooldown = GetFuryCooldown(); ClassAbilityCooldowns.StartCooldown(3, furyCooldown); Logger.LogInfo((object)("JGRPG Fury activated. Health floor: " + $"{furyHealthFraction * 100f:0}% max HP. " + $"Duration: {GetFuryDuration():0.0}s. " + "Health Regen: 0. " + $"Stamina: {40f:0}. " + $"Cooldown: {furyCooldown:0.0}s.")); } } private static void TryActivateVorpal() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && CharacterProgression.Class == CharacterClass.Berserker && ClassAbilityCooldowns.IsReady(4)) { ItemData currentWeapon = ((Humanoid)localPlayer).GetCurrentWeapon(); if (currentWeapon != null && BerserkerPassiveBonuses.IsBerserkerMeleeWeaponSkill(currentWeapon.m_shared.m_skillType) && ((Character)localPlayer).HaveStamina(30f)) { float vorpalDuration = GetVorpalDuration(); float vorpalCooldown = GetVorpalCooldown(); _vorpalPlayer = localPlayer; _vorpalEndTime = Time.time + vorpalDuration; BerserkerVorpalVisual.Play(localPlayer); ((Character)localPlayer).UseStamina(30f); ClassAbilityCooldowns.StartCooldown(4, vorpalCooldown); Logger.LogInfo((object)("JGRPG Vorpal activated. " + $"Duration: {vorpalDuration:0.0}s. " + "Execute threshold: 30% HP. Damage: +50%. " + $"Stamina: {30f:0}. " + $"Cooldown: {vorpalCooldown:0.0}s.")); } } } private static void TryActivateThorsHammer() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && CharacterProgression.Class == CharacterClass.Berserker && ClassAbilityCooldowns.IsReady(5)) { ItemData currentWeapon = ((Humanoid)localPlayer).GetCurrentWeapon(); if (currentWeapon != null && BerserkerPassiveBonuses.IsBerserkerMeleeWeaponSkill(currentWeapon.m_shared.m_skillType) && ((Character)localPlayer).HaveStamina(50f)) { float thorsHammerDuration = GetThorsHammerDuration(); float thorsHammerCooldown = GetThorsHammerCooldown(); _thorsHammerPlayer = localPlayer; _thorsHammerEndTime = Time.time + thorsHammerDuration; BerserkerThorsMightVisual.Play(localPlayer); ((Character)localPlayer).UseStamina(50f); ClassAbilityCooldowns.StartCooldown(5, thorsHammerCooldown); Logger.LogInfo((object)("JGRPG Thor's Hammer activated. " + $"Duration: {thorsHammerDuration:0.0}s. " + "Melee Damage: +20%. Physical Damage: converted to Lightning. " + $"Stamina: {50f:0}. " + $"Cooldown: {thorsHammerCooldown:0.0}s.")); } } } public static bool IsRageActive() { return IsRageActive(Player.m_localPlayer); } public static bool IsRageActive(Player player) { if ((Object)(object)player == (Object)null || (Object)(object)_ragePlayer == (Object)null || (Object)(object)player != (Object)(object)_ragePlayer || CharacterProgression.Class != CharacterClass.Berserker) { return false; } if (((Character)player).IsDead()) { ClearActiveEffects(); return false; } if (Time.time >= _rageEndTime) { ClearActiveEffects(); return false; } return true; } public static float GetRageDuration() { if (CharacterProgression.GetTalentRank("Berserker_EndlessRage") <= 0) { return 10f; } return 60f; } public static float GetRageCooldown() { int talentRank = CharacterProgression.GetTalentRank("Berserker_QuickenedRage"); return Mathf.Max(0f, 20f - (float)talentRank); } public static float GetRageIncomingDamageBonus() { int talentRank = CharacterProgression.GetTalentRank("Berserker_PainResistant"); return Mathf.Max(0f, 0.1f - (float)talentRank * 0.01f); } public static float GetWhirlwindRadius() { int talentRank = CharacterProgression.GetTalentRank("Berserker_OdinsRage"); return 5f + (float)talentRank * 2.5f; } public static float GetWhirlwindCooldown() { int talentRank = CharacterProgression.GetTalentRank("Berserker_OdinsPresence"); return Mathf.Max(0f, 30f - (float)talentRank); } public static bool IsFuryActive() { return IsFuryActive(Player.m_localPlayer); } public static bool IsFuryActive(Player player) { if ((Object)(object)player == (Object)null || (Object)(object)_furyPlayer == (Object)null || (Object)(object)player != (Object)(object)_furyPlayer || CharacterProgression.Class != CharacterClass.Berserker) { return false; } if (((Character)player).IsDead()) { ClearFury(); return false; } if (Time.time >= _furyEndTime) { ClearFury(); return false; } return true; } public static float GetFuryDuration() { return 10f; } public static float GetFuryHealthFraction() { int talentRank = CharacterProgression.GetTalentRank("Berserker_ReasonedFury"); return 0.3f + (float)talentRank * 0.05f; } public static float GetFuryCooldown() { int talentRank = CharacterProgression.GetTalentRank("Berserker_QuickFury"); return Mathf.Max(0f, 30f - (float)talentRank * 2f); } private static void ClearFury() { _furyEndTime = 0f; _furyPlayer = null; BerserkerFuryVisual.Clear(); } public static bool IsVorpalActive() { return IsVorpalActive(Player.m_localPlayer); } public static bool IsVorpalActive(Player player) { if ((Object)(object)player == (Object)null || (Object)(object)_vorpalPlayer == (Object)null || (Object)(object)player != (Object)(object)_vorpalPlayer || CharacterProgression.Class != CharacterClass.Berserker) { return false; } if (((Character)player).IsDead()) { ClearVorpal(); return false; } if (Time.time >= _vorpalEndTime) { ClearVorpal(); return false; } return true; } public static float GetVorpalDuration() { return 10f; } public static float GetVorpalCooldown() { int talentRank = CharacterProgression.GetTalentRank("Berserker_Slayer"); return Mathf.Max(0f, 30f - (float)talentRank); } private static void ClearVorpal() { _vorpalEndTime = 0f; _vorpalPlayer = null; BerserkerVorpalVisual.Clear(); } public static bool IsThorsHammerActive() { return IsThorsHammerActive(Player.m_localPlayer); } public static bool IsThorsHammerActive(Player player) { if ((Object)(object)player == (Object)null || (Object)(object)_thorsHammerPlayer == (Object)null || (Object)(object)player != (Object)(object)_thorsHammerPlayer || CharacterProgression.Class != CharacterClass.Berserker) { return false; } if (((Character)player).IsDead()) { ClearThorsHammer(); return false; } if (Time.time >= _thorsHammerEndTime) { ClearThorsHammer(); return false; } return true; } public static float GetThorsHammerDuration() { return 10f; } public static float GetThorsHammerCooldown() { int talentRank = CharacterProgression.GetTalentRank("Berserker_ThorsMight"); return Mathf.Max(0f, 60f - (float)talentRank * 5f); } private static void ClearThorsHammer() { _thorsHammerEndTime = 0f; _thorsHammerPlayer = null; BerserkerThorsMightVisual.Clear(); } public static void ClearActiveEffects() { _rageEndTime = 0f; _ragePlayer = null; BerserkerRageVisual.Clear(); BerserkerWhirlwindVisual.Clear(); ClearFury(); ClearVorpal(); ClearThorsHammer(); } } [HarmonyPatch(typeof(Player), "OnDeath")] internal static class BerserkerRageDeathPatch { [HarmonyPrefix] private static void Prefix(Player __instance) { if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { BerserkerAbilities.ClearActiveEffects(); ClassAbilityCooldowns.ClearAll(); AbilityHUD.Refresh(); } } } [HarmonyPatch(typeof(Player), "PlayerAttackInput")] internal static class BerserkerAttackSpeedPatch { private static Animator _animator; private static float _baseAnimatorSpeed = 1f; private static float _lastAppliedSpeed = 1f; private static bool _applied; [HarmonyPostfix] private static void Postfix(Player __instance) { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { Animator animator = ((Character)__instance).m_animator; if ((Object)(object)animator == (Object)null) { ClearState(); return; } if (!ShouldBoostAttack(__instance)) { RestoreAnimator(animator); return; } float attackSpeedMultiplier = GetAttackSpeedMultiplier(__instance); ApplyMultiplier(animator, attackSpeedMultiplier); } } private static bool ShouldBoostAttack(Player player) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (CharacterProgression.Class != CharacterClass.Berserker) { return false; } ItemData currentWeapon = ((Humanoid)player).GetCurrentWeapon(); if (currentWeapon == null) { return false; } if (!BerserkerPassiveBonuses.IsBerserkerMeleeWeaponSkill(currentWeapon.m_shared.m_skillType)) { return false; } bool num = GetTotalAttackSpeedRanks() > 0; bool flag = BerserkerAbilities.IsRageActive(player) && IsTwoHandedWeapon(currentWeapon); if (!num && !flag) { return false; } return ((Character)player).InAttack(); } private static int GetTotalAttackSpeedRanks() { return CharacterProgression.GetTalentRank("Berserker_AttackSpeed1") + CharacterProgression.GetTalentRank("Berserker_AttackSpeed2") + CharacterProgression.GetTalentRank("Berserker_AttackSpeed3"); } private static float GetAttackSpeedMultiplier(Player player) { float num = (float)GetTotalAttackSpeedRanks() * 0.025f; ItemData currentWeapon = ((Humanoid)player).GetCurrentWeapon(); if (currentWeapon != null && BerserkerAbilities.IsRageActive(player) && IsTwoHandedWeapon(currentWeapon)) { num += 0.2f; } return 1f + num; } private static bool IsTwoHandedWeapon(ItemData weapon) { //IL_000b: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 if (weapon == null) { return false; } ItemType itemType = weapon.m_shared.m_itemType; if ((int)itemType != 14) { return (int)itemType == 22; } return true; } private static void ApplyMultiplier(Animator animator, float multiplier) { float speed = animator.speed; if (!_applied || (Object)(object)_animator != (Object)(object)animator) { _animator = animator; _baseAnimatorSpeed = speed; } else if (Mathf.Abs(speed - _lastAppliedSpeed) > 0.0001f) { _baseAnimatorSpeed = speed; } float lastAppliedSpeed = (animator.speed = _baseAnimatorSpeed * multiplier); _lastAppliedSpeed = lastAppliedSpeed; _applied = true; } private static void RestoreAnimator(Animator animator) { if (_applied) { if ((Object)(object)_animator == (Object)(object)animator && Mathf.Abs(animator.speed - _lastAppliedSpeed) <= 0.0001f) { animator.speed = _baseAnimatorSpeed; } ClearState(); } } private static void ClearState() { _animator = null; _baseAnimatorSpeed = 1f; _lastAppliedSpeed = 1f; _applied = false; } } [HarmonyPatch(typeof(Player), "UpdateFood")] internal static class BerserkerFuryHealthRegenPatch { [HarmonyPrefix] private static void Prefix(Player __instance, bool forceUpdate) { if (!((Object)(object)__instance == (Object)null || (Object)(object)__instance != (Object)(object)Player.m_localPlayer || forceUpdate) && BerserkerAbilities.IsFuryActive(__instance)) { __instance.m_foodRegenTimer = 0f; } } } internal static class BerserkerFuryVisual { private static GameObject _bloodObject; private const float DropsPerSecond = 5f; private const float EmitterHeight = 1.25f; public static void Play(Player player) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null || (Object)(object)ZNetScene.instance == (Object)null) { return; } Clear(); GameObject prefab = ZNetScene.instance.GetPrefab("vfx_BloodHit"); if ((Object)(object)prefab == (Object)null) { Logger.LogWarning((object)"JGRPG Fury could not find vfx_BloodHit."); return; } ParticleSystemRenderer componentInChildren = prefab.GetComponentInChildren<ParticleSystemRenderer>(true); if ((Object)(object)componentInChildren == (Object)null || (Object)(object)((Renderer)componentInChildren).sharedMaterial == (Object)null) { Logger.LogWarning((object)"JGRPG Fury could not find a blood particle material."); return; } _bloodObject = new GameObject("JGRPG_FuryBloodDrip"); _bloodObject.transform.SetParent(((Component)player).transform, false); _bloodObject.transform.localPosition = new Vector3(0f, 1.25f, 0f); _bloodObject.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); ParticleSystem obj = _bloodObject.AddComponent<ParticleSystem>(); ConfigureParticles(obj, ((Renderer)componentInChildren).sharedMaterial); obj.Play(); } private static void ConfigureParticles(ParticleSystem particles, Material bloodMaterial) { //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_0099: Unknown result type (might be due to invalid IL or missing references) MainModule main = particles.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.6f, 1f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.1f, 0.3f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.03f, 0.07f); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(1.5f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 64; EmissionModule emission = particles.emission; ((EmissionModule)(ref emission)).enabled = true; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(5f); ShapeModule shape = particles.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4; ((ShapeModule)(ref shape)).angle = 8f; ((ShapeModule)(ref shape)).radius = 0.18f; ParticleSystemRenderer component = ((Component)particles).GetComponent<ParticleSystemRenderer>(); ((Renderer)component).sharedMaterial = bloodMaterial; component.renderMode = (ParticleSystemRenderMode)0; } public static void Clear() { if ((Object)(object)_bloodObject != (Object)null) { Object.Destroy((Object)(object)_bloodObject); _bloodObject = null; } } } internal static class BerserkerPassiveBonuses { public static float GetMeleeDamageBonus() { return (float)(CharacterProgression.GetTalentRank("Berserker_MeleeDamage1") + CharacterProgression.GetTalentRank("Berserker_MeleeDamage2") + CharacterProgression.GetTalentRank("Berserker_MeleeDamage3")) * 0.03f; } public static float GetDesperationDamageBonus() { return (float)(CharacterProgression.GetTalentRank("Berserker_Desperation1") + CharacterProgression.GetTalentRank("Berserker_Desperation2") + CharacterProgression.GetTalentRank("Berserker_Desperation3")) * 0.05f; } public static float GetTotalMeleeDamageMultiplier(Player player) { float num = GetMeleeDamageBonus(); if ((Object)(object)player != (Object)null && ((Character)player).GetHealth() < ((Character)player).GetMaxHealth() * 0.5f) { num += GetDesperationDamageBonus(); } if (BerserkerAbilities.IsRageActive(player)) { num += 0.5f; } if (BerserkerAbilities.IsThorsHammerActive(player)) { num += 0.2f; } return 1f + num; } public static float GetStaminaRegenMultiplier() { int num = CharacterProgression.GetTalentRank("Berserker_StaminaRegeneration1") + CharacterProgression.GetTalentRank("Berserker_StaminaRegeneration2"); return 1f + (float)num * 0.05f; } public static float GetArmorBonus() { return (float)CharacterProgression.GetTalentRank("Berserker_Armored") * 5f; } public static float GetMaxStaminaBonus() { return (float)(CharacterProgression.GetTalentRank("Berserker_Endurance1") + CharacterProgression.GetTalentRank("Berserker_Endurance2")) * 5f; } public static float GetMovementSpeedMultiplier() { int talentRank = CharacterProgression.GetTalentRank("Berserker_RelentlessPursuit1"); int talentRank2 = CharacterProgression.GetTalentRank("Berserker_RelentlessPursuit2"); float num = (float)talentRank * 0.1f + (float)talentRank2 * 0.05f; if (BerserkerAbilities.IsRageActive()) { num += 0.2f; } return 1f + num; } public static bool HasSunder() { return CharacterProgression.GetTalentRank("Berserker_Sunder") > 0; } public static float GetMaxHealthBonus() { return (float)CharacterProgression.GetTalentRank("Berserker_Vitality1") * 5f; } public static float GetSprintStaminaReduction() { return Mathf.Clamp((float)CharacterProgression.GetTalentRank("Berserker_Tireless") * 0.05f, 0f, 0.95f); } public static float GetEndlessThirstStaminaFraction() { return Mathf.Clamp01((float)CharacterProgression.GetTalentRank("Berserker_EndlessThirst") * 0.04f); } public static float GetOdinsStrengthReduction() { return Mathf.Clamp((float)CharacterProgression.GetTalentRank("Berserker_OdinsStrength") * 0.025f, 0f, 0.95f); } public static float GetTooAngryToDieReduction() { return Mathf.Clamp((float)CharacterProgression.GetTalentRank("Berserker_TooAngryToDie") * 0.05f, 0f, 0.95f); } public static float GetIncomingDamageMultiplier(Player player) { if ((Object)(object)player == (Object)null) { return 1f; } float num = 0f; if (((Character)player).GetHealth() < ((Character)player).GetMaxHealth() * 0.5f) { num -= GetTooAngryToDieReduction(); } if (BerserkerAbilities.IsRageActive()) { num += BerserkerAbilities.GetRageIncomingDamageBonus(); } return 1f + num; } public static bool IsMeleeWeaponSkill(SkillType skillType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 if ((int)skillType != 7 && (int)skillType != 3 && (int)skillType != 2 && (int)skillType != 4 && (int)skillType != 5) { return (int)skillType == 1; } return true; } public static bool IsBerserkerMeleeWeaponSkill(SkillType skillType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 if (!IsMeleeWeaponSkill(skillType)) { return (int)skillType == 11; } return true; } } [HarmonyPatch(typeof(Attack), "ModifyDamage")] internal static class BerserkerMeleeDamagePatch { [HarmonyPostfix] private static void Postfix(Attack __instance, HitData hitData) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (CharacterProgression.Class == CharacterClass.Berserker && __instance != null && hitData != null && !((Object)(object)__instance.m_character == (Object)null) && !((Object)(object)__instance.m_character != (Object)(object)Player.m_localPlayer) && __instance.m_weapon != null && BerserkerPassiveBonuses.IsBerserkerMeleeWeaponSkill(__instance.m_weapon.m_shared.m_skillType)) { float totalMeleeDamageMultiplier = BerserkerPassiveBonuses.GetTotalMeleeDamageMultiplier(Player.m_localPlayer); if (totalMeleeDamageMultiplier != 1f) { ((DamageTypes)(ref hitData.m_damage)).Modify(totalMeleeDamageMultiplier); } } } } [HarmonyPatch(typeof(Player), "UpdateStats", new Type[] { typeof(float) })] internal static class BerserkerStaminaRegenPatch { [HarmonyPrefix] private static void Prefix(Player __instance, out float __state) { __state = -1f; if (CharacterProgression.Class == CharacterClass.Berserker && !((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { float staminaRegenMultiplier = BerserkerPassiveBonuses.GetStaminaRegenMultiplier(); if (staminaRegenMultiplier != 1f) { __state = __instance.m_staminaRegen; __instance.m_staminaRegen *= staminaRegenMultiplier; } } } [HarmonyPostfix] private static void Postfix(Player __instance, float __state) { if (!((Object)(object)__instance == (Object)null) && !(__state < 0f)) { __instance.m_staminaRegen = __state; } } } [HarmonyPatch(typeof(Player), "GetBodyArmor")] internal static class BerserkerArmoredPatch { [HarmonyPostfix] private static void Postfix(Player __instance, ref float __result) { if (CharacterProgression.Class == CharacterClass.Berserker && !((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { __result += BerserkerPassiveBonuses.GetArmorBonus(); } } } [HarmonyPatch(typeof(Player), "GetTotalFoodValue")] internal static class BerserkerMaxStatsPatch { [HarmonyPostfix] private static void Postfix(Player __instance, ref float hp, ref float stamina) { if (CharacterProgression.Class == CharacterClass.Berserker && !((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { hp += BerserkerPassiveBonuses.GetMaxHealthBonus(); stamina += BerserkerPassiveBonuses.GetMaxStaminaBonus(); } } } [HarmonyPatch(typeof(Player), "GetJogSpeedFactor")] internal static class BerserkerRelentlessPursuitJogPatch { [HarmonyPostfix] private static void Postfix(Player __instance, ref float __result) { if (CharacterProgression.Class == CharacterClass.Berserker && !((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { __result *= BerserkerPassiveBonuses.GetMovementSpeedMultiplier(); } } } [HarmonyPatch(typeof(Player), "GetRunSpeedFactor")] internal static class BerserkerRelentlessPursuitRunPatch { [HarmonyPostfix] private static void Postfix(Player __instance, ref float __result) { if (CharacterProgression.Class == CharacterClass.Berserker && !((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { __result *= BerserkerPassiveBonuses.GetMovementSpeedMultiplier(); } } } [HarmonyPatch(typeof(Character), "Damage")] internal static class BerserkerSunderHitPatch { internal static readonly int SunderHitMarker = StringExtensionMethods.GetStableHashCode("JGRPG_Berserker_Sunder"); [HarmonyPrefix] private static void Prefix(Character __instance, HitData hit) { //IL_0084: 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_00a7: 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_00ab: Invalid comparison between Unknown and I4 //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 if ((Object)(object)__instance == (Object)null || hit == null || (Object)(object)Player.m_localPlayer == (Object)null || CharacterProgression.Class != CharacterClass.Berserker || !BerserkerPassiveBonuses.HasSunder()) { return; } string prefabName = Utils.GetPrefabName(((Component)__instance).gameObject); if (prefabName == "StoneGolem" || prefabName == "TrollFrost") { return; } Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if ((Object)(object)val == (Object)null || (Object)(object)val != (Object)(object)Player.m_localPlayer || hit.m_ranged || !BerserkerAbilities.IsRageActive(val) || !BerserkerPassiveBonuses.IsBerserkerMeleeWeaponSkill(hit.m_skill)) { return; } ItemData currentWeapon = ((Humanoid)val).GetCurrentWeapon(); if (currentWeapon != null) { ItemType itemType = currentWeapon.m_shared.m_itemType; if (((int)itemType == 14 || (int)itemType == 22) && hit.m_statusEffectHash == 0) { hit.m_statusEffectHash = SunderHitMarker; } } } } [HarmonyPatch(typeof(HitData), "ApplyResistance")] internal static class BerserkerSunderResistancePatch { [HarmonyPrefix] private static void Prefix(HitData __instance, ref DamageModifiers modifiers) { //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_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_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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_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_00a2: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (__instance != null && __instance.m_statusEffectHash == BerserkerSunderHitPatch.SunderHitMarker) { __instance.m_statusEffectHash = 0; modifiers.m_blunt = RemoveResistance(modifiers.m_blunt); modifiers.m_slash = RemoveResistance(modifiers.m_slash); modifiers.m_pierce = RemoveResistance(modifiers.m_pierce); modifiers.m_chop = RemoveResistance(modifiers.m_chop); modifiers.m_pickaxe = RemoveResistance(modifiers.m_pickaxe); modifiers.m_fire = RemoveResistance(modifiers.m_fire); modifiers.m_frost = RemoveResistance(modifiers.m_frost); modifiers.m_lightning = RemoveResistance(modifiers.m_lightning); modifiers.m_poison = RemoveResistance(modifiers.m_poison); modifiers.m_spirit = RemoveResistance(modifiers.m_spirit); } } private unsafe static DamageModifier RemoveResistance(DamageModifier modifier) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) switch (((object)(*(DamageModifier*)(&modifier))/*cast due to .constrained prefix*/).ToString()) { case "Resistant": case "VeryResistant": case "SlightlyResistant": case "Immune": return (DamageModifier)0; default: return modifier; } } } [HarmonyPatch(typeof(Player), "GetEquipmentRunStaminaModifier")] internal static class BerserkerTirelessPatch { [HarmonyPostfix] private static void Postfix(Player __instance, ref float __result) { if (CharacterProgression.Class == CharacterClass.Berserker && !((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { __result -= BerserkerPassiveBonuses.GetSprintStaminaReduction(); } } } [HarmonyPatch(typeof(Player), "GetEquipmentAttackStaminaModifier")] internal static class BerserkerOdinsStrengthPatch { [HarmonyPostfix] private static void Postfix(Player __instance, ref float __result) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (CharacterProgression.Class == CharacterClass.Berserker && !((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { ItemData currentWeapon = ((Humanoid)__instance).GetCurrentWeapon(); if (currentWeapon != null && BerserkerPassiveBonuses.IsBerserkerMeleeWeaponSkill(currentWeapon.m_shared.m_skillType)) { __result -= BerserkerPassiveBonuses.GetOdinsStrengthReduction(); } } } } [HarmonyPatch(typeof(Character), "Damage")] internal static class BerserkerTooAngryToDiePatch { [HarmonyPrefix] private static void Prefix(Character __instance, HitData hit) { if (CharacterProgression.Class == CharacterClass.Berserker && !((Object)(object)__instance == (Object)null) && hit != null && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { float incomingDamageMultiplier = BerserkerPassiveBonuses.GetIncomingDamageMultiplier(Player.m_localPlayer); if (incomingDamageMultiplier != 1f) { ((DamageTypes)(ref hit.m_damage)).Modify(incomingDamageMultiplier); } } } } [HarmonyPatch(typeof(Character), "Damage")] internal static class BerserkerEndlessThirstPatch { [HarmonyPrefix] private static void Prefix(Character __instance, HitData hit, out bool __state) { __state = false; if (CharacterProgression.Class == CharacterClass.Berserker && !((Object)(object)__instance == (Object)null) && hit != null && !((Object)(object)Player.m_localPlayer == (Object)null)) { Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)Player.m_localPlayer) && !__instance.IsDead() && !(__instance.GetHealth() <= 0f) && BaseAI.IsEnemy((Character)(object)val, __instance)) { __state = true; } } } [HarmonyPostfix] private static void Postfix(Character __instance, bool __state) { if (__state && !((Object)(object)__instance == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null) && (__instance.IsDead() || !(__instance.GetHealth() > 0f))) { float endlessThirstStaminaFraction = BerserkerPassiveBonuses.GetEndlessThirstStaminaFraction(); if (!(endlessThirstStaminaFraction <= 0f)) { Player localPlayer = Player.m_localPlayer; ((Character)localPlayer).AddStamina(((Character)localPlayer).GetMaxStamina() * endlessThirstStaminaFraction); } } } } internal static class BerserkerRageVisual { private sealed class MaterialState { public Material Material; public bool HasColor; public Color OriginalColor; public bool HasSkinColor; public Color OriginalSkinColor; public bool HasHairColor; public Color OriginalHairColor; } private static readonly Dictionary<Material, MaterialState> _materialStates = new Dictionary<Material, MaterialState>(); private static Player _player; private static float _nextRefreshTime; private const float RefreshInterval = 0.5f; public static void Apply(Player player) { if (!((Object)(object)player == (Object)null)) { if ((Object)(object)_player != (Object)null && (Object)(object)_player != (Object)(object)player) { Clear(); } _player = player; TintCurrentRenderers(player); _nextRefreshTime = Time.time + 0.5f; } } public static void Update(Player player) { if (!((Object)(object)player == (Object)null) && !((Object)(object)_player == (Object)null) && !((Object)(object)player != (Object)(object)_player)) { if (!BerserkerAbilities.IsRageActive(player)) { Clear(); } else if (!(Time.time < _nextRefreshTime)) { TintCurrentRenderers(player); _nextRefreshTime = Time.time + 0.5f; } } } private static void TintCurrentRenderers(Player player) { Renderer[] componentsInChildren = ((Component)player).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if ((Object)(object)val == (Object)null || (!(val is SkinnedMeshRenderer) && !(val is MeshRenderer))) { continue; } Material[] materials = val.materials; foreach (Material val2 in materials) { if (!((Object)(object)val2 == (Object)null)) { if (!_materialStates.TryGetValue(val2, out var value)) { value = CaptureState(val2); _materialStates[val2] = value; } ApplyRedTint(value); } } } } private static MaterialState CaptureState(Material material) { //IL_0028: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_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) MaterialState materialState = new MaterialState(); materialState.Material = material; if (material.HasProperty("_Color")) { materialState.HasColor = true; materialState.OriginalColor = material.GetColor("_Color"); } if (material.HasProperty("_SkinColor")) { materialState.HasSkinColor = true; materialState.OriginalSkinColor = material.GetColor("_SkinColor"); } if (material.HasProperty("_HairColor")) { materialState.HasHairColor = true; materialState.OriginalHairColor = material.GetColor("_HairColor"); } return materialState; } private static void ApplyRedTint(MaterialState state) { //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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) if (state != null && !((Object)(object)state.Material == (Object)null)) { if (state.HasColor) { state.Material.SetColor("_Color", GetRageColor(state.OriginalColor)); } if (state.HasSkinColor) { state.Material.SetColor("_SkinColor", GetRageColor(state.OriginalSkinColor)); } if (state.HasHairColor) { state.Material.SetColor("_HairColor", GetRageColor(state.OriginalHairColor)); } } } private static Color GetRageColor(Color original) { //IL_000f: 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) return new Color(1f, 0.05f, 0.05f, original.a); } public static void Clear() { //IL_0042: 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_007e: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<Material, MaterialState> materialState in _materialStates) { MaterialState value = materialState.Value; if (value != null && !((Object)(object)value.Material == (Object)null)) { if (value.HasColor) { value.Material.SetColor("_Color", value.OriginalColor); } if (value.HasSkinColor) { value.Material.SetColor("_SkinColor", value.OriginalSkinColor); } if (value.HasHairColor) { value.Material.SetColor("_HairColor", value.OriginalHairColor); } } } _materialStates.Clear(); _player = null; _nextRefreshTime = 0f; } } [HarmonyPatch(typeof(Player), "Update")] internal static class BerserkerRageVisualUpdatePatch { [HarmonyPostfix] private static void Postfix(Player __instance) { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { BerserkerRageVisual.Update(__instance); } } } internal static class BerserkerThorsMightVisual { private const int ArcCount = 4; private const int PointsPerArc = 7; private const float ArcRefreshInterval = 0.055f; private const float ArcWidth = 0.022f; private static Player _player; private static GameObject _weaponObject; private static GameObject _effectRoot; private static LineRenderer[] _arcs; private static Material _lightningMaterial; private static Light _weaponLight; private static float _nextArcRefreshTime; public static void Play(Player player) { if (!((Object)(object)player == (Object)null)) { Clear(); _player = player; RefreshWeapon(player); } } public static void Update(Player player) { if ((Object)(object)player == (Object)null || (Object)(object)_player == (Object)null || (Object)(object)player != (Object)(object)_player) { return; } if (!BerserkerAbilities.IsThorsHammerActive(player)) { Clear(); return; } GameObject currentWeaponVisual = GetCurrentWeaponVisual(player); if ((Object)(object)currentWeaponVisual != (Object)(object)_weaponObject) { DestroyEffect(); _weaponObject = currentWeaponVisual; if ((Object)(object)_weaponObject != (Object)null) { CreateEffect(_weaponObject); } } if (!((Object)(object)_weaponObject == (Object)null) && !((Object)(object)_effectRoot == (Object)null) && Time.time >= _nextArcRefreshTime) { UpdateLightningArcs(); _nextArcRefreshTime = Time.time + 0.055f; } } private static void RefreshWeapon(Player player) { _weaponObject = GetCurrentWeaponVisual(player); if (!((Object)(object)_weaponObject == (Object)null)) { CreateEffect(_weaponObject); } } private static GameObject GetCurrentWeaponVisual(Player player) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null || (Object)(object)((Humanoid)player).m_visEquipment == (Object)null) { return null; } ItemData currentWeapon = ((Humanoid)player).GetCurrentWeapon(); if (currentWeapon == null) { return null; } if (!BerserkerPassiveBonuses.IsBerserkerMeleeWeaponSkill(currentWeapon.m_shared.m_skillType)) { return null; } if (currentWeapon == ((Humanoid)player).m_rightItem) { return ((Humanoid)player).m_visEquipment.m_rightItemInstance; } if (currentWeapon == ((Humanoid)player).m_leftItem) { return ((Humanoid)player).m_visEquipment.m_leftItemInstance; } if ((Object)(object)((Humanoid)player).m_visEquipment.m_rightItemInstance != (Object)null) { return ((Humanoid)player).m_visEquipment.m_rightItemInstance; } return ((Humanoid)player).m_visEquipment.m_leftItemInstance; } private static void CreateEffect(GameObject weaponObject) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)weaponObject == (Object)null) { return; } Shader val = Shader.Find("Sprites/Default"); if ((Object)(object)val == (Object)null) { Logger.LogWarning((object)"JGRPG Thor's Might could not find lightning shader."); return; } _lightningMaterial = new Material(val); _effectRoot = new GameObject("JGRPG_ThorsMightLightning"); _effectRoot.transform.SetParent(weaponObject.transform, false); _effectRoot.transform.localPosition = Vector3.zero; _effectRoot.transform.localRotation = Quaternion.identity; _effectRoot.transform.localScale = Vector3.one; _arcs = (LineRenderer[])(object)new LineRenderer[4]; for (int i = 0; i < 4; i++) { GameObject val2 = new GameObject("LightningArc_" + i); val2.transform.SetParent(_effectRoot.transform, false); LineRenderer val3 = val2.AddComponent<LineRenderer>(); val3.useWorldSpace = false; val3.positionCount = 7; ((Renderer)val3).material = _lightningMaterial; val3.startWidth = 0.022f; val3.endWidth