Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ExperienceSystem v0.3.0
BepInEx/plugins/ExperienceSystem/ExperienceSystem.dll
Decompiled 4 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExperienceSystem.Compat; using ExperienceSystem.Config; using ExperienceSystem.Elements; using ExperienceSystem.Localization; using ExperienceSystem.Patches; using ExperienceSystem.Progression; using ExperienceSystem.Skills; using ExperienceSystem.StatusEffects; using ExperienceSystem.Ui; using ExperienceSystem.Vfx; using HarmonyLib; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("ExperienceSystem")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Clean-room leveling, skills and elemental reactions for Valheim 1.0.15.")] [assembly: AssemblyFileVersion("0.3.0.0")] [assembly: AssemblyInformationalVersion("0.3.0")] [assembly: AssemblyProduct("ExperienceSystem")] [assembly: AssemblyTitle("ExperienceSystem")] [assembly: AssemblyVersion("0.3.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ExperienceSystem { internal static class ApiProbe { private static void DamageTypes(HitData hit) { //IL_0090: 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) hit.m_damage.m_fire += 1f; hit.m_damage.m_frost += 1f; hit.m_damage.m_lightning += 1f; hit.m_damage.m_poison += 1f; hit.m_damage.m_spirit += 1f; hit.m_damage.m_blunt += 1f; ((DamageTypes)(ref hit.m_damage)).Modify(1f); hit.GetAttacker(); _ = hit.m_point; _ = hit.m_hitType; } private static void StatusEffects(Character character) { SEMan sEMan = character.GetSEMan(); sEMan.HaveStatusEffect(StringExtensionMethods.GetStableHashCode("Wet")); StatusEffect statusEffect = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("Burning")); if ((Object)(object)statusEffect != (Object)null) { sEMan.AddStatusEffect(statusEffect, true, 0, 0f, (short)(-1)); } sEMan.RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("Frost"), true); } private static void Equipment(Player player) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) VisEquipment componentInChildren = ((Component)player).GetComponentInChildren<VisEquipment>(); _ = componentInChildren.m_rightHand; _ = componentInChildren.m_leftHand; _ = ((Humanoid)player).GetCurrentWeapon()?.m_shared.m_damages; ((Character)player).IsOnGround(); ((Character)player).IsOwner(); } private static void Networking(Player player) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) ZDOID uid = ((Component)player).GetComponent<ZNetView>().GetZDO().m_uid; ZRoutedRpc.instance.InvokeRoutedRPC(0L, "ExperienceSystem_Probe", new object[1] { uid }); } private static void Physics(Rigidbody body) { //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_0008: Unknown result type (might be due to invalid IL or missing references) Vector3 linearVelocity = body.linearVelocity; body.linearVelocity = linearVelocity; } private static void Particles(GameObject host) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) ParticleSystem obj = host.AddComponent<ParticleSystem>(); MainModule main = obj.main; ((MainModule)(ref main)).startColor = new MinMaxGradient(Color.red, Color.yellow); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = obj.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(40f); ShapeModule shape = obj.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)5; Light obj2 = host.AddComponent<Light>(); obj2.type = (LightType)2; obj2.renderMode = (LightRenderMode)1; obj2.shadows = (LightShadows)0; } } [BepInPlugin("com.vladislav.experiencesystem", "ExperienceSystem", "0.3.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "com.vladislav.experiencesystem"; public const string Name = "ExperienceSystem"; public const string Version = "0.3.0"; private readonly Harmony _harmony = new Harmony("com.vladislav.experiencesystem"); internal static ManualLogSource Log { get; private set; } internal static ModConfig Settings { get; private set; } private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Settings = new ModConfig(((BaseUnityPlugin)this).Config); _harmony.PatchAll(typeof(Plugin).Assembly); ModLocalization.Register(); SecondLifeCooldown.Register(); UiController.Initialize(); Log.LogInfo((object)"ExperienceSystem 0.3.0 loaded."); } private void OnDestroy() { UiController.Shutdown(); SkillIcons.Dispose(); InterfaceArt.Dispose(); _harmony.UnpatchSelf(); } } } namespace ExperienceSystem.Vfx { internal sealed class AuraVisual : MonoBehaviour { private const float RefreshInterval = 0.3f; private Character _character; private ElementalState _state; private GameObject _current; private Element _shown; private float _nextRefresh; private void Awake() { _character = ((Component)this).GetComponent<Character>(); _state = ElementalState.Get(_character); } private void OnDestroy() { Clear(); } private void Update() { //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) if (Time.time < _nextRefresh) { return; } _nextRefresh = Time.time + 0.3f; ModConfig settings = Plugin.Settings; if (settings == null || !settings.ModEnabled.Value || !settings.AuraVfxEnabled.Value) { Clear(); return; } if ((Object)(object)_character == (Object)null || _character.IsDead() || (Object)(object)_state == (Object)null) { Clear(); return; } Element dominantAura = _state.DominantAura; if (dominantAura != _shown || (!((Object)(object)_current != (Object)null) && dominantAura != Element.None)) { Clear(); _shown = dominantAura; if (dominantAura != Element.None) { float num = Mathf.Clamp(_character.GetHeight(), 0.6f, 6f); float num2 = Mathf.Clamp(_character.GetRadius(), 0.2f, 3f); Vector3 area = default(Vector3); ((Vector3)(ref area))..ctor(num2 * 2f, num * 0.8f, num2 * 2f); _current = ElementalVfx.CreateAura(((Component)this).transform, dominantAura, area, Mathf.Clamp(num * 0.5f, 0.5f, 2.2f)); _current.transform.localPosition = Vector3.up * (num * 0.5f); } } } private void Clear() { if ((Object)(object)_current != (Object)null) { Object.Destroy((Object)(object)_current); _current = null; } _shown = Element.None; } public static void Ensure(Character character) { if ((Object)(object)character != (Object)null && (Object)(object)((Component)character).GetComponent<AuraVisual>() == (Object)null) { ((Component)character).gameObject.AddComponent<AuraVisual>(); } } } internal static class ElementalVfx { private static Material _softMaterial; private static Material _sharpMaterial; private static Texture2D _softTexture; private static Texture2D _sharpTexture; public static GameObject CreateAura(Transform parent, Element element, Vector3 area, float scale) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_009e: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) ElementInfo elementInfo = ElementInfo.Of(element); ElementVisualProfile elementVisualProfile = ElementVisualProfile.Of(element); GameObject val = new GameObject("ES Aura " + element); val.transform.SetParent(parent, false); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; val.transform.localScale = Vector3.one; BuildLayer(val.transform, "Core", elementInfo, elementVisualProfile, area, scale, 1f, 1f, 0.85f, elementVisualProfile.Sharp); BuildLayer(val.transform, "Glow", elementInfo, elementVisualProfile, area, scale * 1.6f, 2.2f, 0.35f, 0.25f, sharp: false); BuildLayer(val.transform, "Motes", elementInfo, elementVisualProfile, area, scale, 0.45f, 0.3f, 1f, sharp: true); GameObject val2 = new GameObject("Light"); val2.transform.SetParent(val.transform, false); Light val3 = val2.AddComponent<Light>(); val3.type = (LightType)2; val3.color = elementInfo.Color; val3.range = elementVisualProfile.LightRange * scale; val3.intensity = elementVisualProfile.LightIntensity; val3.shadows = (LightShadows)0; val3.renderMode = (LightRenderMode)2; val.AddComponent<LightFlicker>().Initialize(val3, elementVisualProfile.LightIntensity, elementVisualProfile.FlickerSpeed); return val; } public static void PlayLevelUp(Transform player) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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) if (!((Object)(object)player == (Object)null)) { GameObject val = new GameObject("ES LevelUp"); val.transform.SetParent(player, false); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.82f, 0.35f); Color val3 = default(Color); ((Color)(ref val3))..ctor(1f, 0.97f, 0.82f); BuildLevelUpRing(val.transform, val2, val3, 1.15f, 90, 3.4f, 0.2f, sharp: false); BuildLevelUpRing(val.transform, val3, Color.white, 0.75f, 45, 4.6f, 0.1f, sharp: true); GameObject val4 = new GameObject("Light"); val4.transform.SetParent(val.transform, false); val4.transform.localPosition = Vector3.up; Light val5 = val4.AddComponent<Light>(); val5.type = (LightType)2; val5.color = val2; val5.range = 7f; val5.intensity = 2.2f; val5.shadows = (LightShadows)0; val5.renderMode = (LightRenderMode)2; val.AddComponent<LightFade>().Initialize(val5, 1.4f); Object.Destroy((Object)(object)val, 3f); } } private static void BuildLevelUpRing(Transform parent, Color core, Color glow, float radius, int count, float rise, float size, bool sharp) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0046: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) ParticleSystem val = CreateParticleSystem(parent, "Ring", sharp); MainModule main = val.main; ((MainModule)(ref main)).duration = 0.6f; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.9f, 1.5f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startSize = new MinMaxCurve(size * 0.6f, size); ((MainModule)(ref main)).startColor = Gradient(core, glow, 1f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)0; ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.05f); ((MainModule)(ref main)).maxParticles = 200; EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)count) }); ShapeModule shape = val.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10; ((ShapeModule)(ref shape)).radius = radius; ((ShapeModule)(ref shape)).radiusThickness = 0f; ((ShapeModule)(ref shape)).arc = 360f; ((ShapeModule)(ref shape)).rotation = new Vector3(-90f, 0f, 0f); VelocityOverLifetimeModule velocityOverLifetime = val.velocityOverLifetime; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = new MinMaxCurve(rise * 0.6f, rise); SizeOverLifetimeModule sizeOverLifetime = val.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.EaseInOut(0f, 1f, 1f, 0f)); val.Play(); } public static void PlayReaction(Vector3 point, Reaction reaction) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00bd: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_01a9: Unknown result type (might be due to invalid IL or missing references) GetReactionLook(reaction, out var color, out var glow, out var size, out var sharp); GameObject val = new GameObject("ES Reaction " + reaction); val.transform.position = point; ParticleSystem val2 = CreateParticleSystem(val.transform, "Burst", sharp); MainModule main = val2.main; ((MainModule)(ref main)).duration = 0.4f; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.25f, 0.6f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(size * 2f, size * 6f); ((MainModule)(ref main)).startSize = new MinMaxCurve(size * 0.4f, size * 0.9f); ((MainModule)(ref main)).startColor = Gradient(color, glow, 1f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.15f); EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)40) }); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = size * 0.25f; SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.EaseInOut(0f, 1f, 1f, 0f)); val2.Play(); GameObject val3 = new GameObject("Light"); val3.transform.SetParent(val.transform, false); Light val4 = val3.AddComponent<Light>(); val4.type = (LightType)2; val4.color = color; val4.range = 3f * size; val4.intensity = 1.6f; val4.shadows = (LightShadows)0; val4.renderMode = (LightRenderMode)2; val.AddComponent<LightFade>().Initialize(val4, 0.5f); Object.Destroy((Object)(object)val, 2f); } public static Color ColorFor(Reaction reaction) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) GetReactionLook(reaction, out var color, out var _, out var _, out var _); return color; } private static void GetReactionLook(Reaction reaction, out Color color, out Color glow, out float size, out bool sharp) { //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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_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_0123: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) switch (reaction) { case Reaction.IceBound: color = ElementInfo.Of(Element.Frost).Color; glow = Color.white; size = 1.2f; sharp = true; break; case Reaction.Steam: case Reaction.Thaw: case Reaction.Blightfire: color = ElementInfo.Of(Element.Fire).Color; glow = ElementInfo.Of(Element.Fire).GlowColor; size = ((reaction == Reaction.Thaw) ? 1.5f : 1.2f); sharp = false; break; case Reaction.Quench: case Reaction.Rimeshock: color = ElementInfo.Of(Element.Frost).Color; glow = ElementInfo.Of(Element.Frost).GlowColor; size = 1.3f; sharp = true; break; case Reaction.Stormsurge: case Reaction.Thunderclap: case Reaction.RotArc: color = ElementInfo.Of(Element.Lightning).Color; glow = Color.white; size = ((reaction == Reaction.Thunderclap) ? 1.8f : 1.2f); sharp = true; break; case Reaction.Plaguewater: case Reaction.Fumes: color = ElementInfo.Of(Element.Poison).Color; glow = ElementInfo.Of(Element.Poison).GlowColor; size = ((reaction == Reaction.Fumes) ? 1.5f : 1.2f); sharp = false; break; case Reaction.Rimerot: color = ElementInfo.Of(Element.Frost).Color; glow = ElementInfo.Of(Element.Poison).GlowColor; size = 1.3f; sharp = true; break; case Reaction.Hallow: color = ElementInfo.Of(Element.Spirit).Color; glow = Color.white; size = 1.6f; sharp = false; break; case Reaction.Swirl: color = ElementInfo.Of(Element.Spirit).Color; glow = ElementInfo.Of(Element.Spirit).GlowColor; size = 1.4f; sharp = false; break; default: color = Color.white; glow = new Color(0.8f, 0.9f, 1f); size = 1f; sharp = true; break; } } private static void BuildLayer(Transform parent, string name, ElementInfo info, ElementVisualProfile profile, Vector3 area, float scale, float sizeScale, float rateScale, float alpha, bool sharp) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0076: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) ParticleSystem val = CreateParticleSystem(parent, name, sharp); MainModule main = val.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(profile.Lifetime); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(profile.StartSpeed * 0.5f, profile.StartSpeed); ((MainModule)(ref main)).startSize = new MinMaxCurve(profile.StartSize * sizeScale * scale * 0.7f, profile.StartSize * sizeScale * scale); ((MainModule)(ref main)).startColor = Gradient(info.Color, info.GlowColor, alpha); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(profile.Gravity); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)0; ((MainModule)(ref main)).maxParticles = 120; EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(profile.EmissionRate * rateScale); ShapeModule shape = val.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)5; ((ShapeModule)(ref shape)).scale = area; if (profile.Turbulence > 0f) { NoiseModule noise = val.noise; ((NoiseModule)(ref noise)).enabled = true; ((NoiseModule)(ref noise)).strength = MinMaxCurve.op_Implicit(profile.Turbulence); ((NoiseModule)(ref noise)).frequency = 1.5f; ((NoiseModule)(ref noise)).scrollSpeed = MinMaxCurve.op_Implicit(profile.Turbulence); } SizeOverLifetimeModule sizeOverLifetime = val.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.EaseInOut(0f, 1f, 1f, 0f)); val.Play(); } private static ParticleSystem CreateParticleSystem(Transform parent, string name, bool sharp) { //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_0013: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); val2.Stop(); ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); component.renderMode = (ParticleSystemRenderMode)0; ((Renderer)component).material = GetMaterial(sharp); ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component).receiveShadows = false; ((Renderer)component).sortingOrder = 1; return val2; } private static MinMaxGradient Gradient(Color core, Color glow, float alpha) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) Gradient val = new Gradient(); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[3] { new GradientColorKey(glow, 0f), new GradientColorKey(core, 0.45f), new GradientColorKey(core * 0.4f, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(alpha, 0.2f), new GradientAlphaKey(0f, 1f) }); return new MinMaxGradient(val); } private static Material GetMaterial(bool sharp) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) if (sharp && (Object)(object)_sharpMaterial != (Object)null) { return _sharpMaterial; } if (!sharp && (Object)(object)_softMaterial != (Object)null) { return _softMaterial; } Shader val = Shader.Find("Legacy Shaders/Particles/Additive") ?? Shader.Find("Particles/Standard Unlit") ?? Shader.Find("Sprites/Default"); if ((Object)(object)val == (Object)null) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)"No usable particle shader found; elemental visuals disabled."); } return null; } Material val2 = new Material(val) { name = (sharp ? "ES Sharp Particle" : "ES Soft Particle"), mainTexture = (Texture)(object)GetTexture(sharp), color = Color.white, hideFlags = (HideFlags)61 }; if (val2.HasProperty("_TintColor")) { val2.SetColor("_TintColor", Color.white); } if (sharp) { _sharpMaterial = val2; } else { _softMaterial = val2; } return val2; } private static Texture2D GetTexture(bool sharp) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) if (sharp && (Object)(object)_sharpTexture != (Object)null) { return _sharpTexture; } if (!sharp && (Object)(object)_softTexture != (Object)null) { return _softTexture; } float num = (sharp ? 4.5f : 1.8f); Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false) { name = (sharp ? "ES Spark" : "ES Soft"), wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1, hideFlags = (HideFlags)61 }; Color32[] array = (Color32[])(object)new Color32[4096]; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num2 = ((float)j - 31.5f) / 31.5f; float num3 = ((float)i - 31.5f) / 31.5f; float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3); byte b = (byte)(Mathf.Pow(Mathf.Clamp01(1f - num4), num) * 255f); array[i * 64 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b); } } val.SetPixels32(array); val.Apply(false, true); if (sharp) { _sharpTexture = val; } else { _softTexture = val; } return val; } } public sealed class ElementVisualProfile { private static readonly ElementVisualProfile[] Table = new ElementVisualProfile[7] { new ElementVisualProfile(0f, 0f, 0f, 0f, 0f, 0f, sharp: false, 0f, 0f, 0f), new ElementVisualProfile(-0.35f, 0.5f, 0.45f, 55f, 0.12f, 0.55f, sharp: false, 0.55f, 1.6f, 9f), new ElementVisualProfile(0.05f, 0.18f, 1.1f, 30f, 0.07f, 0.12f, sharp: true, 0.4f, 1.5f, 2f), new ElementVisualProfile(0f, 1.4f, 0.18f, 70f, 0.05f, 1.4f, sharp: true, 0.85f, 2f, 26f), new ElementVisualProfile(0.12f, 0.15f, 1.4f, 25f, 0.15f, 0.2f, sharp: false, 0.3f, 1.3f, 1.5f), new ElementVisualProfile(-0.15f, 0.25f, 1f, 22f, 0.1f, 0.3f, sharp: false, 0.45f, 1.7f, 3f), new ElementVisualProfile(0.4f, 0.3f, 0.7f, 35f, 0.06f, 0.1f, sharp: true, 0.22f, 1.2f, 2.5f) }; public float Gravity { get; } public float StartSpeed { get; } public float Lifetime { get; } public float EmissionRate { get; } public float StartSize { get; } public float Turbulence { get; } public bool Sharp { get; } public float LightIntensity { get; } public float LightRange { get; } public float FlickerSpeed { get; } private ElementVisualProfile(float gravity, float startSpeed, float lifetime, float emissionRate, float startSize, float turbulence, bool sharp, float lightIntensity, float lightRange, float flickerSpeed) { Gravity = gravity; StartSpeed = startSpeed; Lifetime = lifetime; EmissionRate = emissionRate; StartSize = startSize; Turbulence = turbulence; Sharp = sharp; LightIntensity = lightIntensity; LightRange = lightRange; FlickerSpeed = flickerSpeed; } public static ElementVisualProfile Of(Element element) { if (element < Element.None || (int)element >= Table.Length) { return Table[0]; } return Table[(int)element]; } } internal sealed class LightFlicker : MonoBehaviour { private Light _light; private float _baseIntensity; private float _speed; private float _phase; public void Initialize(Light target, float baseIntensity, float speed) { _light = target; _baseIntensity = baseIntensity; _speed = speed; _phase = Random.value * 100f; } private void Update() { if (!((Object)(object)_light == (Object)null)) { float num = (Time.time + _phase) * _speed; float num2 = Mathf.Sin(num) * 0.6f + Mathf.Sin(num * 2.7f) * 0.4f; _light.intensity = _baseIntensity * (1f + num2 * 0.25f); } } } internal sealed class LightFade : MonoBehaviour { private Light _light; private float _baseIntensity; private float _duration; private float _elapsed; public void Initialize(Light target, float duration) { _light = target; _baseIntensity = (((Object)(object)target != (Object)null) ? target.intensity : 0f); _duration = Mathf.Max(0.01f, duration); } private void Update() { if (!((Object)(object)_light == (Object)null)) { _elapsed += Time.deltaTime; float num = 1f - Mathf.Clamp01(_elapsed / _duration); _light.intensity = _baseIntensity * num * num; } } } } namespace ExperienceSystem.Ui { internal static class CritDisplay { private static bool _armed; public static void Arm() { _armed = true; } public static void Clear() { _armed = false; } public static bool Consume() { bool armed = _armed; _armed = false; return armed; } public static string Decorate(string text, Color color) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) return "<color=#" + ColorUtility.ToHtmlStringRGB(color) + "><b>" + text + "</b></color>"; } } internal sealed class ExperienceBar : MonoBehaviour { private ProgressMeter _meter; private Text _levelLabel; private Text _experienceLabel; private Text _pointsLabel; private CanvasGroup _group; private int _lastLevel = -1; private Player _lastPlayer; private float _nextRefresh; private RectTransform _root; private RectTransform _parent; public static ExperienceBar Create(Transform parent) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) RectTransform val = UiStyle.Rect(parent, "ES_ExperienceBar", 0f, 0f, 960f, 64f); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0f); val.anchorMax = val2; val.anchorMin = val2; val.pivot = new Vector2(0.5f, 0f); val.anchoredPosition = new Vector2(0f, 38f); ExperienceBar experienceBar = ((Component)val).gameObject.AddComponent<ExperienceBar>(); experienceBar._root = val; experienceBar._parent = (RectTransform)(object)((parent is RectTransform) ? parent : null); experienceBar.Build(val); return experienceBar; } private void Build(RectTransform root) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00e2: 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) _group = ((Component)this).gameObject.AddComponent<CanvasGroup>(); CanvasGroup obj = _group; bool interactable = (_group.blocksRaycasts = false); obj.interactable = interactable; _group.alpha = 0f; RectTransform val = UiStyle.Stretch((Transform)(object)root, "ExperienceTrack"); val.anchorMin = Vector2.zero; val.anchorMax = new Vector2(1f, 0f); val.pivot = new Vector2(0.5f, 0f); val.offsetMin = new Vector2(0f, 0f); val.offsetMax = new Vector2(0f, 36f); _meter = ProgressMeter.Create(val, divisions: false, ornate: true); _levelLabel = Header((Transform)(object)root, 0f, 0.24f, (TextAnchor)3, ValheimUi.Parchment); _experienceLabel = Header((Transform)(object)root, 0.24f, 0.7f, (TextAnchor)4, ValheimUi.Parchment); _pointsLabel = Header((Transform)(object)root, 0.7f, 1f, (TextAnchor)5, UiStyle.Gold); } private void LateUpdate() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_parent == (Object)null)) { Rect rect = _parent.rect; float width = ((Rect)(ref rect)).width; float num = Mathf.Min(width - 32f, Mathf.Clamp(width * 0.44f, 360f, 840f)); if (!Mathf.Approximately(_root.sizeDelta.x, num)) { _root.SetSizeWithCurrentAnchors((Axis)0, num); } } } private static Text Header(Transform root, float left, float right, TextAnchor alignment, Color color) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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) Text obj = UiStyle.Label(root, string.Empty, 0f, 0f, 0f, 22f, 14, color, alignment, heading: true); RectTransform rectTransform = ((Graphic)obj).rectTransform; rectTransform.anchorMin = new Vector2(left, 1f); rectTransform.anchorMax = new Vector2(right, 1f); rectTransform.offsetMin = new Vector2(18f, -27f); rectTransform.offsetMax = new Vector2(-18f, -3f); UiStyle.FitLabel(obj, 10); return obj; } private void Update() { //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) ModConfig settings = Plugin.Settings; Player localPlayer = Player.m_localPlayer; bool flag = settings != null && settings.ModEnabled.Value && settings.ShowExperienceBar.Value && (Object)(object)localPlayer != (Object)null && !((Character)localPlayer).InCutscene() && (Object)(object)Hud.instance != (Object)null && Hud.instance.IsVisible() && !Hud.IsUserHidden() && !Minimap.IsOpen() && !UiController.IsWindowOpen; bool flag2 = flag && _group.alpha < 1f; _group.alpha = (flag ? 1f : 0f); if (flag && (flag2 || !(Time.unscaledTime < _nextRefresh))) { _nextRefresh = Time.unscaledTime + 0.1f; PlayerProgression playerProgression = PlayerProgression.Get(localPlayer); if (!((Object)(object)playerProgression == (Object)null)) { bool flag3 = playerProgression.Level >= 100; long intoLevel; long neededForLevel; float num = LevelCurve.Progress(playerProgression.TotalXp, out intoLevel, out neededForLevel); bool immediate = flag2 || _lastLevel != playerProgression.Level || (Object)(object)_lastPlayer != (Object)(object)localPlayer; _meter.Set(flag3 ? 1f : num, flag3 ? settings.MaxLevelBarColor : UiStyle.Rune, immediate); _lastLevel = playerProgression.Level; _lastPlayer = localPlayer; _levelLabel.text = L.Format("$es_ui_level", "Level {0}", playerProgression.Level); _experienceLabel.text = (flag3 ? L.Get("$es_ui_maxlevel", "MAX LEVEL") : L.Format("$es_ui_expamount", "EXP: {0} / {1}", intoLevel, neededForLevel)); ((Graphic)_experienceLabel).color = (flag3 ? settings.MaxLevelBarColor : ValheimUi.Parchment); KeyboardShortcut value = settings.OpenSkillPanelKey.Value; string text = ((object)((KeyboardShortcut)(ref value)).MainKey/*cast due to .constrained prefix*/).ToString(); _pointsLabel.text = ((playerProgression.AvailablePoints > 0) ? L.Format("$es_ui_pointsshortcut", "{0} skill points [{1}]", playerProgression.AvailablePoints, text) : L.Format("$es_ui_openhint", "{0} for skills", "[" + text + "]")); ((Graphic)_pointsLabel).color = ((playerProgression.AvailablePoints > 0) ? UiStyle.Gold : ValheimUi.Muted); } } } } internal sealed class ExperienceGainDisplay : MonoBehaviour { private const float BatchSeconds = 0.9f; private Player _player; private long _pending; private float _flushAt; private void Awake() { _player = ((Component)this).GetComponent<Player>(); } public static void Report(Player player, long amount) { if ((Object)(object)player == (Object)null || amount <= 0 || (Object)(object)player != (Object)(object)Player.m_localPlayer) { return; } ExperienceGainDisplay component = ((Component)player).GetComponent<ExperienceGainDisplay>(); if (!((Object)(object)component == (Object)null)) { if (component._pending <= 0) { component._flushAt = Time.time + 0.9f; } component._pending += amount; } } private void Update() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0090: Unknown result type (might be due to invalid IL or missing references) if (_pending > 0 && !(Time.time < _flushAt)) { long pending = _pending; _pending = 0L; if (!((Object)(object)_player == (Object)null) && Plugin.Settings != null && Plugin.Settings.ShowExperienceLabels.Value) { FloatingLabel.Show(((Component)_player).transform.position + Vector3.up * 1.4f, L.Format("$es_ui_xpgain", "+{0} XP", pending), ValheimUi.Gold, mine: true); } } } } internal static class FloatingLabel { public static void Show(Vector3 worldPoint, string text, Color color, bool mine = false) { //IL_0016: 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_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_002b: 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_0034: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)DamageText.instance == (Object)null) && !string.IsNullOrEmpty(text)) { Vector3 val = worldPoint + Vector3.up * 0.6f; DamageText.instance.ShowText((TextType)0, val, CritDisplay.Decorate(text, color), mine); } } } internal static class InterfaceArt { private static readonly Dictionary<string, Sprite> Cache = new Dictionary<string, Sprite>(); private static readonly HashSet<string> Missing = new HashSet<string>(); public static Sprite Get(string name) { //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_0083: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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) if (Cache.TryGetValue(name, out var value) && (Object)(object)value != (Object)null) { return value; } if (Missing.Contains(name)) { return null; } Texture2D val = null; try { using (Stream stream = typeof(InterfaceArt).Assembly.GetManifestResourceStream("ExperienceSystem.Assets.Interface." + name + ".png")) { if (stream == null) { throw new FileNotFoundException(name); } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); val = new Texture2D(2, 2, (TextureFormat)4, false) { name = "ES_" + name, hideFlags = (HideFlags)61, filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; if (!ImageConversion.LoadImage(val, memoryStream.ToArray(), true)) { throw new InvalidDataException(name); } } Vector4 val2 = (Vector4)((name == "ExperienceFrame") ? new Vector4(72f, 0f, 72f, 0f) : Vector4.zero); if (name == "CarvedButton") { ((Vector4)(ref val2))..ctor(60f, 18f, 60f, 18f); } value = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, val2); ((Object)value).name = ((Object)val).name; ((Object)value).hideFlags = (HideFlags)61; Cache[name] = value; return value; } catch (Exception ex) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } Missing.Add(name); ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("Interface artwork '" + name + "' unavailable: " + ex.Message)); } return null; } } public static void Dispose() { foreach (Sprite value in Cache.Values) { if (!((Object)(object)value == (Object)null)) { Texture2D texture = value.texture; Object.Destroy((Object)(object)value); if ((Object)(object)texture != (Object)null) { Object.Destroy((Object)(object)texture); } } } Cache.Clear(); Missing.Clear(); } } internal sealed class ProgressMeter : MonoBehaviour { private RectTransform _fillRect; private RectTransform _tip; private Graphic _fill; private Image _tipImage; private RunicFilament _filament; private bool _ornate; private float _value; private float _target; public static ProgressMeter Create(RectTransform host, bool divisions = true, bool ornate = false) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) Sprite val = (ornate ? InterfaceArt.Get("ExperienceFrame") : null); if ((Object)(object)val != (Object)null) { UiStyle.Paint(UiStyle.Stretch((Transform)(object)host, "StoneFrame"), Color.white, raycast: false, val).pixelsPerUnitMultiplier = 2f; } else { UiStyle.Paint(host, UiStyle.Inset); UiStyle.Frame(host, UiStyle.Stone); } RectTransform val2 = UiStyle.Stretch((Transform)(object)host, "Track", 2f); if (ornate) { val2.offsetMin = new Vector2(26f, 11f); val2.offsetMax = new Vector2(-26f, -11f); } RectTransform val3 = UiStyle.Stretch((Transform)(object)val2, "Fill"); val3.pivot = Vector2.zero; Graphic val4; if (ornate) { val4 = (Graphic)(object)((Component)val3).gameObject.AddComponent<ExperienceFill>(); val4.raycastTarget = false; } else { val4 = (Graphic)(object)UiStyle.Paint(val3, UiStyle.Rune, raycast: false, ValheimUi.Sprite("bar_gradient_16", "bar_gradient", "gradient")); RectTransform obj = UiStyle.Stretch((Transform)(object)val3, "UpperHighlight"); obj.anchorMin = new Vector2(0f, 1f); obj.pivot = Vector2.one; obj.sizeDelta = new Vector2(0f, 1f); UiStyle.Paint(obj, new Color(0.72f, 0.98f, 1f, 0.48f)); } RunicFilament runicFilament = null; if (ornate) { runicFilament = ((Component)UiStyle.Stretch((Transform)(object)val3, "LivingLight")).gameObject.AddComponent<RunicFilament>(); ((Graphic)runicFilament).raycastTarget = false; ((Graphic)runicFilament).color = UiStyle.Rune; } if (divisions) { for (int i = 1; i < 10; i++) { RectTransform obj2 = UiStyle.Stretch((Transform)(object)val2, "Division"); obj2.anchorMin = new Vector2((float)i / 10f, 0f); obj2.anchorMax = new Vector2((float)i / 10f, 1f); obj2.sizeDelta = new Vector2(1f, 0f); obj2.anchoredPosition = Vector2.zero; UiStyle.Paint(obj2, new Color(0.05f, 0.04f, 0.02f, 0.4f)); } } RectTransform val5 = UiStyle.Stretch((Transform)(object)val2, "LeadingEdge"); val5.pivot = new Vector2(ornate ? 0.5f : 1f, 0.5f); val5.sizeDelta = new Vector2(ornate ? 30f : 2f, ornate ? 42f : 0f); Image tipImage = null; if (ornate) { ((Graphic)((Component)val5).gameObject.AddComponent<ExperienceSpark>()).raycastTarget = false; } else { tipImage = UiStyle.Paint(val5, new Color(0.7f, 0.98f, 1f)); } ProgressMeter progressMeter = ((Component)host).gameObject.AddComponent<ProgressMeter>(); progressMeter._fillRect = val3; progressMeter._fill = val4; progressMeter._tip = val5; progressMeter._tipImage = tipImage; progressMeter._filament = runicFilament; progressMeter._ornate = ornate; progressMeter.Set(0f, UiStyle.Rune, immediate: true); return progressMeter; } public void Set(float value, Color color, bool immediate = false) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) _target = Mathf.Clamp01(value); _fill.color = color; if ((Object)(object)_tipImage != (Object)null) { ((Graphic)_tipImage).color = Color.Lerp(color, Color.white, 0.65f); } if ((Object)(object)_filament != (Object)null) { ((Graphic)_filament).color = color; } if (immediate) { _value = _target; Draw(); } } private void Update() { if (!Mathf.Approximately(_value, _target)) { _value = Mathf.MoveTowards(_value, _target, Time.unscaledDeltaTime * 1.6f); Draw(); } } private void Draw() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0093: Unknown result type (might be due to invalid IL or missing references) _fillRect.anchorMax = new Vector2(_value, 1f); RectTransform fillRect = _fillRect; Vector2 offsetMin = (_fillRect.offsetMax = Vector2.zero); fillRect.offsetMin = offsetMin; _tip.anchorMin = new Vector2(_value, _ornate ? 0.5f : 0f); _tip.anchorMax = new Vector2(_value, _ornate ? 0.5f : 1f); _tip.anchoredPosition = Vector2.zero; ((Component)_tip).gameObject.SetActive(_value > 0.005f); } } internal static class RuneMesh { public static void Quad(VertexHelper mesh, Vector2 a, Vector2 b, Vector2 c, Vector2 d, Color color) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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) int currentVertCount = mesh.currentVertCount; mesh.AddVert(Vector2.op_Implicit(a), Color32.op_Implicit(color), Vector4.op_Implicit(Vector2.zero)); mesh.AddVert(Vector2.op_Implicit(b), Color32.op_Implicit(color), Vector4.op_Implicit(Vector2.zero)); mesh.AddVert(Vector2.op_Implicit(c), Color32.op_Implicit(color), Vector4.op_Implicit(Vector2.zero)); mesh.AddVert(Vector2.op_Implicit(d), Color32.op_Implicit(color), Vector4.op_Implicit(Vector2.zero)); mesh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2); mesh.AddTriangle(currentVertCount, currentVertCount + 2, currentVertCount + 3); } public static void Line(VertexHelper mesh, Vector2 from, Vector2 to, float width, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) Vector2 val = new Vector2(0f - (to - from).y, (to - from).x); Vector2 val2 = ((Vector2)(ref val)).normalized * width * 0.5f; Quad(mesh, from - val2, from + val2, to + val2, to - val2, color); } public static Color Alpha(Color color, float alpha) { //IL_0000: 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_000c: 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) return new Color(color.r, color.g, color.b, alpha); } } internal static class SkillTreeLayout { public const float Width = 600f; public const float Height = 504f; public static Vector2 Position(int index, int count) { //IL_004a: 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_0083: Unknown result type (might be due to invalid IL or missing references) if (count > 8) { int num = ((index >= 3) ? ((index < 5) ? 1 : ((index < 8) ? 2 : 3)) : 0); int num2 = index - num switch { 2 => 5, 1 => 3, 0 => 0, _ => 8, }; if (count == 9 && index == 8) { return new Vector2(300f, 443f); } return new Vector2((num % 2 == 0) ? (94f + (float)num2 * 206f) : (126f + (float)num2 * 348f), 65f + (float)num * 126f); } int num3 = (count + 1) / 2; float num4 = num3 switch { 3 => 85f, 2 => 140f, 1 => 236f, _ => 65f, }; float num5 = ((count == 5) ? 130f : (num3 switch { 3 => 160f, 2 => 216f, _ => 126f, })); return new Vector2((count % 2 == 1 && index == count - 1) ? 300f : ((index % 2 == 0) ? 126f : 474f), num4 + (float)(index / 2) * num5); } } internal sealed class RuneNodeRing : MaskableGraphic { private float _progress; private bool _selected; public void Set(float progress, bool selected) { if (!Mathf.Approximately(_progress, progress) || _selected != selected) { _progress = Mathf.Clamp01(progress); _selected = selected; ((Graphic)this).SetVerticesDirty(); } } protected override void OnPopulateMesh(VertexHelper mesh) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) mesh.Clear(); Rect rect = ((Graphic)this).rectTransform.rect; Vector2 center = ((Rect)(ref rect)).center; rect = ((Graphic)this).rectTransform.rect; float width = ((Rect)(ref rect)).width; rect = ((Graphic)this).rectTransform.rect; float radius = Mathf.Min(width, ((Rect)(ref rect)).height) * 0.5f - 5f; if (_selected) { Arc(mesh, center, radius, 8f, 1f, RuneMesh.Alpha(UiStyle.Rune, 0.12f)); Arc(mesh, center, radius, 4f, 1f, RuneMesh.Alpha(UiStyle.Rune, 0.32f)); } Arc(mesh, center, radius, 1.2f, 1f, RuneMesh.Alpha(UiStyle.Rune, _selected ? 0.9f : 0.25f)); Arc(mesh, center, radius, 2.2f, _progress, new Color(0.62f, 0.95f, 1f)); } private static void Arc(VertexHelper mesh, Vector2 center, float radius, float width, float fraction, Color color) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.CeilToInt(fraction * 64f); Vector2 val = default(Vector2); Vector2 val2 = default(Vector2); for (int i = 0; i < num; i++) { float num2 = (float)Math.PI / 2f - (float)Math.PI * 2f * (float)i / 64f; float num3 = (float)Math.PI / 2f - (float)Math.PI * 2f * Mathf.Min((float)(i + 1) / 64f, fraction); ((Vector2)(ref val))..ctor(Mathf.Cos(num2), Mathf.Sin(num2)); ((Vector2)(ref val2))..ctor(Mathf.Cos(num3), Mathf.Sin(num3)); RuneMesh.Quad(mesh, center + val * (radius - width * 0.5f), center + val * (radius + width * 0.5f), center + val2 * (radius + width * 0.5f), center + val2 * (radius - width * 0.5f), color); } } } internal sealed class ExperienceFill : MaskableGraphic { protected override void OnPopulateMesh(VertexHelper mesh) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //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_0057: 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_0060: 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_0082: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_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_011c: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_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_014c: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: 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_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) mesh.Clear(); Rect rect = ((Graphic)this).rectTransform.rect; if (!(((Rect)(ref rect)).width <= 0f) && !(((Rect)(ref rect)).height <= 0f)) { float num = Mathf.Min(6f, ((Rect)(ref rect)).width * 0.5f); Color val = Color.Lerp(((Graphic)this).color, Color.white, 0.38f); Color val2 = default(Color); ((Color)(ref val2))..ctor(((Graphic)this).color.r * 0.45f, ((Graphic)this).color.g * 0.45f, ((Graphic)this).color.b * 0.45f, ((Graphic)this).color.a); mesh.AddVert(Vector2.op_Implicit(((Rect)(ref rect)).center), Color32.op_Implicit(((Graphic)this).color), Vector4.op_Implicit(Vector2.zero)); mesh.AddVert(Vector2.op_Implicit(new Vector2(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).center.y)), Color32.op_Implicit(((Graphic)this).color), Vector4.op_Implicit(Vector2.zero)); mesh.AddVert(Vector2.op_Implicit(new Vector2(((Rect)(ref rect)).xMin + num, ((Rect)(ref rect)).yMax)), Color32.op_Implicit(val), Vector4.op_Implicit(Vector2.zero)); mesh.AddVert(Vector2.op_Implicit(new Vector2(((Rect)(ref rect)).xMax - num, ((Rect)(ref rect)).yMax)), Color32.op_Implicit(val), Vector4.op_Implicit(Vector2.zero)); mesh.AddVert(Vector2.op_Implicit(new Vector2(((Rect)(ref rect)).xMax, ((Rect)(ref rect)).center.y)), Color32.op_Implicit(((Graphic)this).color), Vector4.op_Implicit(Vector2.zero)); mesh.AddVert(Vector2.op_Implicit(new Vector2(((Rect)(ref rect)).xMax - num, ((Rect)(ref rect)).yMin)), Color32.op_Implicit(val2), Vector4.op_Implicit(Vector2.zero)); mesh.AddVert(Vector2.op_Implicit(new Vector2(((Rect)(ref rect)).xMin + num, ((Rect)(ref rect)).yMin)), Color32.op_Implicit(val2), Vector4.op_Implicit(Vector2.zero)); for (int i = 1; i <= 6; i++) { mesh.AddTriangle(0, i, (i == 6) ? 1 : (i + 1)); } } } } internal sealed class RunicFilament : MaskableGraphic { private float _nextFrame; private void Update() { if (!(Time.unscaledTime < _nextFrame)) { _nextFrame = Time.unscaledTime + 0.08f; ((Graphic)this).SetVerticesDirty(); } } protected override void OnPopulateMesh(VertexHelper mesh) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0080: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) mesh.Clear(); Rect rect = ((Graphic)this).rectTransform.rect; if (!(((Rect)(ref rect)).width < 1f)) { int num = Mathf.Clamp(Mathf.CeilToInt(((Rect)(ref rect)).width / 9f), 4, 100); Vector2 val = Point(rect, 0f); for (int i = 1; i <= num; i++) { Vector2 val2 = Point(rect, ((Rect)(ref rect)).width * (float)i / (float)num); RuneMesh.Line(mesh, val, val2, 5f, RuneMesh.Alpha(((Graphic)this).color, 0.14f)); RuneMesh.Line(mesh, val, val2, 1f, Color.Lerp(((Graphic)this).color, Color.white, 0.55f)); val = val2; } } } private static Vector2 Point(Rect rect, float x) { //IL_005e: 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) float num = Mathf.Sin(x * 0.047f + Time.unscaledTime * 0.8f) + Mathf.Sin(x * 0.16f - Time.unscaledTime * 0.5f) * 0.45f; float num2 = Mathf.Clamp01(Mathf.Min(x, ((Rect)(ref rect)).width - x) / 6f); return new Vector2(((Rect)(ref rect)).xMin + x, ((Rect)(ref rect)).center.y + num * ((Rect)(ref rect)).height * 0.16f * num2); } } internal sealed class ExperienceSpark : MaskableGraphic { protected override void OnPopulateMesh(VertexHelper mesh) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0150: Unknown result type (might be due to invalid IL or missing references) mesh.Clear(); Rect rect = ((Graphic)this).rectTransform.rect; Vector2 center = ((Rect)(ref rect)).center; Color color = default(Color); ((Color)(ref color))..ctor(1f, 0.64f, 0.21f); for (int i = 0; i < 4; i++) { float num = 13f - (float)i * 2.5f; RuneMesh.Quad(mesh, center + Vector2.left * num, center + Vector2.up * num * 1.6f, center + Vector2.right * num, center + Vector2.down * num * 1.6f, RuneMesh.Alpha(color, 0.045f + (float)i * 0.06f)); } RuneMesh.Line(mesh, center + Vector2.down * 12f, center + Vector2.up * 12f, 1.5f, new Color(1f, 0.92f, 0.66f)); RuneMesh.Line(mesh, center + Vector2.left * 6f, center + Vector2.right * 6f, 1f, new Color(1f, 0.83f, 0.43f)); } } internal static class ScaledCanvas { internal sealed class WindowFit : MonoBehaviour { private Canvas _canvas; private CanvasScaler _scaler; private void Awake() { _canvas = ((Component)this).GetComponent<Canvas>(); _scaler = ((Component)this).GetComponent<CanvasScaler>(); } private void LateUpdate() { float num = Mathf.Min((float)Screen.width / 1208f, (float)Screen.height / 1048f); _canvas.scaleFactor = Mathf.Max(0.1f, Mathf.Min(_scaler.scaleFactor, num)); } } public static GameObject Create(string name, int sortingOrder, bool interactive) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[2] { typeof(Canvas), typeof(CanvasScaler) }); val.layer = 5; Canvas component = val.GetComponent<Canvas>(); component.renderMode = (RenderMode)0; component.sortingOrder = sortingOrder; if (interactive) { val.AddComponent<GraphicRaycaster>(); } val.AddComponent<GuiScaler>(); return val; } } internal static class SkillIcons { private const string ResourcePrefix = "ExperienceSystem.Assets.SkillIcons."; private static readonly Dictionary<SkillId, Sprite> Cache = new Dictionary<SkillId, Sprite>(); private static readonly HashSet<SkillId> Missing = new HashSet<SkillId>(); public static Sprite Get(SkillId id) { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) if (Cache.TryGetValue(id, out var value) && (Object)(object)value != (Object)null) { return value; } if (Missing.Contains(id)) { return null; } Texture2D val = null; try { string text = "ExperienceSystem.Assets.SkillIcons." + id.ToString() + ".png"; using (Stream stream = typeof(SkillIcons).Assembly.GetManifestResourceStream(text)) { if (stream == null) { Missing.Add(id); ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("Skill icon '" + text + "' is missing; using a vanilla icon.")); } return null; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); val = new Texture2D(2, 2, (TextureFormat)4, false) { name = "ES_SkillIcon_" + id, hideFlags = (HideFlags)61, filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, anisoLevel = 0 }; if (!ImageConversion.LoadImage(val, memoryStream.ToArray(), true)) { throw new InvalidDataException("The embedded PNG could not be decoded."); } } Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0); ((Object)val2).name = ((Object)val).name; ((Object)val2).hideFlags = (HideFlags)61; Cache[id] = val2; return val2; } catch (Exception ex) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } Missing.Add(id); ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)$"Could not load skill icon '{id}'; using a vanilla icon: {ex.Message}"); } return null; } } public static void Dispose() { foreach (Sprite value in Cache.Values) { if (!((Object)(object)value == (Object)null)) { Texture2D texture = value.texture; Object.Destroy((Object)(object)value); if ((Object)(object)texture != (Object)null) { Object.Destroy((Object)(object)texture); } } } Cache.Clear(); Missing.Clear(); } } internal sealed class SkillsWindow : MonoBehaviour { private sealed class SkillNode { public SkillDefinition Definition; public Text Name; public Text Rank; public Image Icon; public RuneNodeRing Ring; } private sealed class CategoryTab { public SkillCategory Category; public Text Label; public Button Button; } internal const float Width = 1160f; internal const float Height = 1000f; private const float ContentWidth = 952f; private static readonly SkillCategory[] Categories = new SkillCategory[5] { SkillCategory.Attributes, SkillCategory.Offence, SkillCategory.Resistance, SkillCategory.Learning, SkillCategory.Epic }; private readonly List<SkillNode> _nodes = new List<SkillNode>(); private readonly Dictionary<SkillCategory, RectTransform> _trees = new Dictionary<SkillCategory, RectTransform>(); private readonly Dictionary<SkillCategory, SkillId> _remembered = new Dictionary<SkillCategory, SkillId>(); private readonly List<CategoryTab> _tabs = new List<CategoryTab>(); private SkillCategory _category; private SkillId _selected = SkillId.MaxEitr; private Text _automaticBonuses; private ProgressMeter _experience; private Text _levelLabel; private Text _pointsLabel; private Text _investedLabel; private Text _experienceLabel; private Text _detailCategory; private Text _detailName; private Text _detailDescription; private Text _detailRank; private Text _currentBonus; private Text _nextBonus; private Text _cost; private Text _buyLabel; private Text _title; private Text _currentBonusLabel; private Text _nextBonusLabel; private Text _refundLabel; private Text _resetLabel; private Text _closeLabel; private Text _freeLearningLabel; private Text _refundHintLabel; private Image _detailIcon; private RuneNodeRing _detailRing; private Button _buy; private Button _refund; private Button _reset; private int _lastLevel = -1; private float _nextRefresh; public bool IsOpen => ((Component)this).gameObject.activeSelf; private static PlayerProgression Progression { get { if (!((Object)(object)Player.m_localPlayer != (Object)null)) { return null; } return PlayerProgression.Get(Player.m_localPlayer); } } public static SkillsWindow Create(Transform parent) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) RectTransform val = UiStyle.Rect(parent, "ES_SkillsWindow", 0f, 0f, 1160f, 1000f); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0.5f); val.pivot = val2; Vector2 anchorMin = (val.anchorMax = val2); val.anchorMin = anchorMin; SkillsWindow skillsWindow = ((Component)val).gameObject.AddComponent<SkillsWindow>(); skillsWindow.Build(val); ((Component)val).gameObject.SetActive(false); return skillsWindow; } private void Build(RectTransform root) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) Sprite val = InterfaceArt.Get("SkillPanel"); UiStyle.Paint(root, Color.clear, raycast: true); UiStyle.Paint(UiStyle.Rect((Transform)(object)root, "OpaqueBoard", 78f, 151f, 1004f, 770f), new Color(0.055f, 0.043f, 0.028f, 1f)); UiStyle.Paint(UiStyle.Rect((Transform)(object)root, "OpaqueTitle", 378f, 48f, 404f, 84f), new Color(0.055f, 0.05f, 0.042f, 1f)); UiStyle.Paint(UiStyle.Stretch((Transform)(object)root, "CarvedFrame"), (Color)(((Object)(object)val != (Object)null) ? Color.white : new Color(0.12f, 0.105f, 0.085f, 1f)), raycast: false, val); BuildTitle((Transform)(object)root); RectTransform val2 = UiStyle.Rect((Transform)(object)root, "Content", 104f, 178f, 952f, 708f); ((Component)val2).gameObject.AddComponent<RectMask2D>(); BuildHeader((Transform)(object)val2); BuildTabs((Transform)(object)val2); BuildTrees((Transform)(object)val2); BuildDetails((Transform)(object)val2); BuildFooter((Transform)(object)val2); ShowCategory(_category); } private void BuildTitle(Transform root) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) _title = UiStyle.Label(root, string.Empty, 340f, 50f, 480f, 86f, 48, UiStyle.Gold, (TextAnchor)4, heading: true); _title.alignByGeometry = true; } private void RefreshLabels() { string text = L.Get("$es_ui_title", "SKILLS"); if (_title.text != text) { _title.text = text; RefreshTitleFont(); } foreach (CategoryTab tab in _tabs) { tab.Label.text = L.Get(Tokens.Category(tab.Category), tab.Category.ToString().ToUpperInvariant()); } _currentBonusLabel.text = L.Get("$es_ui_currentbonus", "CURRENT"); _nextBonusLabel.text = L.Get("$es_ui_nextbonus", "NEXT RANK"); _refundLabel.text = L.Get("$es_ui_refund", "Refund"); _resetLabel.text = L.Get("$es_ui_reset", "Reset all"); _closeLabel.text = L.Get("$es_ui_close", "Close"); _freeLearningLabel.text = L.Get("$es_ui_freelearning", "Learn skills in any order."); _refundHintLabel.text = L.Get("$es_ui_refundhint", "Refund returns one rank and its full point cost."); } private void RefreshTitleFont() { _title.font = ValheimUi.Runic ?? ValheimUi.Heading; string text = _title.text; foreach (char c in text) { if (!char.IsWhiteSpace(c) && !((Object)(object)_title.font == (Object)null) && !_title.font.HasCharacter(c)) { _title.font = ValheimUi.Heading; break; } } } private void BuildHeader(Transform root) { //IL_001d: 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_0083: Unknown result type (might be due to invalid IL or missing references) _levelLabel = UiStyle.Label(root, string.Empty, 0f, 0f, 190f, 28f, 18, ValheimUi.Parchment, (TextAnchor)3, heading: true); _pointsLabel = UiStyle.Label(root, string.Empty, 200f, 0f, 552f, 28f, 17, UiStyle.Rune, (TextAnchor)4); _investedLabel = UiStyle.Label(root, string.Empty, 762f, 1f, 190f, 26f, 13, ValheimUi.Muted, (TextAnchor)5); } private void BuildTabs(Transform root) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown for (int i = 0; i < Categories.Length; i++) { SkillCategory category = Categories[i]; Text label; Button val = UiStyle.Button(UiStyle.Rect(root, "Category_" + category, (float)i * 192f, 44f, 184f, 40f), string.Empty, out label, 14); UiStyle.FitLabel(label, 11); _tabs.Add(new CategoryTab { Category = category, Label = label, Button = val }); ((UnityEvent)val.onClick).AddListener((UnityAction)delegate { ShowCategory(category); }); } } private void BuildTrees(Transform root) { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) SkillCategory[] categories = Categories; for (int i = 0; i < categories.Length; i++) { SkillCategory skillCategory = categories[i]; List<SkillDefinition> list = new List<SkillDefinition>(); foreach (SkillDefinition item in SkillCatalog.All) { if (item.Category == skillCategory) { list.Add(item); } } RectTransform val = UiStyle.Rect(root, "Tree_" + skillCategory, 0f, 90f, 600f, 504f); _trees.Add(skillCategory, val); Sprite val2 = InterfaceArt.Get("LivingTree"); if ((Object)(object)val2 != (Object)null) { UiStyle.Paint(UiStyle.Stretch((Transform)(object)val, "LivingTree"), new Color(1f, 1f, 1f, 0.72f), raycast: false, val2); } for (int j = 0; j < list.Count; j++) { BuildNode((Transform)(object)val, list[j], j, list.Count); } if (skillCategory == SkillCategory.Attributes) { _automaticBonuses = UiStyle.Label((Transform)(object)val, string.Empty, 12f, 432f, 576f, 68f, 12, ValheimUi.Parchment, (TextAnchor)4); UiStyle.FitLabel(_automaticBonuses, 10); } } } private void BuildNode(Transform area, SkillDefinition definition, int index, int count) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to in