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 New LvlUp Effect v1.2.1
plugins/NewLvlUpEffect/NewLvlUpEffect.dll
Decompiled 16 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("New LvlUp Effect")] [assembly: AssemblyDescription("Minimal Nordic skill level notifications for Valheim")] [assembly: AssemblyCompany("Crevitka")] [assembly: AssemblyCopyright("Copyright (c) 2026 Crevitka")] [assembly: AssemblyFileVersion("1.2.1.0")] [assembly: AssemblyVersion("1.2.1.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 NewLvlUpEffect { [BepInPlugin("local.valheim.newlvlupeffect", "New LvlUp Effect", "1.2.1")] public sealed class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(Player), "Message")] private static class SkillMessagePatch { private static bool Prefix(Player __instance, string __1) { Plugin instance = Instance; if ((Object)(object)instance == (Object)null || !instance.Enabled.Value || !instance.ReplaceVanilla.Value || (Object)(object)__instance != (Object)(object)Player.m_localPlayer || __1 == null) { return true; } if (!__1.StartsWith("$msg_skillup $skill_", StringComparison.Ordinal) && !__1.StartsWith("Skill increased ", StringComparison.Ordinal) && !__1.StartsWith("All skills increased by ", StringComparison.Ordinal)) { return true; } try { if (!instance.EnsureView()) { return true; } ((BaseUnityPlugin)instance).Logger.LogDebug((object)("Suppressed vanilla skill HUD message: " + __1)); return false; } catch (Exception ex) { ((BaseUnityPlugin)instance).Logger.LogError((object)ex); return true; } } } [HarmonyPatch(typeof(Player), "OnSkillLevelup")] private static class LevelPatch { private static void Postfix(Player __instance, SkillType __0, float __1) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) Plugin instance = Instance; if ((Object)(object)instance == (Object)null || (Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return; } try { if (instance.EnsureView()) { instance.view.Enqueue(__0, Mathf.FloorToInt(__1)); } } catch (Exception ex) { ((BaseUnityPlugin)instance).Logger.LogError((object)ex); } } } [HarmonyPatch(typeof(Skills), "CheatRaiseSkill")] private static class CheatLevelPatch { private sealed class Snapshot { internal SkillType Skill; internal int Level; } private static void Prefix(Skills __instance, string __0, out Snapshot __state) { //IL_0056: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 //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) __state = null; if (!((Object)(object)Instance == (Object)null) && Instance.Enabled.Value && !((Object)(object)Player.m_localPlayer == (Object)null) && !((Object)(object)((Character)Player.m_localPlayer).GetSkills() != (Object)(object)__instance) && Enum.TryParse<SkillType>(__0, ignoreCase: true, out SkillType result) && Enum.IsDefined(typeof(SkillType), result) && (int)result != 0 && (int)result != 999) { __state = new Snapshot { Skill = result, Level = Mathf.FloorToInt(__instance.GetSkillLevel(result)) }; } } private static void Postfix(Skills __instance, Snapshot __state) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (__state == null || (Object)(object)Instance == (Object)null) { return; } int num = Mathf.FloorToInt(__instance.GetSkillLevel(__state.Skill)); if (num <= __state.Level) { return; } try { if (Instance.EnsureView()) { Instance.view.Enqueue(__state.Skill, num, __state.Level); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("Queued raiseskill notification: " + ((object)Unsafe.As<SkillType, SkillType>(ref __state.Skill)/*cast due to .constrained prefix*/).ToString() + " " + __state.Level + " -> " + num)); } else { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)"Skill notification could not be created: check HUD, font and Enabled setting."); } } catch (Exception ex) { ((BaseUnityPlugin)Instance).Logger.LogError((object)ex); } } } public const string Id = "local.valheim.newlvlupeffect"; internal static Plugin Instance; internal ConfigEntry<bool> Enabled; internal ConfigEntry<bool> ReplaceVanilla; internal ConfigEntry<float> Duration; internal ConfigEntry<float> VerticalPosition; internal ConfigEntry<float> Scale; private Harmony harmony; private LevelUpView view; private Player owner; private Hud ownerHud; internal void LogLayout(string message) { ((BaseUnityPlugin)this).Logger.LogInfo((object)message); } private void Awake() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) Instance = this; Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable skill level notifications."); ReplaceVanilla = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ReplaceVanillaMessage", true, "Replace only the vanilla skill-up text. Preserve game sound and effects."); Duration = ((BaseUnityPlugin)this).Config.Bind<float>("Appearance", "Duration", 3.6f, new ConfigDescription("Seconds per notification.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1.5f, 8f), Array.Empty<object>())); VerticalPosition = ((BaseUnityPlugin)this).Config.Bind<float>("Appearance", "VerticalPosition", 0.77f, new ConfigDescription("Vertical screen anchor: 0 bottom, 1 top.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 0.9f), Array.Empty<object>())); Scale = ((BaseUnityPlugin)this).Config.Bind<float>("Appearance", "Scale", 1f, new ConfigDescription("Notification scale.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.6f, 1.5f), Array.Empty<object>())); harmony = new Harmony("local.valheim.newlvlupeffect"); harmony.PatchAll(); new ConsoleCommand("newlvlupeffect_preview", "Preview skill notification without changing skills.", (ConsoleEvent)delegate { if ((Object)(object)Player.m_localPlayer != (Object)null && EnsureView()) { view.Enqueue((SkillType)102, 6, 5); } }, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); ((BaseUnityPlugin)this).Logger.LogInfo((object)"New LvlUp Effect 1.2.1 ready (animated level replacement)."); } private bool EnsureView() { //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown if (!Enabled.Value || (Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)Hud.instance == (Object)null) { return false; } if ((Object)(object)view != (Object)null) { return true; } TMP_FontAsset[] source = (from t in ((Component)Hud.instance).GetComponentsInChildren<TextMeshProUGUI>(true) select ((TMP_Text)t).font into f where (Object)(object)f != (Object)null select f).ToArray(); TMP_FontAsset val = ((IEnumerable<TMP_FontAsset>)source).FirstOrDefault((Func<TMP_FontAsset, bool>)((TMP_FontAsset f) => ((Object)f).name.IndexOf("Averia", StringComparison.OrdinalIgnoreCase) >= 0)) ?? ((IEnumerable<TMP_FontAsset>)Resources.FindObjectsOfTypeAll<TMP_FontAsset>()).FirstOrDefault((Func<TMP_FontAsset, bool>)((TMP_FontAsset f) => ((Object)f).name.IndexOf("Averia", StringComparison.OrdinalIgnoreCase) >= 0)) ?? source.FirstOrDefault(); if ((Object)(object)val == (Object)null) { return false; } GameObject val2 = new GameObject("NewLvlUpEffect", new Type[1] { typeof(RectTransform) }); try { LevelUpView levelUpView = val2.AddComponent<LevelUpView>(); levelUpView.Build(val, this); view = levelUpView; } catch { Object.Destroy((Object)(object)val2); throw; } owner = Player.m_localPlayer; ownerHud = Hud.instance; return true; } private void Update() { if ((Object)(object)view != (Object)null && (!Enabled.Value || (Object)(object)owner != (Object)(object)Player.m_localPlayer || (Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)ownerHud == (Object)null || (Object)(object)ownerHud != (Object)(object)Hud.instance)) { Object.Destroy((Object)(object)((Component)view).gameObject); view = null; } } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } if ((Object)(object)view != (Object)null) { Object.Destroy((Object)(object)((Component)view).gameObject); } (AccessTools.Field(typeof(Terminal), "commands")?.GetValue(null) as Dictionary<string, ConsoleCommand>)?.Remove("newlvlupeffect_preview"); Instance = null; } } public sealed class LevelUpView : MonoBehaviour { private sealed class Notice { public SkillType Skill; public int Level; public int Previous; } private readonly List<Notice> queue = new List<Notice>(); private readonly List<Image> sparks = new List<Image>(); private readonly List<Sprite> ownedSprites = new List<Sprite>(); private Plugin plugin; private RectTransform card; private RectTransform ornament; private RectTransform medallion; private CanvasGroup group; private CanvasGroup words; private CanvasGroup crest; private TextMeshProUGUI heading; private TextMeshProUGUI title; private TextMeshProUGUI number; private TextMeshProUGUI subtitle; private Image icon; private Image halo; private Image flare; private Image levelGlow; private TMP_FontAsset font; private Notice current; private float elapsed; private bool layoutLogged; private static readonly Color Gold = new Color(0.94f, 0.76f, 0.44f); public void Build(TMP_FontAsset gameFont, Plugin settings) { //IL_004b: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_066d: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_070f: Unknown result type (might be due to invalid IL or missing references) //IL_071e: Unknown result type (might be due to invalid IL or missing references) //IL_0746: Unknown result type (might be due to invalid IL or missing references) //IL_074b: Unknown result type (might be due to invalid IL or missing references) //IL_0764: Unknown result type (might be due to invalid IL or missing references) //IL_0784: Unknown result type (might be due to invalid IL or missing references) //IL_0789: Unknown result type (might be due to invalid IL or missing references) //IL_0793: Unknown result type (might be due to invalid IL or missing references) //IL_07dc: Unknown result type (might be due to invalid IL or missing references) //IL_07eb: Unknown result type (might be due to invalid IL or missing references) //IL_0804: Unknown result type (might be due to invalid IL or missing references) plugin = settings; font = gameFont; Canvas obj = ((Component)this).gameObject.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.overrideSorting = true; obj.sortingOrder = 45; CanvasScaler obj2 = ((Component)this).gameObject.AddComponent<CanvasScaler>(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = new Vector2(1920f, 1080f); obj2.matchWidthOrHeight = 0.5f; card = Rect("Skill celebration", ((Component)this).transform, new Vector2(520f, 210f), Vector2.zero); group = ((Component)card).gameObject.AddComponent<CanvasGroup>(); group.blocksRaycasts = false; group.interactable = false; group.alpha = 0f; Sprite sprite = CreateSprite(ring: false); Sprite sprite2 = CreateSprite(ring: true); Box("Soft vignette", (Transform)(object)card, new Vector2(620f, 250f), new Vector2(0f, -5f), new Color(0.015f, 0.018f, 0.024f, 0.65f)).sprite = sprite; halo = Box("Amber halo", (Transform)(object)card, new Vector2(240f, 130f), new Vector2(0f, 65f), new Color(0.86f, 0.48f, 0.12f, 0.16f)); halo.sprite = sprite; for (int i = 0; i < 8; i++) { Image val = Box("Ember " + i, (Transform)(object)card, new Vector2(5f, 5f), Vector2.zero, Gold); val.sprite = sprite; sparks.Add(val); } medallion = Rect("Medallion", (Transform)(object)card, new Vector2(76f, 76f), new Vector2(0f, 72f)); crest = ((Component)medallion).gameObject.AddComponent<CanvasGroup>(); Box("Smoked centre", (Transform)(object)medallion, new Vector2(82f, 82f), Vector2.zero, new Color(0.035f, 0.04f, 0.04f, 0.95f)).sprite = sprite; Box("Outer engraved ring", (Transform)(object)medallion, new Vector2(76f, 76f), Vector2.zero, new Color(Gold.r, Gold.g, Gold.b, 0.7f)).sprite = sprite2; Box("Inner engraved ring", (Transform)(object)medallion, new Vector2(66f, 66f), Vector2.zero, new Color(Gold.r, Gold.g, Gold.b, 0.22f)).sprite = sprite2; for (int j = 0; j < 4; j++) { float num = (float)j * (float)Math.PI * 0.5f; ((Transform)((Graphic)Box("Compass engraving", (Transform)(object)medallion, new Vector2(4f, 4f), new Vector2(Mathf.Cos(num), Mathf.Sin(num)) * 38f, Gold)).rectTransform).localRotation = Quaternion.Euler(0f, 0f, 45f); } icon = Box("Skill icon", (Transform)(object)medallion, new Vector2(45f, 45f), Vector2.zero, new Color(1f, 0.94f, 0.8f)); icon.preserveAspect = true; ornament = Rect("Unfolding ornament", (Transform)(object)card, new Vector2(420f, 12f), new Vector2(0f, 72f)); for (int k = -1; k <= 1; k += 2) { for (int l = 0; l < 22; l++) { float num2 = 1f - (float)l / 22f; Box("Gold stroke", (Transform)(object)ornament, new Vector2(6.5f, 1f), new Vector2((float)k * (58f + (float)l * 6.5f), 0f), new Color(Gold.r, Gold.g, Gold.b, 0.55f * num2)); } Stroke((Transform)(object)ornament, new Vector2((float)(k * 76), 0f), new Vector2((float)(k * 87), 6f), 0.8f); Stroke((Transform)(object)ornament, new Vector2((float)(k * 87), 6f), new Vector2((float)(k * 101), 0f), 0.8f); Stroke((Transform)(object)ornament, new Vector2((float)(k * 76), 0f), new Vector2((float)(k * 87), -6f), 0.8f); Stroke((Transform)(object)ornament, new Vector2((float)(k * 87), -6f), new Vector2((float)(k * 101), 0f), 0.8f); } RectTransform val2 = Rect("Typography", (Transform)(object)card, new Vector2(600f, 180f), Vector2.zero); words = ((Component)val2).gameObject.AddComponent<CanvasGroup>(); levelGlow = Box("Level change glow", (Transform)(object)val2, new Vector2(120f, 64f), new Vector2(0f, -57f), new Color(Gold.r, Gold.g, Gold.b, 0f)); levelGlow.sprite = sprite; heading = Label("Heading", new Vector2(480f, 24f), new Vector2(0f, 21f), 13f, Gold); ((TMP_Text)heading).characterSpacing = 3f; title = Label("Skill name", new Vector2(480f, 50f), new Vector2(0f, -13f), 34f, new Color(1f, 0.96f, 0.84f)); ((TMP_Text)title).enableAutoSizing = true; ((TMP_Text)title).fontSizeMin = 20f; ((TMP_Text)title).fontSizeMax = 34f; TextMeshProUGUI[] array = (TextMeshProUGUI[])(object)new TextMeshProUGUI[2] { heading, title }; for (int m = 0; m < array.Length; m++) { ((TMP_Text)array[m]).transform.SetParent((Transform)(object)val2, false); } RectTransform val3 = Rect("Rolling level viewport", (Transform)(object)val2, new Vector2(132f, 46f), new Vector2(0f, -57f)); ((Component)val3).gameObject.AddComponent<RectMask2D>(); subtitle = Label("Previous level", new Vector2(120f, 42f), Vector2.zero, 28f, new Color(0.78f, 0.76f, 0.68f)); number = Label("New level", new Vector2(120f, 42f), Vector2.zero, 28f, Gold); ((TMP_Text)subtitle).transform.SetParent((Transform)(object)val3, false); ((TMP_Text)number).transform.SetParent((Transform)(object)val3, false); flare = Box("Brief light bloom", (Transform)(object)card, new Vector2(190f, 2f), new Vector2(0f, 72f), new Color(1f, 0.87f, 0.55f, 0f)); flare.sprite = sprite; } public void Enqueue(SkillType skill, int level, int previous = -1) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) Notice notice = queue.FirstOrDefault((Notice n) => n.Skill == skill); if (notice != null) { notice.Level = Math.Max(notice.Level, level); return; } if (queue.Count >= 32) { queue.RemoveAt(0); } queue.Add(new Notice { Skill = skill, Level = level, Previous = ((previous < 0) ? Math.Max(0, level - 1) : previous) }); } private unsafe void Update() { //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_06ac: Unknown result type (might be due to invalid IL or missing references) //IL_06b1: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_06ba: Unknown result type (might be due to invalid IL or missing references) //IL_06da: Unknown result type (might be due to invalid IL or missing references) //IL_06df: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)group == (Object)null) { return; } if (Console.IsVisible()) { group.alpha = 0f; return; } if (current == null) { if (queue.Count == 0) { return; } current = queue[0]; queue.RemoveAt(0); elapsed = 0f; layoutLogged = false; ((TMP_Text)heading).text = Localization.instance.Localize("$msg_skillup").ToUpperInvariant(); ((TMP_Text)title).text = Localization.instance.Localize("$skill_" + ((object)Unsafe.As<SkillType, SkillType>(ref current.Skill)/*cast due to .constrained prefix*/).ToString().ToLowerInvariant()); ((TMP_Text)number).text = current.Level.ToString(); ((TMP_Text)subtitle).text = current.Previous.ToString(); SkillDef val = ((IEnumerable<SkillDef>)((Character)Player.m_localPlayer).GetSkills().m_skills).FirstOrDefault((Func<SkillDef, bool>)((SkillDef s) => s.m_skill == current.Skill)); icon.sprite = val?.m_icon; ((Behaviour)icon).enabled = (Object)(object)icon.sprite != (Object)null; } elapsed += Time.unscaledDeltaTime; float value = plugin.Duration.Value; float num = Mathf.Clamp01(elapsed / 0.65f); float num2 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((value - elapsed) / 0.65f)); float num3 = 1f - Mathf.Pow(1f - num, 3f); float num4 = Mathf.Min(0.75f, value * 0.28f); float num5 = Mathf.Min(0.42f, value * 0.22f); float num6 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((elapsed - num4) / num5)); ((TMP_Text)subtitle).rectTransform.anchoredPosition = new Vector2(0f, 38f * num6); ((TMP_Text)number).rectTransform.anchoredPosition = new Vector2(0f, -38f * (1f - num6)); ((TMP_Text)subtitle).alpha = 1f - num6; ((TMP_Text)number).alpha = num6; float num7 = Mathf.Clamp01((elapsed - num4 - num5) / 0.45f); float num8 = ((num6 >= 1f) ? Mathf.Sin(num7 * (float)Math.PI) : 0f); ((Transform)((TMP_Text)number).rectTransform).localScale = Vector3.one * (1f + 0.08f * num8); ((Graphic)levelGlow).color = new Color(Gold.r, Gold.g, Gold.b, 0.22f * num8); group.alpha = Mathf.Min(Mathf.SmoothStep(0f, 1f, num), num2); crest.alpha = Mathf.Clamp01(elapsed / 0.32f); words.alpha = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((elapsed - 0.18f) / 0.45f)); RectTransform obj = card; RectTransform obj2 = card; Vector2 size = default(Vector2); ((Vector2)(ref size))..ctor(0.5f, plugin.VerticalPosition.Value); obj2.anchorMax = size; obj.anchorMin = size; card.anchoredPosition = new Vector2(0f, (1f - num3) * -10f + (1f - num2) * 8f); float num9 = Mathf.Max(1, Screen.width); float num10 = Mathf.Max(1, Screen.height); float num11 = Mathf.Sqrt(num9 / 1920f * (num10 / 1080f)); float num12 = num9 / (num11 * 640f); ((Transform)card).localScale = Vector3.one * Mathf.Min(plugin.Scale.Value, num12); ((Transform)medallion).localScale = Vector3.one * (0.7f + 0.12f * num3); ((Transform)ornament).localScale = new Vector3(num3, 1f, 1f); ((Component)words).transform.localPosition = new Vector3(0f, -8f * (1f - num3), 0f); float num13 = Mathf.Exp(0f - Mathf.Pow((elapsed - 0.38f) / 0.22f, 2f)); ((Graphic)halo).color = new Color(0.86f, 0.48f, 0.12f, 0.12f + 0.12f * num13); ((Graphic)flare).color = new Color(1f, 0.87f, 0.55f, num13 * 0.6f); for (int num14 = 0; num14 < sparks.Count; num14++) { float num15 = Mathf.Clamp01((elapsed - (float)(num14 % 4) * 0.12f) / (1.4f + (float)(num14 % 3) * 0.3f)); float num16 = ((num14 % 2 != 0) ? 1 : (-1)) * (50 + num14 * 37 % 155); ((Graphic)sparks[num14]).rectTransform.anchoredPosition = new Vector2(num16 + Mathf.Sin((float)num14 * 2f + num15) * 12f, 54f + num15 * (float)(40 + num14 % 4 * 10)); ((Graphic)sparks[num14]).color = new Color(Gold.r, Gold.g, Gold.b, Mathf.Sin(num15 * (float)Math.PI) * 0.65f); } if (!layoutLogged && elapsed >= 0.7f) { layoutLogged = true; Canvas component = ((Component)this).GetComponent<Canvas>(); Plugin obj3 = plugin; string[] obj4 = new string[12] { "Showing ", ((object)Unsafe.As<SkillType, SkillType>(ref current.Skill)/*cast due to .constrained prefix*/).ToString(), ": rootCanvas=", component.isRootCanvas.ToString(), ", canvasRect=", null, null, null, null, null, null, null }; Rect rect = ((RectTransform)((Component)this).transform).rect; size = ((Rect)(ref rect)).size; obj4[5] = ((object)(*(Vector2*)(&size))/*cast due to .constrained prefix*/).ToString(); obj4[6] = ", scale="; obj4[7] = ((Transform)card).localScale.x.ToString(); obj4[8] = ", alpha="; obj4[9] = group.alpha.ToString(); obj4[10] = ", active="; obj4[11] = ((Component)this).gameObject.activeInHierarchy.ToString(); obj3.LogLayout(string.Concat(obj4)); } if (elapsed >= value) { current = null; group.alpha = 0f; } } private static void Stroke(Transform parent, Vector2 from, Vector2 to, float alpha) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) Vector2 val = to - from; ((Transform)((Graphic)Box("Engraved stroke", parent, new Vector2(((Vector2)(ref val)).magnitude, 1f), (from + to) * 0.5f, new Color(Gold.r, Gold.g, Gold.b, alpha))).rectTransform).localRotation = Quaternion.Euler(0f, 0f, Mathf.Atan2(val.y, val.x) * 57.29578f); } private Sprite CreateSprite(bool ring) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_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) Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; Color[] array = (Color[])(object)new Color[16384]; for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { Vector2 val2 = new Vector2(((float)j + 0.5f) / 128f * 2f - 1f, ((float)i + 0.5f) / 128f * 2f - 1f); float magnitude = ((Vector2)(ref val2)).magnitude; float num = (ring ? (1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.009f, 0.035f, Mathf.Abs(magnitude - 0.94f)))) : Mathf.Pow(Mathf.Clamp01(1f - magnitude * magnitude), 3f)); array[i * 128 + j] = new Color(1f, 1f, 1f, num); } } val.SetPixels(array); val.Apply(false, true); Sprite val3 = Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 100f); ownedSprites.Add(val3); return val3; } private void OnDestroy() { foreach (Sprite ownedSprite in ownedSprites) { if (!((Object)(object)ownedSprite == (Object)null)) { Object.Destroy((Object)(object)ownedSprite.texture); Object.Destroy((Object)(object)ownedSprite); } } } private static RectTransform Rect(string name, Transform parent, Vector2 size, Vector2 position) { //IL_0014: 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_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_0042: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) RectTransform component = new GameObject(name, new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)component).SetParent(parent, false); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.5f); component.pivot = val; Vector2 anchorMin = (component.anchorMax = val); component.anchorMin = anchorMin; component.sizeDelta = size; component.anchoredPosition = position; return component; } private static Image Box(string name, Transform parent, Vector2 size, Vector2 position, Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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) Image obj = ((Component)Rect(name, parent, size, position)).gameObject.AddComponent<Image>(); ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = false; return obj; } private TextMeshProUGUI Label(string name, Vector2 size, Vector2 position, float fontSize, Color color) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0081: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = ((Component)Rect(name, (Transform)(object)card, size, position)).gameObject.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj).font = font; ((TMP_Text)obj).fontSize = fontSize; ((Graphic)obj).color = color; ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((Graphic)obj).raycastTarget = false; ((TMP_Text)obj).textWrappingMode = (TextWrappingModes)0; Shadow obj2 = ((Component)obj).gameObject.AddComponent<Shadow>(); obj2.effectColor = new Color(0f, 0f, 0f, 0.8f); obj2.effectDistance = new Vector2(0f, -2f); return obj; } } }