Decompiled source of NorseDemigods v1.4.7
NorseDemigods.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using DigitalRuby.LightningBolt; using HarmonyLib; using JetBrains.Annotations; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using NorseDemigods.Abilities; using NorseDemigods.Attributes; using NorseDemigods.Controllers; using NorseDemigods.DataProperties; using NorseDemigods.Demigods; using NorseDemigods.StatusEffects; using SimpleJson; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("NorseDemigods")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NorseDemigods")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.0")] public static class AnimationSpeedManager { public delegate double Handler(Character character, double speed); private static readonly Harmony harmony = new Harmony("AnimationSpeedManager"); private static readonly MethodInfo method = AccessTools.DeclaredMethod(typeof(CharacterAnimEvent), "CustomFixedUpdate", (Type[])null, (Type[])null); private static readonly Dictionary<int, List<Handler>> handlersPriorities = new Dictionary<int, List<Handler>>(); private static Handler[][] handlers = Array.Empty<Handler[]>(); private static int index = 0; private static bool changed = false; private static bool hasMarkerPatch = false; [PublicAPI] public static void Add(Handler handler, int priority = 400) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown if (!hasMarkerPatch) { harmony.Patch((MethodBase)method, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(AnimationSpeedManager), "markerPatch", (Type[])null, (Type[])null)), (HarmonyMethod)null); hasMarkerPatch = true; } if (!handlersPriorities.TryGetValue(priority, out var value)) { handlersPriorities.Add(priority, value = new List<Handler>()); harmony.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(AnimationSpeedManager), "wrapper", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } value.Add(handler); handlers = (from kv in handlersPriorities orderby kv.Key select kv.Value.ToArray()).ToArray(); } private static void wrapper(Character ___m_character, Animator ___m_animator) { double num = (double)___m_animator.speed * 10000000.0 % 100.0; if ((!(num > 10.0) || !(num < 30.0)) && !(___m_animator.speed <= 0.001f)) { double num2 = ___m_animator.speed; double num3 = handlers[index++].Aggregate(num2, (double current, Handler handler) => handler(___m_character, current)); if (num3 != num2) { ___m_animator.speed = (float)(num3 - num3 % 1E-05); changed = true; } } } private static void markerPatch(Animator ___m_animator) { if (changed) { float speed = ___m_animator.speed; double num = (double)speed * 10000000.0 % 100.0; if (num < 10.0 || num > 30.0) { ___m_animator.speed += 1.9E-06f; } changed = false; } index = 0; } } namespace DigitalRuby.LightningBolt { public enum LightningBoltAnimationMode { None, Random, Loop, PingPong } [RequireComponent(typeof(LineRenderer))] public class LightningBoltScript : MonoBehaviour { [Tooltip("The game object where the lightning will emit from. If null, StartPosition is used.")] public GameObject StartObject; [Tooltip("The start position where the lightning will emit from. This is in world space if StartObject is null, otherwise this is offset from StartObject position.")] public Vector3 StartPosition; [Tooltip("The game object where the lightning will end at. If null, EndPosition is used.")] public GameObject EndObject; [Tooltip("The end position where the lightning will end at. This is in world space if EndObject is null, otherwise this is offset from EndObject position.")] public Vector3 EndPosition; [Range(0f, 8f)] [Tooltip("How manu generations? Higher numbers create more line segments.")] public int Generations = 6; [Range(0.01f, 1f)] [Tooltip("How long each bolt should last before creating a new bolt. In ManualMode, the bolt will simply disappear after this amount of seconds.")] public float Duration = 0.05f; private float timer; [Range(0f, 1f)] [Tooltip("How chaotic should the lightning be? (0-1)")] public float ChaosFactor = 0.15f; [Tooltip("In manual mode, the trigger method must be called to create a bolt")] public bool ManualMode; [Range(1f, 64f)] [Tooltip("The number of rows in the texture. Used for animation.")] public int Rows = 1; [Range(1f, 64f)] [Tooltip("The number of columns in the texture. Used for animation.")] public int Columns = 1; [Tooltip("The animation mode for the lightning")] public LightningBoltAnimationMode AnimationMode = LightningBoltAnimationMode.PingPong; [NonSerialized] [HideInInspector] public Random RandomGenerator = new Random(); private LineRenderer lineRenderer; private List<KeyValuePair<Vector3, Vector3>> segments = new List<KeyValuePair<Vector3, Vector3>>(); private int startIndex; private Vector2 size; private Vector2[] offsets; private int animationOffsetIndex; private int animationPingPongDirection = 1; private bool orthographic; private void GetPerpendicularVector(ref Vector3 directionNormalized, out Vector3 side) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (directionNormalized == Vector3.zero) { side = Vector3.right; return; } float x = directionNormalized.x; float y = directionNormalized.y; float z = directionNormalized.z; float num = Mathf.Abs(x); float num2 = Mathf.Abs(y); float num3 = Mathf.Abs(z); float num4; float num5; float num6; if (num >= num2 && num2 >= num3) { num4 = 1f; num5 = 1f; num6 = (0f - (y * num4 + z * num5)) / x; } else if (num2 >= num3) { num6 = 1f; num5 = 1f; num4 = (0f - (x * num6 + z * num5)) / y; } else { num6 = 1f; num4 = 1f; num5 = (0f - (x * num6 + y * num4)) / z; } Vector3 val = new Vector3(num6, num4, num5); side = ((Vector3)(ref val)).normalized; } private void GenerateLightningBolt(Vector3 start, Vector3 end, int generation, int totalGenerations, float offsetAmount) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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) if (generation < 0 || generation > 8) { return; } if (orthographic) { start.z = (end.z = Mathf.Min(start.z, end.z)); } segments.Add(new KeyValuePair<Vector3, Vector3>(start, end)); if (generation == 0) { return; } if (offsetAmount <= 0f) { Vector3 val = end - start; offsetAmount = ((Vector3)(ref val)).magnitude * ChaosFactor; } while (generation-- > 0) { int num = startIndex; startIndex = segments.Count; for (int i = num; i < startIndex; i++) { start = segments[i].Key; end = segments[i].Value; Vector3 val2 = (start + end) * 0.5f; RandomVector(ref start, ref end, offsetAmount, out var result); val2 += result; segments.Add(new KeyValuePair<Vector3, Vector3>(start, val2)); segments.Add(new KeyValuePair<Vector3, Vector3>(val2, end)); } offsetAmount *= 0.5f; } } public void RandomVector(ref Vector3 start, ref Vector3 end, float offsetAmount, out Vector3 result) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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) //IL_001d: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0036: 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_005c: 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) Vector3 val; if (orthographic) { val = end - start; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0f - normalized.y, normalized.x, normalized.z); float num = (float)RandomGenerator.NextDouble() * offsetAmount * 2f - offsetAmount; result = val2 * num; } else { val = end - start; Vector3 directionNormalized = ((Vector3)(ref val)).normalized; GetPerpendicularVector(ref directionNormalized, out var side); float num2 = ((float)RandomGenerator.NextDouble() + 0.1f) * offsetAmount; float num3 = (float)RandomGenerator.NextDouble() * 360f; result = Quaternion.AngleAxis(num3, directionNormalized) * side * num2; } } private void SelectOffsetFromAnimationMode() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) if (AnimationMode == LightningBoltAnimationMode.None) { ((Renderer)lineRenderer).material.mainTextureOffset = offsets[0]; return; } int num; if (AnimationMode == LightningBoltAnimationMode.PingPong) { num = animationOffsetIndex; animationOffsetIndex += animationPingPongDirection; if (animationOffsetIndex >= offsets.Length) { animationOffsetIndex = offsets.Length - 2; animationPingPongDirection = -1; } else if (animationOffsetIndex < 0) { animationOffsetIndex = 1; animationPingPongDirection = 1; } } else if (AnimationMode == LightningBoltAnimationMode.Loop) { num = animationOffsetIndex++; if (animationOffsetIndex >= offsets.Length) { animationOffsetIndex = 0; } } else { num = RandomGenerator.Next(0, offsets.Length); } if (num >= 0 && num < offsets.Length) { ((Renderer)lineRenderer).material.mainTextureOffset = offsets[num]; } else { ((Renderer)lineRenderer).material.mainTextureOffset = offsets[0]; } } private void UpdateLineRenderer() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) int num = segments.Count - startIndex + 1; lineRenderer.positionCount = num; if (num >= 1) { int num2 = 0; lineRenderer.SetPosition(num2++, segments[startIndex].Key); for (int i = startIndex; i < segments.Count; i++) { lineRenderer.SetPosition(num2++, segments[i].Value); } segments.Clear(); SelectOffsetFromAnimationMode(); } } private void Start() { orthographic = (Object)(object)Camera.main != (Object)null && Camera.main.orthographic; lineRenderer = ((Component)this).GetComponent<LineRenderer>(); lineRenderer.positionCount = 0; UpdateFromMaterialChange(); } private void Update() { orthographic = (Object)(object)Camera.main != (Object)null && Camera.main.orthographic; if (timer <= 0f) { if (ManualMode) { timer = Duration; lineRenderer.positionCount = 0; } else { Trigger(); } } timer -= Time.deltaTime; } public void Trigger() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_007e: 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_008e: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) timer = Duration + Mathf.Min(0f, timer); Vector3 start = ((!((Object)(object)StartObject == (Object)null)) ? (StartObject.transform.position + StartPosition) : StartPosition); Vector3 end = ((!((Object)(object)EndObject == (Object)null)) ? (EndObject.transform.position + EndPosition) : EndPosition); startIndex = 0; GenerateLightningBolt(start, end, Generations, Generations, 0f); UpdateLineRenderer(); } public void UpdateFromMaterialChange() { //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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) size = new Vector2(1f / (float)Columns, 1f / (float)Rows); ((Renderer)lineRenderer).material.mainTextureScale = size; offsets = (Vector2[])(object)new Vector2[Rows * Columns]; for (int i = 0; i < Rows; i++) { for (int j = 0; j < Columns; j++) { offsets[j + i * Columns] = new Vector2((float)j / (float)Columns, (float)i / (float)Rows); } } } } } namespace NorseDemigods { public class Cache { public struct CachedItemDataKey { public readonly string ItemName; public readonly Type Ability; public CachedItemDataKey(string itemName, Type ability) { ItemName = itemName; Ability = ability; } } public static LayerMask LayerMaskDestructibles = LayerMask.op_Implicit(LayerMask.GetMask(new string[7] { "Default", "Default_small", "hitbox", "piece", "piece_nonsolid", "static_solid", "vehicle" })); public static LayerMask LayerMaskCharacters = LayerMask.op_Implicit(LayerMask.GetMask(new string[3] { "character", "character_ghost", "character_net" })); public static LayerMask LayerMaskEnvironment = LayerMask.op_Implicit(LayerMask.GetMask(new string[7] { "Default", "Default_small", "piece", "piece_nonsolid", "static_solid", "terrain", "vehicle" })); public static LayerMask LayerMaskEnvNoTerrain = LayerMask.op_Implicit(LayerMask.GetMask(new string[6] { "Default", "Default_small", "piece", "piece_nonsolid", "static_solid", "vehicle" })); public static LayerMask LayerMaskEnvWithWater = LayerMask.op_Implicit(LayerMask.GetMask(new string[8] { "Default", "Default_small", "piece", "piece_nonsolid", "static_solid", "terrain", "vehicle", "Water" })); public static LayerMask LayerMaskTerrainWithWater = LayerMask.op_Implicit(LayerMask.GetMask(new string[2] { "terrain", "Water" })); public static LayerMask LayerMaskTerrain = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "terrain" })); public static LayerMask LayerMaskWater = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Water" })); public static LayerMask LayerMaskEverything = LayerMask.op_Implicit(LayerMask.GetMask(new string[11] { "character", "character_ghost", "character_net", "Default", "Default_small", "hitbox", "piece", "piece_nonsolid", "static_solid", "terrain", "vehicle" })); public static readonly int s_statusEffectSlowFall = StringExtensionMethods.GetStableHashCode("SlowFall"); public static readonly int s_statusEffectJCGliding = StringExtensionMethods.GetStableHashCode("JCGliding"); public static readonly int s_statusEffectDarkWings = StringExtensionMethods.GetStableHashCode("SE_DarkWings"); public static readonly int s_statusEffectFenringArmor = StringExtensionMethods.GetStableHashCode("SetEffect_FenringArmor"); public static readonly int s_statusEffectInfusedBeltStrength = StringExtensionMethods.GetStableHashCode("SE_Infused_Belt_Strength"); public static GameObject FxLightningWithSoundOnline; public static GameObject FxLightningWithoutSoundOnline; public static GameObject FxLightningWithoutSoundOffline; public static GameObject FxFlameOnline; public static GameObject FxFlameWithSoundOnline; public static GameObject FxFlameTransparentOnline; public static GameObject FxFlameTransparentOffline; public static Attack AcidBoltAttack; public static Attack ArcaneBoltAttack; public static Attack IceshardsAttack; public static Attack LightningBoltAttack; public static Attack PoisonJavelinAttack; public static AnimationClip CachedAnimPunch1; public static AnimationClip CachedAnimPunch2; public static AnimationClip CachedAnimFireball1; public static AnimationClip CachedAnimFireball2; public static AnimationClip CachedAnimMaceSecondary; public static AnimationClip CachedAnimSwordSecondary; public static AnimationClip CachedAnimGuardianPower; public static readonly Dictionary<int, GameObject> OfflinePrefabs = new Dictionary<int, GameObject>(); public static readonly Dictionary<string, SharedData> OriginalItemSharedDataDictionary = new Dictionary<string, SharedData>(); public static readonly Dictionary<CachedItemDataKey, SharedData> ModifiedItemSharedDataDictionary = new Dictionary<CachedItemDataKey, SharedData>(); public static Demigod MyDemigod { get; set; } = null; public static CachedItemDataKey GetCachedItemDataKey(string itemName, Type ability) { return new CachedItemDataKey(itemName, ability); } public static void ClearCache() { ModifiedItemSharedDataDictionary.Clear(); MyDemigod = null; } } [Serializable] public class SoundEffectProperties { public string AudioTypeName { get; set; } public string AudioClipName { get; set; } public float MinDistance { get; set; } public float MaxDistance { get; set; } public float MaxVolume { get; set; } public float FadeTime { get; set; } public float StartTime { get; set; } public float EndTime { get; set; } } public class DemigodAbility : IDemigodEntity { public struct AbilityParametersStruct { public AbilityType AbilityType; public SkillType[] SkillTypes; public object Properties; public AbilityParametersStruct(AbilityType abilityType, SkillType[] skillTypes = null, object properties = null) { AbilityType = abilityType; Properties = properties; if (skillTypes != null) { SkillTypes = skillTypes; } else { SkillTypes = (SkillType[])(object)new SkillType[1]; } } } public enum AbilityType { NONE, SLOT_1, SLOT_2, SLOT_3, SLOT_4, TELEPORT, SPECIAL_ATTACK, SPECIAL_ATTACK_AIR, SPECIAL_ATTACK_BLOCKING } protected SE_Ability_Cooldown AbilityCooldownStatusEffect; private int s_statusEffectCooldown; private float energyDrainTimer = -1f; private float tickTimer = -1f; private float lifeTimer = -1f; private Player owner; private Demigod demigod; public AbilityParametersStruct AbilityParameters { get; protected set; } public Texture2D Icon { get; protected set; } public string ClassName { get; set; } public string ConfigName { get; set; } public string DisplayName { get; set; } public int EnergyRequired { get; protected set; } public int EnergyCost { get; protected set; } public int EitrCost { get; protected set; } public float EnergyDrainPeriod { get; protected set; } public float Cooldown { get; protected set; } public float Duration { get; protected set; } public bool IsBuff { get; protected set; } public bool IsChanneled { get; protected set; } public bool IsActive { get; protected set; } public bool CanBeStopped { get; protected set; } public Player Owner { get { return owner; } set { owner = value; } } public Demigod Demigod { get { return demigod; } set { demigod = value; } } public bool DrainsEnergy => EnergyDrainPeriod > 0f; public DemigodAbility(AbilityParametersStruct abilityInfo) { AbilityParameters = abilityInfo; Helper.SetupDemigodEntity(this); s_statusEffectCooldown = StringExtensionMethods.GetStableHashCode(GetType().Name + "Cooldown"); } public DemigodAbility(Player owner, Demigod demigod, AbilityParametersStruct abilityInfo) { this.owner = owner; this.demigod = demigod; AbilityParameters = abilityInfo; Helper.SetupDemigodEntity(this); s_statusEffectCooldown = StringExtensionMethods.GetStableHashCode(GetType().Name + "Cooldown"); } public virtual string GetName() { return NorseDemigods.Localization.TryTranslate("$ability_" + ConfigName + "_name"); } public virtual string GetTooltip() { return NorseDemigods.Localization.TryTranslate("$ability_" + ConfigName + "_tooltip"); } public virtual string GetTooltip(string suffix) { return NorseDemigods.Localization.TryTranslate("$ability_" + ConfigName + "_tooltip_" + suffix); } public virtual string GetInfusedTooltip() { string text = NorseDemigods.Localization.TryTranslate("$ability_" + ConfigName + "_infused_tooltip"); return (text.StartsWith("[") && text.EndsWith("]")) ? null : text; } public virtual string GetStatusTooltip() { string text = NorseDemigods.Localization.TryTranslate("$ability_" + ConfigName + "_status_tooltip"); return (text.StartsWith("[") && text.EndsWith("]")) ? null : text; } public virtual string GetInputTooltip() { //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_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) //IL_008f: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Invalid comparison between Unknown and I4 //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Invalid comparison between Unknown and I4 //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); KeyboardShortcut value; switch (AbilityParameters.AbilityType) { case AbilityType.SLOT_1: value = Configs.HotkeyAbilityA.Value; stringBuilder.Append(((object)(KeyboardShortcut)(ref value)).ToString()); break; case AbilityType.SLOT_2: value = Configs.HotkeyAbilityB.Value; stringBuilder.Append(((object)(KeyboardShortcut)(ref value)).ToString()); break; case AbilityType.SLOT_3: value = Configs.HotkeyAbilityC.Value; if ((int)((KeyboardShortcut)(ref value)).MainKey > 0) { value = Configs.HotkeyAbilityC.Value; stringBuilder.Append(((object)(KeyboardShortcut)(ref value)).ToString()); break; } value = Configs.HotkeyAbilityA.Value; stringBuilder.Append(((object)(KeyboardShortcut)(ref value)).ToString()); stringBuilder.Append(" + "); stringBuilder.Append(NorseDemigods.Localization.TryTranslate("$skill_blocking")); break; case AbilityType.SLOT_4: value = Configs.HotkeyAbilityD.Value; if ((int)((KeyboardShortcut)(ref value)).MainKey > 0) { value = Configs.HotkeyAbilityD.Value; stringBuilder.Append(((object)(KeyboardShortcut)(ref value)).ToString()); break; } value = Configs.HotkeyAbilityB.Value; stringBuilder.Append(((object)(KeyboardShortcut)(ref value)).ToString()); stringBuilder.Append(" + "); stringBuilder.Append(NorseDemigods.Localization.TryTranslate("$skill_blocking")); break; case AbilityType.TELEPORT: value = Configs.HotkeyAbilityTeleport.Value; stringBuilder.Append(((object)(KeyboardShortcut)(ref value)).ToString()); break; case AbilityType.SPECIAL_ATTACK: { for (int j = 0; j < AbilityParameters.SkillTypes.Length; j++) { stringBuilder.Append(NorseDemigods.Localization.TryTranslate("$skill_" + ((object)(SkillType)(ref AbilityParameters.SkillTypes[j])).ToString().ToLower())); if (j < AbilityParameters.SkillTypes.Length - 1) { stringBuilder.Append(" | "); } } stringBuilder.Append(" » "); stringBuilder.Append(NorseDemigods.Localization.TryTranslate("$settings_secondaryattack")); stringBuilder.Append(" "); string format3 = NorseDemigods.Localization.TryTranslate("$ability_hotkey_ignore_special_attack"); value = Configs.HotkeyIgnoreSpecialAttack.Value; stringBuilder.Append(string.Format(format3, ((object)(KeyboardShortcut)(ref value)).ToString())); break; } case AbilityType.SPECIAL_ATTACK_BLOCKING: { for (int i = 0; i < AbilityParameters.SkillTypes.Length; i++) { stringBuilder.Append(NorseDemigods.Localization.TryTranslate("$skill_" + ((object)(SkillType)(ref AbilityParameters.SkillTypes[i])).ToString().ToLower())); if (i < AbilityParameters.SkillTypes.Length - 1) { stringBuilder.Append(" | "); } } stringBuilder.Append(" » "); stringBuilder.Append(NorseDemigods.Localization.TryTranslate("$settings_secondaryattack")); stringBuilder.Append(" + "); stringBuilder.Append(NorseDemigods.Localization.TryTranslate("$skill_blocking")); stringBuilder.Append(" "); string format2 = NorseDemigods.Localization.TryTranslate("$ability_hotkey_ignore_special_attack"); value = Configs.HotkeyIgnoreSpecialAttack.Value; stringBuilder.Append(string.Format(format2, ((object)(KeyboardShortcut)(ref value)).ToString())); break; } case AbilityType.SPECIAL_ATTACK_AIR: { stringBuilder.Append(NorseDemigods.Localization.TryTranslate("$settings_jump")); stringBuilder.Append(" + "); stringBuilder.Append(NorseDemigods.Localization.TryTranslate("$settings_secondaryattack")); stringBuilder.Append(" "); string format = NorseDemigods.Localization.TryTranslate("$ability_hotkey_ignore_special_attack"); value = Configs.HotkeyIgnoreSpecialAttack.Value; stringBuilder.Append(string.Format(format, ((object)(KeyboardShortcut)(ref value)).ToString())); break; } } return stringBuilder.ToString(); } public virtual void Update(float dt) { if ((Object)(object)Owner == (Object)null || ((Character)Owner).IsDead()) { return; } if ((Object)(object)Owner == (Object)(object)Player.m_localPlayer && ((Character)Owner).TakeInput() && !((Character)Owner).InPlaceMode()) { ProcessAbilityInput(); } if (!IsActive) { return; } tickTimer -= dt; if (tickTimer <= 0f) { OnBuffTick(); tickTimer += 1f; } if (EnergyDrainPeriod > 0f) { energyDrainTimer -= dt; if (energyDrainTimer <= 0f) { demigod.DemigodStatusEffect.RemoveEnergy(1); if (demigod.DemigodStatusEffect.Energy <= 0) { Stop(); } energyDrainTimer += EnergyDrainPeriod; } } if (IsActive && Duration > 0f) { lifeTimer -= dt; if (lifeTimer <= 0f) { Stop(); } } } public virtual bool CanExecute(bool showMessage = true) { if (((Character)Owner).GetSEMan().HaveStatusEffect(s_statusEffectCooldown)) { if (showMessage && (Object)(object)AbilityCooldownStatusEffect != (Object)null) { ((Character)Owner).Message((MessageType)1, string.Format(NorseDemigods.Localization.TryTranslate("$ability_oncooldown_message"), DisplayName, Mathf.CeilToInt(((StatusEffect)AbilityCooldownStatusEffect).GetRemaningTime())), 0, (Sprite)null); } return false; } if (demigod.DemigodStatusEffect.Energy < EnergyRequired || demigod.DemigodStatusEffect.Energy < EnergyCost) { if (showMessage) { ((Character)Owner).Message((MessageType)1, string.Format(NorseDemigods.Localization.TryTranslate("$ability_notenoughenergy_message"), DisplayName, demigod.DemigodStatusEffect.Energy, Math.Max(EnergyRequired, EnergyCost)), 0, (Sprite)null); } return false; } if (Owner.m_eitr < (float)EitrCost) { Hud.instance.EitrBarEmptyFlash(); return false; } return true; } public virtual void Execute() { if (EnergyCost > 0 && EnergyDrainPeriod <= 0f) { demigod.DemigodStatusEffect.RemoveEnergy(EnergyCost); } if (EitrCost > 0) { Player obj = Owner; obj.m_eitr -= (float)EitrCost; } if (IsBuff || IsChanneled) { energyDrainTimer = EnergyDrainPeriod; tickTimer = 1f; IsActive = true; } if (Cooldown > 0f && !NorseDemigods.Instance.NoAbilityCooldown) { AbilityCooldownStatusEffect = SE_Ability_Cooldown.CreateAbilityCooldownStatusEffect(this); } if (Duration > 0f) { lifeTimer = Duration; } } public virtual void Stop() { if (IsActive) { IsActive = false; if (EnergyDrainPeriod > 0f) { demigod.DemigodStatusEffect.RemoveEnergy(1); } } } public virtual void OnPlayerDeath() { Stop(); } public virtual void OnPlayerDisconnecting() { Stop(); } public virtual void OnDestroy() { Stop(); } public virtual void Awake() { } public virtual void OnBuffTick() { } public virtual void OnBlocking(HitData hit) { } public virtual void OnTakingDamage(HitData hit) { } public virtual void OnVictimDamage(Character victim, HitData hit) { } public virtual void OnVictimDeath(Character victim) { } public virtual void OnPlayerSpawned() { } public virtual void ModifyWeaponSharedData(SharedData modifiedData, in SharedData originalData) { } private void ProcessAbilityInput() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Invalid comparison between Unknown and I4 //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Invalid comparison between Unknown and I4 //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: 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_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05a6: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Invalid comparison between Unknown and I4 //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: 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) //IL_01fe: Invalid comparison between Unknown and I4 //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) bool flag = false; bool flag2 = false; KeyboardShortcut value; switch (AbilityParameters.AbilityType) { case AbilityType.SLOT_1: value = Configs.HotkeyAbilityA.Value; if (((KeyboardShortcut)(ref value)).Modifiers.Count() == 0) { value = Configs.HotkeyAbilityA.Value; if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey)) { goto IL_007d; } } value = Configs.HotkeyAbilityA.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { goto IL_007d; } goto IL_00b2; case AbilityType.SLOT_2: value = Configs.HotkeyAbilityB.Value; if (((KeyboardShortcut)(ref value)).Modifiers.Count() == 0) { value = Configs.HotkeyAbilityB.Value; if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey)) { goto IL_016c; } } value = Configs.HotkeyAbilityB.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { goto IL_016c; } goto IL_01a1; case AbilityType.SLOT_3: value = Configs.HotkeyAbilityC.Value; if ((int)((KeyboardShortcut)(ref value)).MainKey > 0) { value = Configs.HotkeyAbilityC.Value; if (((KeyboardShortcut)(ref value)).Modifiers.Count() == 0) { value = Configs.HotkeyAbilityC.Value; if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey)) { goto IL_0282; } } value = Configs.HotkeyAbilityC.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { goto IL_0282; } value = Configs.HotkeyAbilityC.Value; if (((KeyboardShortcut)(ref value)).Modifiers.Count() == 0) { value = Configs.HotkeyAbilityC.Value; if (Input.GetKeyUp(((KeyboardShortcut)(ref value)).MainKey)) { goto IL_02d8; } } value = Configs.HotkeyAbilityC.Value; if (!((KeyboardShortcut)(ref value)).IsUp()) { break; } goto IL_02d8; } value = Configs.HotkeyAbilityA.Value; if (((KeyboardShortcut)(ref value)).Modifiers.Count() == 0) { value = Configs.HotkeyAbilityA.Value; if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey)) { goto IL_032b; } } value = Configs.HotkeyAbilityA.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { goto IL_032b; } goto IL_0345; case AbilityType.SLOT_4: value = Configs.HotkeyAbilityD.Value; if ((int)((KeyboardShortcut)(ref value)).MainKey > 0) { value = Configs.HotkeyAbilityD.Value; if (((KeyboardShortcut)(ref value)).Modifiers.Count() == 0) { value = Configs.HotkeyAbilityD.Value; if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey)) { goto IL_040f; } } value = Configs.HotkeyAbilityD.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { goto IL_040f; } value = Configs.HotkeyAbilityD.Value; if (((KeyboardShortcut)(ref value)).Modifiers.Count() == 0) { value = Configs.HotkeyAbilityD.Value; if (Input.GetKeyUp(((KeyboardShortcut)(ref value)).MainKey)) { goto IL_0465; } } value = Configs.HotkeyAbilityD.Value; if (!((KeyboardShortcut)(ref value)).IsUp()) { break; } goto IL_0465; } value = Configs.HotkeyAbilityB.Value; if (((KeyboardShortcut)(ref value)).Modifiers.Count() == 0) { value = Configs.HotkeyAbilityB.Value; if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey)) { goto IL_04b8; } } value = Configs.HotkeyAbilityB.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { goto IL_04b8; } goto IL_04d2; case AbilityType.TELEPORT: { value = Configs.HotkeyAbilityTeleport.Value; if (((KeyboardShortcut)(ref value)).Modifiers.Count() == 0) { value = Configs.HotkeyAbilityTeleport.Value; if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey)) { goto IL_057c; } } value = Configs.HotkeyAbilityTeleport.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { goto IL_057c; } value = Configs.HotkeyAbilityTeleport.Value; if (((KeyboardShortcut)(ref value)).Modifiers.Count() == 0) { value = Configs.HotkeyAbilityTeleport.Value; if (Input.GetKeyUp(((KeyboardShortcut)(ref value)).MainKey)) { goto IL_05d2; } } value = Configs.HotkeyAbilityTeleport.Value; if (!((KeyboardShortcut)(ref value)).IsUp()) { break; } goto IL_05d2; } IL_032b: if (((Character)Owner).IsBlocking()) { flag = true; break; } goto IL_0345; IL_007d: value = Configs.HotkeyAbilityC.Value; if ((int)((KeyboardShortcut)(ref value)).MainKey != 0 || !((Character)Owner).IsBlocking()) { flag = true; break; } goto IL_00b2; IL_057c: flag = true; break; IL_0522: flag2 = true; break; IL_0345: value = Configs.HotkeyAbilityA.Value; if (((KeyboardShortcut)(ref value)).Modifiers.Count() == 0) { value = Configs.HotkeyAbilityA.Value; if (Input.GetKeyUp(((KeyboardShortcut)(ref value)).MainKey)) { goto IL_0395; } } value = Configs.HotkeyAbilityA.Value; if (!((KeyboardShortcut)(ref value)).IsUp()) { break; } goto IL_0395; IL_05d2: flag2 = true; break; IL_0395: flag2 = true; break; IL_0282: flag = true; break; IL_040f: flag = true; break; IL_00b2: value = Configs.HotkeyAbilityA.Value; if (((KeyboardShortcut)(ref value)).Modifiers.Count() == 0) { value = Configs.HotkeyAbilityA.Value; if (Input.GetKeyUp(((KeyboardShortcut)(ref value)).MainKey)) { goto IL_00fb; } } value = Configs.HotkeyAbilityA.Value; if (!((KeyboardShortcut)(ref value)).IsUp()) { break; } goto IL_00fb; IL_02d8: flag2 = true; break; IL_01ea: value = Configs.HotkeyAbilityD.Value; if ((int)((KeyboardShortcut)(ref value)).MainKey > 0) { flag2 = true; } break; IL_0465: flag2 = true; break; IL_01a1: value = Configs.HotkeyAbilityB.Value; if (((KeyboardShortcut)(ref value)).Modifiers.Count() == 0) { value = Configs.HotkeyAbilityB.Value; if (Input.GetKeyUp(((KeyboardShortcut)(ref value)).MainKey)) { goto IL_01ea; } } value = Configs.HotkeyAbilityB.Value; if (!((KeyboardShortcut)(ref value)).IsUp()) { break; } goto IL_01ea; IL_00fb: value = Configs.HotkeyAbilityC.Value; if ((int)((KeyboardShortcut)(ref value)).MainKey > 0) { flag2 = true; } break; IL_04b8: if (((Character)Owner).IsBlocking()) { flag = true; break; } goto IL_04d2; IL_016c: value = Configs.HotkeyAbilityD.Value; if ((int)((KeyboardShortcut)(ref value)).MainKey != 0 || !((Character)Owner).IsBlocking()) { flag = true; break; } goto IL_01a1; IL_04d2: value = Configs.HotkeyAbilityB.Value; if (((KeyboardShortcut)(ref value)).Modifiers.Count() == 0) { value = Configs.HotkeyAbilityB.Value; if (Input.GetKeyUp(((KeyboardShortcut)(ref value)).MainKey)) { goto IL_0522; } } value = Configs.HotkeyAbilityB.Value; if (!((KeyboardShortcut)(ref value)).IsUp()) { break; } goto IL_0522; } if (flag) { if (!IsActive) { if (CanExecute()) { Execute(); } } else if (CanBeStopped) { Stop(); } } else if (flag2 && IsActive && IsChanneled) { Stop(); } } } [Serializable] public class CustomConsumable { [Serializable] public class CustomData { public string AttributeToGive { get; set; } public string VisualEffectPrefab { get; set; } public string RestrictedToDemigod { get; set; } } public string OriginalPrefab { get; set; } public string Prefab { get; set; } public string ItemName { get; set; } public string ItemIcon { get; set; } public RecipeConfig Recipe { get; set; } public Dictionary<string, object> ItemSharedProperties { get; set; } public CustomData ItemCustomData { get; set; } } [Serializable] public abstract class DemigodAttribute : IDemigodEntity { [NonSerialized] private Player owner; [NonSerialized] private Demigod demigod; [NonSerialized] private string className; [NonSerialized] private string configName; [NonSerialized] private string displayName; [NonSerialized] private object properties; public Player Owner { get { return owner; } set { owner = value; } } public Demigod Demigod { get { return demigod; } set { demigod = value; } } public string ClassName { get { return className; } set { className = value; } } public string ConfigName { get { return configName; } set { configName = value; } } public string DisplayName { get { return displayName; } set { displayName = value; } } public object Properties { get { return properties; } set { properties = value; } } public DemigodAttribute() { Helper.SetupDemigodEntity(this); } public DemigodAttribute(object properties) { this.properties = properties; Helper.SetupDemigodEntity(this); } public DemigodAttribute(Player owner, Demigod demigod, object properties = null) { this.owner = owner; this.demigod = demigod; this.properties = properties; Helper.SetupDemigodEntity(this); } public virtual string GetName() { return NorseDemigods.Localization.TryTranslate("$attribute_" + ConfigName + "_name"); } public virtual string GetTooltip() { return NorseDemigods.Localization.TryTranslate("$attribute_" + ConfigName + "_tooltip"); } public virtual string GetStatusTooltip() { string text = NorseDemigods.Localization.TryTranslate("$attribute_" + ConfigName + "_status_tooltip"); return (text.StartsWith("[") && text.EndsWith("]")) ? null : text; } public virtual void Awake() { } public virtual void Update(float dt) { } public virtual void OnBlocking(HitData hit) { } public virtual void OnTakingDamage(HitData hit) { } public virtual void OnVictimDamage(Character victim, HitData hit) { } public virtual void OnVictimDeath(Character victim) { } public virtual void OnPlayerSpawned() { } public virtual void OnPlayerDeath() { } public virtual void OnPlayerDisconnecting() { } public virtual void OnDestroy() { } } public static class Configs { public struct SkillDemigodCapStruct { public string BossName; public string TrophyName; public int SkillCap; public SkillDemigodCapStruct(string bossName, string keyName, int skillCap) { BossName = bossName; TrophyName = keyName; SkillCap = skillCap; } } public const string CurrentConfigVersion = "1.4.7"; public static readonly SkillDemigodCapStruct[] SkillDemigodCapSettings = new SkillDemigodCapStruct[7] { new SkillDemigodCapStruct("None", null, 10), new SkillDemigodCapStruct("Eikthyr", "TrophyEikthyr", 25), new SkillDemigodCapStruct("The Elder", "TrophyTheElder", 40), new SkillDemigodCapStruct("Bonemass", "TrophyBonemass", 55), new SkillDemigodCapStruct("Moder", "TrophyDragonQueen", 70), new SkillDemigodCapStruct("Yagluth", "TrophyGoblinKing", 85), new SkillDemigodCapStruct("The Queen", "TrophySeekerQueen", 0) }; public static ConfigEntry<bool> AutomaticallyUpdateConfigs; public static ConfigEntry<string> ModVersion; public static ConfigEntry<string> Difficulty; public static ConfigEntry<int> WeakerCreatureSpawnRate; public static ConfigEntry<string> WeakerCreaturesList; public static ConfigEntry<bool> EnableMod; public static ConfigEntry<bool> EnablePassiveSpecialEffects; public static ConfigEntry<bool> EnablePvpForAbilities; public static ConfigEntry<bool> EnhanceAttackAngle; public static ConfigEntry<bool> EnhanceCompatibilityWithModAgility; public static ConfigEntry<bool> EnhanceCompatibilityWithModWarfare; public static ConfigEntry<bool> ProtectPiecesCoveredByWard; public static ConfigEntry<KeyboardShortcut> HotkeyAbilityA; public static ConfigEntry<KeyboardShortcut> HotkeyAbilityB; public static ConfigEntry<KeyboardShortcut> HotkeyAbilityC; public static ConfigEntry<KeyboardShortcut> HotkeyAbilityD; public static ConfigEntry<KeyboardShortcut> HotkeyAbilityTeleport; public static ConfigEntry<KeyboardShortcut> HotkeyIgnoreSpecialAttack; public static ConfigEntry<int> EnergyAtBaseLevel; public static ConfigEntry<int> EnergyAtMaxLevel; public static ConfigEntry<int> EnergyRegenerationPeriod; public static ConfigEntry<int> FenrisArmorSetGrantedArmor; public static ConfigEntry<int> FenrisArmorBonusMovementSpeed; public static ConfigEntry<string> InfusedMegingjordCostItemName; public static ConfigEntry<int> InfusedMegingjordCostItemQuantity; public static ConfigEntry<int> InfusedMegingjordIncreasedEnergy; public static ConfigEntry<int> InfusedMegingjordIncreasedMaxWeight; public static ConfigEntry<bool> EnableHarpoonFishing; public static ConfigEntry<int> HarpoonMaxQuality; public static ConfigEntry<float> HarpoonProjectileCollisionRadius; public static ConfigEntry<int> HarpoonUpgradeChitinPerLevel; public static ConfigEntry<int> HarpoonUpgradeDurabilityPerLevel; public static ConfigEntry<bool> IgnoreBeehiveProximityCheck; public static ConfigEntry<int> MaxHoneyProducedByBeehive; public static ConfigEntry<int> QueenBeeSpawnChance; public static ConfigEntry<bool> EnableCustomMerchantItems; public static ConfigEntry<bool> FindClosestMerchants; public static ConfigEntry<int> AbyssalHarpoonPrice; public static ConfigEntry<int> QueenBeePrice; public static ConfigEntry<bool> RunestoneSpawnAtStart; public static ConfigEntry<bool> RunestoneConsumable; public static ConfigEntry<string> RunestoneCraftingRecipe; public static ConfigEntry<bool> EnableSkillLossOnDeath; public static ConfigEntry<int> SkillDemigodExperienceModifier; public static ConfigEntry<int> LevelsLostWhenSwitchingDemigod; public static ConfigEntry<bool> EnableSkillDemigodCap; public static List<ConfigEntry<int>> SkillDemigodCap = new List<ConfigEntry<int>>(); public static ConfigurationManagerAttributes IsAdminOnly = new ConfigurationManagerAttributes { IsAdminOnly = true }; public static ConfigurationManagerAttributes IsAdminOnlyAndAdvanced = new ConfigurationManagerAttributes { IsAdminOnly = true, IsAdvanced = true }; public static ConfigEntry<bool> EnableTeleportAbility; public static ConfigEntry<bool> IgnoreNonTeleportableItems; public static List<string> WeakerCreaturesListPrefabs; public static void SetupConfigs(ConfigFile config) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Expected O, but got Unknown //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Expected O, but got Unknown //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Expected O, but got Unknown //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0336: 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_038b: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Expected O, but got Unknown //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Expected O, but got Unknown //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Expected O, but got Unknown //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Expected O, but got Unknown //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Expected O, but got Unknown //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Expected O, but got Unknown //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Expected O, but got Unknown //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Expected O, but got Unknown //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Expected O, but got Unknown //IL_061e: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Expected O, but got Unknown //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_0662: Expected O, but got Unknown //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_06a8: Expected O, but got Unknown //IL_06da: Unknown result type (might be due to invalid IL or missing references) //IL_06e4: Expected O, but got Unknown //IL_0717: Unknown result type (might be due to invalid IL or missing references) //IL_0721: Expected O, but got Unknown //IL_074b: Unknown result type (might be due to invalid IL or missing references) //IL_0755: Expected O, but got Unknown //IL_0786: Unknown result type (might be due to invalid IL or missing references) //IL_0790: Expected O, but got Unknown //IL_07c6: Unknown result type (might be due to invalid IL or missing references) //IL_07d0: Expected O, but got Unknown //IL_07fd: Unknown result type (might be due to invalid IL or missing references) //IL_0807: Expected O, but got Unknown //IL_0834: Unknown result type (might be due to invalid IL or missing references) //IL_083e: Expected O, but got Unknown //IL_0876: Unknown result type (might be due to invalid IL or missing references) //IL_0880: Expected O, but got Unknown //IL_08b8: Unknown result type (might be due to invalid IL or missing references) //IL_08c2: Expected O, but got Unknown //IL_08ef: Unknown result type (might be due to invalid IL or missing references) //IL_08f9: Expected O, but got Unknown //IL_0926: Unknown result type (might be due to invalid IL or missing references) //IL_0930: Expected O, but got Unknown //IL_0962: Unknown result type (might be due to invalid IL or missing references) //IL_096c: Expected O, but got Unknown //IL_09aa: Unknown result type (might be due to invalid IL or missing references) //IL_09b4: Expected O, but got Unknown //IL_09df: Unknown result type (might be due to invalid IL or missing references) //IL_09e4: Unknown result type (might be due to invalid IL or missing references) //IL_09f0: Unknown result type (might be due to invalid IL or missing references) //IL_09f8: Unknown result type (might be due to invalid IL or missing references) //IL_0a05: Expected O, but got Unknown //IL_0a05: Unknown result type (might be due to invalid IL or missing references) //IL_0a0f: Expected O, but got Unknown //IL_0a39: Unknown result type (might be due to invalid IL or missing references) //IL_0a43: Expected O, but got Unknown //IL_0a6d: Unknown result type (might be due to invalid IL or missing references) //IL_0a77: Expected O, but got Unknown //IL_0ad9: Unknown result type (might be due to invalid IL or missing references) //IL_0ae3: Expected O, but got Unknown //IL_0b0d: Unknown result type (might be due to invalid IL or missing references) //IL_0b17: Expected O, but got Unknown AutomaticallyUpdateConfigs = config.Bind<bool>("(Configs)", GenerateConfigKey("AutomaticallyUpdateConfigs"), true, new ConfigDescription("Determines if your advanced settings (mainly abilities, attributes and demigods) will be automatically reset and updated after every mod upgrade to re-balance the game.", (AcceptableValueBase)null, new object[1] { IsAdminOnly })); ModVersion = config.Bind<string>("(Configs)", GenerateConfigKey("ModVersion"), "1.4.7", new ConfigDescription("Please do not modify this value. This value will be automatically updated every time your mod version is upgraded, which is used for resetting and updating your advanced settings (mainly abilities, attributes and demigods) to re-balance the game (in case 'Automatically Update Configs' in this section is enabled).", (AcceptableValueBase)null, new object[1] { IsAdminOnlyAndAdvanced })); Difficulty = config.Bind<string>("(Difficulty)", GenerateConfigKey("Difficulty"), "Vanilla", new ConfigDescription("Base damage modifier from enemies (stacks with world and mod modifiers); and final damage modifier from enemies (only after applying resistances and armor, which works differently from a world modifier or typical mod modifier):\n\nVanilla: No changes (too easy for a demigod)\n\nNovice: Base damage = +0%\nFinal damage = +25% (+50% for bosses)\n\nAdept: Base damage = +0%\nFinal damage = +50% (+100% for bosses)\n\nExpert: Base damage = +0%\nFinal damage = +75% (+150% for bosses)\n\nElite: Base damage = +0%\nFinal damage = +100% (+200% for bosses)\n\nHardcore: Base damage = +25%\nFinal damage = +100% (+200% for bosses)\n\nInsane: Base damage = +50%\nFinal damage = +100% (+200% for bosses)", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[7] { "Vanilla", "Novice", "Adept", "Expert", "Elite", "Hardcore", "Insane" }), new object[1] { IsAdminOnly })); WeakerCreatureSpawnRate = config.Bind<int>("(Difficulty)", GenerateConfigKey("WeakerCreatureSpawnRate", "%"), 100, new ConfigDescription("Determines the spawn rate of creatures specified in the list below (for non-events only). The higher the value, the more computing power it will require. A value of '250%' would mean two guaranteed spawns plus 50% chance for a third spawn.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(100, 500), new object[1] { IsAdminOnly })); string text = GenerateConfigKey("WeakerCreaturesList"); object[] array = new object[1]; ConfigurationManagerAttributes val = new ConfigurationManagerAttributes(); val.IsAdminOnly = true; val.CustomDrawer = TextAreaDrawer; array[0] = val; WeakerCreaturesList = config.Bind<string>("(Difficulty)", text, "Greydwarf,Skeleton,Draugr,Wolf,Goblin,Tick,Seeker,Charred_Archer,Charred_Melee,Charred_Twitcher", new ConfigDescription("Names of the prefabs separated by comma.", (AcceptableValueBase)null, array)); EnableMod = config.Bind<bool>("(General)", GenerateConfigKey("EnableMod"), true, new ConfigDescription("Determines if the mod should run at all. The game (server/client) must be restarted in order for the settings to take effect.", (AcceptableValueBase)null, new object[1] { IsAdminOnly })); EnablePassiveSpecialEffects = config.Bind<bool>("(General)", GenerateConfigKey("EnablePassiveSpecialEffects"), true, "Enables passive special effects on your character, such as continuous lightning effects on Thor or fire on Surtr. Does not apply to active effects or abilities."); EnablePvpForAbilities = config.Bind<bool>("(General)", GenerateConfigKey("EnablePvpForAbilities"), true, new ConfigDescription("Offensive abilities will be taken into account on player versus player (pvp).", (AcceptableValueBase)null, new object[1] { IsAdminOnly })); EnhanceAttackAngle = config.Bind<bool>("(General)", GenerateConfigKey("EnhanceAttackAngle"), true, "Allows your vertical looking angle (up and down) to affect the angle of your melee attacks, meaning that you can hit things slightly below or above you depending which angle you are facing. This is nearly a MUST for Fenrir to be able to hit logs. Inspired by the 'Slope Combat Fix' mod by flppyflip3."); EnhanceCompatibilityWithModAgility = config.Bind<bool>("(General)", GenerateConfigKey("EnhanceCompatibilityWithModAgility"), true, new ConfigDescription("Enhance compatibility with mod Agility by invalidating the jump force modifier from that mod. Without this option enabled, double jump will not work. Disable in case of issues.", (AcceptableValueBase)null, new object[1] { IsAdminOnly })); EnhanceCompatibilityWithModWarfare = config.Bind<bool>("(General)", GenerateConfigKey("EnhanceCompatibilityWithModWarfare"), true, new ConfigDescription("Enhance compatibility with mod Warfare by rebalancing some overpowered special attacks from that mod, so that they do not make AoE abilities from Norse demigods practically obsolete. Disable in case of issues.", (AcceptableValueBase)null, new object[1] { IsAdminOnly })); ProtectPiecesCoveredByWard = config.Bind<bool>("(General)", GenerateConfigKey("ProtectPiecesCoveredByWard"), false, new ConfigDescription("Prevent damage caused by players to pieces (buildings) protected by a ward.", (AcceptableValueBase)null, new object[1] { IsAdminOnly })); HotkeyAbilityA = config.Bind<KeyboardShortcut>("(Hotkeys)", GenerateConfigKey("HotkeyAbilityA"), new KeyboardShortcut((KeyCode)327, Array.Empty<KeyCode>()), "Hotkey for the primary ability. Examples: Mouse 0, Mouse 1, Q, C, LeftShift + Q, LeftShift + Alpha1. It is recommended that you use a configuration manager mod to easily change the hotkey in-game."); HotkeyAbilityB = config.Bind<KeyboardShortcut>("(Hotkeys)", GenerateConfigKey("HotkeyAbilityB"), new KeyboardShortcut((KeyCode)326, Array.Empty<KeyCode>()), "Hotkey for the secondary ability. Examples: Mouse 0, Mouse 1, Q, C, LeftShift + Q, LeftShift + Alpha1. It is recommended that you use a configuration manager mod to easily change the hotkey in-game."); HotkeyAbilityC = config.Bind<KeyboardShortcut>("(Hotkeys)", GenerateConfigKey("HotkeyAbilityC"), new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>()), "Hotkey for the tertiary ability. If none, the default hotkey will be set to 'Hotkey Ability A' + Blocking. It is recommended that you use a configuration manager mod to easily change the hotkey in-game."); HotkeyAbilityD = config.Bind<KeyboardShortcut>("(Hotkeys)", GenerateConfigKey("HotkeyAbilityD"), new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>()), "Hotkey for the quaternary ability. If none, the default hotkey will be set to 'Hotkey Ability B' + Blocking. It is recommended that you use a configuration manager mod to easily change the hotkey in-game."); HotkeyAbilityTeleport = config.Bind<KeyboardShortcut>("(Hotkeys)", GenerateConfigKey("HotkeyAbilityTeleport"), new KeyboardShortcut((KeyCode)112, Array.Empty<KeyCode>()), "Hotkey for the teleport ability. Examples: Mouse 0, Mouse 1, Q, C, LeftShift + Q, LeftShift + Alpha1. It is recommended that you use a configuration manager mod to easily change the hotkey in-game."); HotkeyIgnoreSpecialAttack = config.Bind<KeyboardShortcut>("(Hotkeys)", GenerateConfigKey("HotkeyIgnoreSpecialAttack"), new KeyboardShortcut((KeyCode)308, Array.Empty<KeyCode>()), "Hotkey used to ignore the demigod's special attack, performing the original (game default) special attack instead. It is recommended that you use a configuration manager mod to easily change the hotkey in-game."); EnergyAtBaseLevel = config.Bind<int>("Energy", GenerateConfigKey("EnergyAtBaseLevel"), 2, new ConfigDescription("Determines the maximum energy the player will have at demigod's zero skill level.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), new object[1] { IsAdminOnly })); EnergyAtMaxLevel = config.Bind<int>("Energy", GenerateConfigKey("EnergyAtMaxLevel"), 12, new ConfigDescription("Determines the maximum energy the player will have at demigod's maximum skill level.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 20), new object[1] { IsAdminOnly })); EnergyRegenerationPeriod = config.Bind<int>("Energy", GenerateConfigKey("EnergyRegenerationPeriod", "seconds"), 10, new ConfigDescription("Determines how often, in seconds, one energy point is passively regenerated. Enter '0' in order to disable this feature.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 30), new object[1] { IsAdminOnly })); FenrisArmorSetGrantedArmor = config.Bind<int>("Enhanced Armor Set Fenris", GenerateConfigKey("FenrisArmorSetGrantedArmor"), 28, new ConfigDescription("Provides additional armor to Fenrir when wearing the full set.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(18, 38), new object[1] { IsAdminOnly })); FenrisArmorBonusMovementSpeed = config.Bind<int>("Enhanced Armor Set Fenris", GenerateConfigKey("FenrisArmorBonusMovementSpeed", "%"), 5, new ConfigDescription("Determines the additional movement speed granted by a single armor piece (excluding the helmet). Default game value = 3% per piece (including the helmet).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 10), new object[1] { IsAdminOnly })); InfusedMegingjordCostItemName = config.Bind<string>("Enhanced Megingjord", GenerateConfigKey("InfusedMegingjordCostItemName"), "Thunderstone", new ConfigDescription("The name of the required item to forge an Infused Megingjord.", (AcceptableValueBase)null, new object[1] { IsAdminOnly })); InfusedMegingjordCostItemQuantity = config.Bind<int>("Enhanced Megingjord", GenerateConfigKey("InfusedMegingjordCostItemQuantity"), 20, new ConfigDescription("The amount of the required item to forge an Infused Megingjord.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(20, 100), new object[1] { IsAdminOnly })); InfusedMegingjordIncreasedEnergy = config.Bind<int>("Enhanced Megingjord", GenerateConfigKey("InfusedMegingjordIncreasedEnergy"), 3, new ConfigDescription("The amount of extra energy the wearer of an Infused Megingjord will have.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 10), new object[1] { IsAdminOnly })); InfusedMegingjordIncreasedMaxWeight = config.Bind<int>("Enhanced Megingjord", GenerateConfigKey("InfusedMegingjordIncreasedMaxWeight"), 300, new ConfigDescription("The amount of extra weight the wearer of an Infused Megingjord will be able to carry.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(200, 500), new object[1] { IsAdminOnly })); EnableHarpoonFishing = config.Bind<bool>("Harpoon Fishing", GenerateConfigKey("EnableHarpoonFishing"), true, new ConfigDescription("Enables fishing with an Abyssal harpoon.", (AcceptableValueBase)null, new object[1] { IsAdminOnly })); HarpoonMaxQuality = config.Bind<int>("Harpoon Fishing", GenerateConfigKey("HarpoonMaxQuality"), 3, new ConfigDescription("Abyssal harpoon's max quality, which can be upgraded at the crafting station. Game default value = 1.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 5), new object[1] { IsAdminOnly })); HarpoonProjectileCollisionRadius = config.Bind<float>("Harpoon Fishing", GenerateConfigKey("HarpoonProjectileCollisionRadius"), 0.3f, new ConfigDescription("Abyssal harpoon's projectile's collision base radius, making it easier to catch fish. Game default value = 0.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.5f), new object[1] { IsAdminOnly })); HarpoonUpgradeChitinPerLevel = config.Bind<int>("Harpoon Fishing", GenerateConfigKey("HarpoonUpgradeChitinPerLevel"), 15, new ConfigDescription("Chitin required to upgrade an Abyssal harpoon. The amount doubles with every upgrade. Game default value = 0.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(5, 30), new object[1] { IsAdminOnly })); HarpoonUpgradeDurabilityPerLevel = config.Bind<int>("Harpoon Fishing", GenerateConfigKey("HarpoonUpgradeDurabilityPerLevel"), 25, new ConfigDescription("Abyssal harpoon's durability increase per upgrade. Game default value = 0.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 50), new object[1] { IsAdminOnly })); IgnoreBeehiveProximityCheck = config.Bind<bool>("Honey", GenerateConfigKey("IgnoreBeehiveProximityCheck"), false, new ConfigDescription("Ignore beehive proximity check, meaning bees will not require any extra space to be happy. Disable in case of issues.", (AcceptableValueBase)null, new object[1] { IsAdminOnly })); MaxHoneyProducedByBeehive = config.Bind<int>("Honey", GenerateConfigKey("MaxHoneyProducedByBeehive"), 4, new ConfigDescription("Determines the maximum amount of honey a beehive can produce before it becomes full. Default game value = 4.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(4, 10), new object[1] { IsAdminOnly })); QueenBeeSpawnChance = config.Bind<int>("Honey", GenerateConfigKey("QueenBeeSpawnChance", "%"), 0, new ConfigDescription("Determines the chance, in percentage, of spawning a queen bee per honey extracted from a beehive. Default game value = 0%.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { IsAdminOnly })); EnableCustomMerchantItems = config.Bind<bool>("Merchant", GenerateConfigKey("EnableCustomMerchantItems"), false, new ConfigDescription("Enables the selling of additional items by the merchant (Haldor).", (AcceptableValueBase)null, new object[1] { SetOrder(2) })); FindClosestMerchants = config.Bind<bool>("Merchant", GenerateConfigKey("FindClosestMerchants"), false, new ConfigDescription("Pins the closest merchants on the map on spawn.", (AcceptableValueBase)null, new object[1] { SetOrder(1) })); AbyssalHarpoonPrice = config.Bind<int>("Merchant", GenerateConfigKey("AbyssalHarpoonPrice"), 350, new ConfigDescription("Amount of coins required to buy an Abyssal Harpoon from the merchant. Enter '0' to disable trading this item.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), new object[1] { IsAdminOnly })); QueenBeePrice = config.Bind<int>("Merchant", GenerateConfigKey("QueenBeePrice"), 150, new ConfigDescription("Amount of coins required to buy a Bee Queen from the merchant. Enter '0' to disable trading this item.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 500), new object[1] { IsAdminOnly })); RunestoneSpawnAtStart = config.Bind<bool>("Runestone", GenerateConfigKey("RunestoneSpawnAtStart"), true, new ConfigDescription("Place a runestone in the player's inventory at start. If disabled, the player will have to craft the item to pick a demigod.", (AcceptableValueBase)null, new object[1] { SetOrder(0) })); RunestoneConsumable = config.Bind<bool>("Runestone", GenerateConfigKey("RunestoneConsumable"), false, new ConfigDescription("Consume runestone when used.", (AcceptableValueBase)null, new object[1] { SetOrder(-1) })); RunestoneCraftingRecipe = config.Bind<string>("Runestone", GenerateConfigKey("RunestoneCraftingRecipe"), "Stone:1,Resin:1", new ConfigDescription("Resources and amounts required for crafting a runestone. Format: prefab1:quantity1,prefab2:quantity2,(...)", (AcceptableValueBase)null, new object[1] { SetOrder(-2) })); SkillDemigodExperienceModifier = config.Bind<int>("Skills", GenerateConfigKey("SkillDemigodExperienceModifier", "%"), 100, new ConfigDescription("Modifier, in percentage, to demigod's skill points gained overall.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(20, 500), new object[1] { SetOrder(2) })); LevelsLostWhenSwitchingDemigod = config.Bind<int>("Skills", GenerateConfigKey("LevelsLostWhenSwitchingDemigod"), 5, new ConfigDescription("Demigod's skill levels lost when switching demigods.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { (object)new ConfigurationManagerAttributes { Order = 1, IsAdminOnly = true, ShowRangeAsPercent = false } })); EnableSkillLossOnDeath = config.Bind<bool>("Skills", GenerateConfigKey("EnableSkillLossOnDeath"), false, new ConfigDescription("Enable loss of the demigod skill (level) on death.", (AcceptableValueBase)null, new object[1] { IsAdminOnly })); EnableSkillDemigodCap = config.Bind<bool>("Skills", GenerateConfigKey("EnableSkillDemigodCap"), true, new ConfigDescription("Demigod's skill is capped based on the highest-level defeated boss.", (AcceptableValueBase)null, new object[1] { IsAdminOnly })); for (int i = 0; i < SkillDemigodCapSettings.Length; i++) { SkillDemigodCap.Add(GenerateDemigodSkillCapConfigEntry(config, SkillDemigodCapSettings[i], -i - 1)); } EnableTeleportAbility = config.Bind<bool>("Teleportation", GenerateConfigKey("EnableTeleportAbility"), true, new ConfigDescription("Enables the teleport ability for all demigods. Can be used to teleport the player to bed, and back to the previous saved location before teleporting to bed.", (AcceptableValueBase)null, new object[1] { IsAdminOnly })); IgnoreNonTeleportableItems = config.Bind<bool>("Teleportation", GenerateConfigKey("IgnoreNonTeleportableItems"), false, new ConfigDescription("Ignore non-teleportable items such as ore, allowing them to be carried over. This setting is irrelevant in case of no overall restrictions by a world modifier or another mod.", (AcceptableValueBase)null, new object[1] { IsAdminOnly })); WeakerCreaturesListSettingChanged(null, null); CustomUI.SetupConfigs(config, "User Interface"); Type[] entities = GetEntities(); Type[] array2 = entities; foreach (Type type in array2) { type.GetMethod("SetupConfigs", BindingFlags.Static | BindingFlags.NonPublic).Invoke(type, new object[2] { config, GenerateConfigKey(type.Name) }); } if (AutomaticallyUpdateConfigs.Value && ModVersion.Value != "1.4.7") { ResetMainSettings(); } ModVersion.Value = "1.4.7"; WeakerCreaturesList.SettingChanged += WeakerCreaturesListSettingChanged; config.SettingChanged += Config_SettingChanged; } private static void WeakerCreaturesListSettingChanged(object sender, EventArgs e) { if (Helper.StringToList(WeakerCreaturesList.Value, ref WeakerCreaturesListPrefabs)) { Logger.LogInfo((object)string.Format("Config entry '{0}' parsed successfully.", "WeakerCreaturesList")); } else { Logger.LogError((object)string.Format("Could not parse config entry '{0}'.", "WeakerCreaturesList")); } } public static Type[] GetEntities() { return (from t in Assembly.GetExecutingAssembly().GetTypes() where t.IsClass && !t.IsNested && (t.Namespace == "NorseDemigods.Abilities" || t.Namespace == "NorseDemigods.Attributes" || t.Namespace == "NorseDemigods.Demigods") select t).ToArray(); } public static string GenerateConfigKey(string key) { return GenerateConfigKey(key, null); } public static string GenerateConfigKey(string key, string unit) { key = string.Concat(key.Select((char x) => char.IsUpper(x) ? (" " + x) : x.ToString())).TrimStart(new char[1] { ' ' }); if (!string.IsNullOrEmpty(unit)) { key += $" ({unit})"; } return key; } public static ConfigEntry<int> GenerateDemigodSkillCapConfigEntry(ConfigFile config, SkillDemigodCapStruct skillDemigodCapSetting, int order) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown return config.Bind<int>("Skills", string.Format("Skill Demigod Cap {0}", GenerateConfigKey(skillDemigodCapSetting.BossName.Replace(" ", ""))), skillDemigodCapSetting.SkillCap, new ConfigDescription("Caps level progression with demigod's skill (to the given number) based on the highest defeated boss. Enter '0' to remove the cap.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { SetOrder(order) })); } public static ConfigurationManagerAttributes SetOrder(int order, bool isAdvanced = false, bool isAdminOnly = true) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown return new ConfigurationManagerAttributes { Order = order, IsAdvanced = isAdvanced, IsAdminOnly = isAdminOnly }; } public static void ResetMainSettings() { Type[] entities = GetEntities(); Type[] array = entities; foreach (Type type in array) { FieldInfo[] fields = type.GetFields(BindingFlags.Static | BindingFlags.NonPublic); FieldInfo[] array2 = fields; foreach (FieldInfo fieldInfo in array2) { if (fieldInfo.FieldType.Name.Contains("ConfigEntry")) { object value = fieldInfo.GetValue(type); value.GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public).SetValue(value, value.GetType().GetProperty("DefaultValue", BindingFlags.Instance | BindingFlags.Public).GetValue(value)); } } } } public static void TextAreaDrawer(ConfigEntryBase entry) { GUILayout.ExpandHeight(true); GUILayout.ExpandWidth(true); entry.BoxedValue = GUILayout.TextArea((string)entry.BoxedValue, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); } private static void Config_SettingChanged(object sender, SettingChangedEventArgs e) { if (e.ChangedSetting.Definition.Section != "(Hotkeys)" && !(e.ChangedSetting.Definition.Section != "User Interface")) { } } } public static class CustomUI { public static readonly Dictionary<string, Vector2> Anchors = new Dictionary<string, Vector2> { { "Upper-left", new Vector2(0f, 1f) }, { "Upper-mid", new Vector2(0.5f, 1f) }, { "Upper-right", new Vector2(1f, 1f) }, { "Middle-left", new Vector2(0f, 0.5f) }, { "Middle-center", new Vector2(0.5f, 0.5f) }, { "Middle-right", new Vector2(1f, 0.5f) }, { "Lower-left", new Vector2(0f, 0f) }, { "Lower-center", new Vector2(0.5f, 0f) }, { "Lower-right", new Vector2(1f, 0f) } }; private static GameObject RunestoneMenuPanel; private static Text RunestoneMenuText; private static int RunestoneMenuPage; private static GameObject RunestoneMenuConfirmationDialogPanel; public static RectTransform EnergyMeterRect; public static RectTransform MinionMeterRect; public static RectTransform NeckMeterRect; public static RectTransform WolfMeterRect; public static Slider EnergyMeterSlider; public static Slider MinionMeterSlider; public static Slider NeckMeterSlider; public static Slider WolfMeterSlider; public static Text EnergyMeterText; public static Text MinionMeterText; public static Text NeckMeterText; public static Text WolfMeterText; public static float EnergyMeterHeightOffset; private static ConfigEntry<bool> EnableMeters; private static ConfigEntry<string> EnergyMeterAnchor; private static ConfigEntry<Vector2> EnergyMeterPosition; private static ConfigEntry<Vector2> EnergyMeterScale; private static ConfigEntry<Color> EnergyMeterTextColor; private static ConfigEntry<string> PetHealthMeterAnchor; private static ConfigEntry<Vector2> PetHealthMeterPosition; private static ConfigEntry<Vector2> PetHealthMeterScale; private static ConfigEntry<Color> PetHealthMeterTextColor; public static Player Owner { get; private set; } public static void SetupConfigs(ConfigFile config, string category) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) AcceptableValueList<string> val = new AcceptableValueList<string>(Anchors.Keys.ToArray()); EnableMeters = config.Bind<bool>(category, Configs.GenerateConfigKey("EnableMeters"), true, "Enables the custom user interface with additional elements such as the energy meter. Disable it in case of compatibility issues."); EnergyMeterAnchor = config.Bind<string>(category, Configs.GenerateConfigKey("EnergyMeterAnchor"), "Lower-left", new ConfigDescription("Defines the starting point of the user interface element.", (AcceptableValueBase)(object)val, Array.Empty<object>())); EnergyMeterPosition = config.Bind<Vector2>(category, Configs.GenerateConfigKey("EnergyMeterPosition"), new Vector2(360f, 186f), "Defines the position of the user interface element."); EnergyMeterScale = config.Bind<Vector2>(category, Configs.GenerateConfigKey("EnergyMeterScale"), new Vector2(0.65f, 0.65f), "Defines the scale of the user interface element."); EnergyMeterTextColor = config.Bind<Color>(category, Configs.GenerateConfigKey("EnergyMeterTextColor"), new Color(0.75f, 1f, 1f, 0.75f), "Defines the text color of the user interface element."); PetHealthMeterAnchor = config.Bind<string>(category, Configs.GenerateConfigKey("PetHealthMeterAnchor"), "Lower-left", new ConfigDescription("Defines the starting point of the user interface element.", (AcceptableValueBase)(object)val, Array.Empty<object>())); PetHealthMeterPosition = config.Bind<Vector2>(category, Configs.GenerateConfigKey("PetHealthMeterPosition"), new Vector2(495f, 186f), "Defines the position of the user interface element."); PetHealthMeterScale = config.Bind<Vector2>(category, Configs.GenerateConfigKey("PetHealthMeterScale"), new Vector2(0.65f, 0.65f), "Defines the scale of the user interface element."); PetHealthMeterTextColor = config.Bind<Color>(category, Configs.GenerateConfigKey("PetHealthMeterTextColor"), new Color(0.75f, 1f, 1f, 0.75f), "Defines the text color of the user interface element."); } public static void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Scene scene = GUIManager.CustomGUIBack.scene; if (!(((Scene)(ref scene)).name != "main")) { BuildRunestoneMenu(); BuildRunestoneMenuConfirmationDialog(); } } public static void Setup(Player player) { Owner = player; } private static void BuildRunestoneMenu() { //IL_002c: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0292: 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) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Expected O, but got Unknown //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Expected O, but got Unknown float num = 1600f; float num2 = 900f; float num3 = 20f; RunestoneMenuPanel = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), num, num2, true); GameObject val = CreateImage(Resources.WallpaperRunestoneMenu, RunestoneMenuPanel.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), Vector2.zero, new Color(1f, 1f, 1f, 0.15f), num, num2); GameObject val2 = GUIManager.Instance.CreateText(NorseDemigods.Localization.TryTranslate("$runestone_menu_panel_title"), RunestoneMenuPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, 0f - num3), GUIManager.Instance.AveriaSerifBold, 24, GUIManager.Instance.ValheimOrange, true, Color.black, num - num3 * 2f, 100f, false); val2.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 1f); val2.GetComponent<Text>().alignment = (TextAnchor)1; GameObject val3 = GUIManager.Instance.CreateDropDown(RunestoneMenuPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -55f), 18, 300f, 30f); val3.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 1f); Dropdown component = val3.GetComponent<Dropdown>(); component.template.sizeDelta = new Vector2(0f, 300f); component.AddOptions((from x in Demigod.DemigodDefaults where !x.Hidden select NorseDemigods.Localization.TryTranslate($"$demigod_{x.Name.ToLower()}_name")).ToList()); ((UnityEvent<int>)(object)component.onValueChanged).AddListener((UnityAction<int>)RunestoneMenuUpdatePage); GameObject val4 = GUIManager.Instance.CreateText(string.Empty, RunestoneMenuPanel.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(num3, -120f), GUIManager.Instance.AveriaSerif, 16, Color.white, false, Color.black, num - num3 * 2f, num2 - num3 - 120f - 50f - 20f, false); val4.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f); val4.GetComponent<Text>().resizeTextForBestFit = true; RunestoneMenuText = val4.GetComponent<Text>(); GameObject val5 = GUIManager.Instance.CreateButton(NorseDemigods.Localization.TryTranslate("$runestone_menu_choose_button_label"), RunestoneMenuPanel.transform, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(num3, num3), num - num3 * 2f, 50f); val5.GetComponent<RectTransform>().pivot = new Vector2(0f, 0f); ((UnityEvent)val5.GetComponent<Button>().onClick).AddListener(new UnityAction(RunestoneMenuChooseDemigod)); GameObject val6 = GUIManager.Instance.CreateButton("X", RunestoneMenuPanel.transform, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-25f, -25f), 40f, 40f); ((UnityEvent)val6.GetComponent<Button>().onClick).AddListener(new UnityAction(RunestoneMenuClose)); RunestoneMenuUpdatePage(0); RunestoneMenuPanel.SetActive(false); } private static void BuildRunestoneMenuConfirmationDialog() { //IL_002c: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: