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.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("VikingMessages")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyDescription("Elden Ring-inspired message system for Valheim")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Viking Messages")] [assembly: AssemblyTitle("Viking Messages")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 VikingMessages { [Serializable] public class VikingMessage { public string Id; public Vector3 Position; public Quaternion Rotation; public string Template; public string Words; public int EmoteIndex; public long AuthorId; public string AuthorName; public int Reputation; public List VotedPlayers = new List(); public DateTime CreatedTime; public string[] EquippedItems = new string[0]; public Vector3 LookDirection; } [Serializable] public class PlayerReputation { public long PlayerId; public string PlayerName; public int TotalReputation; public int MessageCount; public PlayerReputation() { } public PlayerReputation(long id, string name) { PlayerId = id; PlayerName = name; TotalReputation = 0; MessageCount = 0; } } [Serializable] public class LeaderboardData { public List Players = new List(); } public class GhostPhantom : MonoBehaviour { [CompilerGenerated] private sealed class d__21 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string emoteName; public GhostPhantom <>4__this; private string 5__1; private Exception 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__21(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)<>4__this._animator != (Object)null) { try { ((Behaviour)<>4__this._animator).enabled = true; <>4__this._animator.speed = 0.7f; 5__1 = "emote_" + emoteName.ToLower(); ManualLogSource log = VikingMessagesPlugin.Log; if (log != null) { log.LogInfo((object)("Attempting to play emote trigger: " + 5__1)); } <>4__this._animator.SetTrigger(5__1); 5__1 = null; } catch (Exception ex) { 5__2 = ex; ManualLogSource log2 = VikingMessagesPlugin.Log; if (log2 != null) { log2.LogWarning((object)("Failed to play emote " + emoteName + ": " + 5__2.Message)); } } } else { ManualLogSource log3 = VikingMessagesPlugin.Log; if (log3 != null) { log3.LogWarning((object)"No animator available for ghost emote"); } } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__13 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public GhostPhantom <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)Player.m_localPlayer == (Object)null) { ManualLogSource log = VikingMessagesPlugin.Log; if (log != null) { log.LogWarning((object)"No local player for ghost clone"); } <>4__this.CreateFallbackGhost(); } else { <>4__this.CreatePlayerClone(); } <>4__this.CreateGlowLight(); <>4__this.Show(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private float _displayDuration = 5f; private float _currentTimer; private float _fadeInTime = 0.5f; private bool _isVisible; private List _renderers = new List(); private static readonly Color GhostColor = new Color(0.85f, 0.9f, 1f, 0.7f); private GameObject _visualClone; private Animator _animator; private Light _glowLight; private string _pendingEmote; private VikingMessage _message; public void Initialize(VikingMessage message, float duration = 5f) { _message = message; _displayDuration = duration; _pendingEmote = GetEmoteName(message.EmoteIndex); ManualLogSource log = VikingMessagesPlugin.Log; if (log != null) { log.LogInfo((object)$"GhostPhantom.Initialize: emote={_pendingEmote}, emoteIndex={message.EmoteIndex}"); } } private void Start() { ((MonoBehaviour)this).StartCoroutine(SetupGhostCoroutine()); } [IteratorStateMachine(typeof(d__13))] private IEnumerator SetupGhostCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { <>4__this = this }; } private void CreatePlayerClone() { //IL_007a: 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_00a6: Unknown result type (might be due to invalid IL or missing references) try { Player localPlayer = Player.m_localPlayer; Transform val = ((Component)localPlayer).transform.Find("Visual"); if ((Object)(object)val == (Object)null) { ManualLogSource log = VikingMessagesPlugin.Log; if (log != null) { log.LogWarning((object)"Could not find Visual transform on player"); } CreateFallbackGhost(); return; } _visualClone = Object.Instantiate(((Component)val).gameObject, ((Component)this).transform); ((Object)_visualClone).name = "GhostVisual"; _visualClone.transform.localPosition = Vector3.zero; _visualClone.transform.localRotation = Quaternion.identity; _visualClone.transform.localScale = Vector3.one; _animator = _visualClone.GetComponent(); if ((Object)(object)_animator == (Object)null) { _animator = _visualClone.GetComponentInChildren(); } DisableComponents(_visualClone); Renderer[] componentsInChildren = _visualClone.GetComponentsInChildren(true); foreach (Renderer val2 in componentsInChildren) { if ((Object)(object)val2 != (Object)null) { val2.enabled = true; SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((val2 is SkinnedMeshRenderer) ? val2 : null); if (val3 != null) { val3.updateWhenOffscreen = true; } } } Transform[] componentsInChildren2 = _visualClone.GetComponentsInChildren(true); foreach (Transform val4 in componentsInChildren2) { if ((Object)(object)val4 != (Object)null && (Object)(object)((Component)val4).gameObject != (Object)null) { ((Component)val4).gameObject.SetActive(true); } } ApplyGhostMaterials(_visualClone); ManualLogSource log2 = VikingMessagesPlugin.Log; if (log2 != null) { log2.LogInfo((object)$"Ghost clone created successfully with {_renderers.Count} renderers"); } } catch (Exception arg) { ManualLogSource log3 = VikingMessagesPlugin.Log; if (log3 != null) { log3.LogError((object)$"Failed to create player clone: {arg}"); } CreateFallbackGhost(); } } private void DisableComponents(GameObject obj) { MonoBehaviour[] componentsInChildren = obj.GetComponentsInChildren(true); foreach (MonoBehaviour val in componentsInChildren) { if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)this) { ((Behaviour)val).enabled = false; } } ZNetView[] componentsInChildren2 = obj.GetComponentsInChildren(true); foreach (ZNetView val2 in componentsInChildren2) { if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)val2); } } ZSyncTransform[] componentsInChildren3 = obj.GetComponentsInChildren(true); foreach (ZSyncTransform val3 in componentsInChildren3) { if ((Object)(object)val3 != (Object)null) { Object.Destroy((Object)(object)val3); } } ZSyncAnimation[] componentsInChildren4 = obj.GetComponentsInChildren(true); foreach (ZSyncAnimation val4 in componentsInChildren4) { if ((Object)(object)val4 != (Object)null) { Object.Destroy((Object)(object)val4); } } VisEquipment[] componentsInChildren5 = obj.GetComponentsInChildren(true); foreach (VisEquipment val5 in componentsInChildren5) { if ((Object)(object)val5 != (Object)null) { Object.Destroy((Object)(object)val5); } } Collider[] componentsInChildren6 = obj.GetComponentsInChildren(true); foreach (Collider val6 in componentsInChildren6) { if ((Object)(object)val6 != (Object)null) { val6.enabled = false; } } ParticleSystem[] componentsInChildren7 = obj.GetComponentsInChildren(true); foreach (ParticleSystem val7 in componentsInChildren7) { if ((Object)(object)val7 != (Object)null) { val7.Stop(); } } AudioSource[] componentsInChildren8 = obj.GetComponentsInChildren(true); foreach (AudioSource val8 in componentsInChildren8) { if ((Object)(object)val8 != (Object)null) { ((Behaviour)val8).enabled = false; } } } private void ApplyGhostMaterials(GameObject obj) { _renderers.Clear(); Renderer[] componentsInChildren = obj.GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { _renderers.Add(val); Material[] array = (Material[])(object)new Material[val.sharedMaterials.Length]; for (int j = 0; j < val.sharedMaterials.Length; j++) { Material val2 = CreateGhostMaterial(val.sharedMaterials[j]); array[j] = val2; } val.materials = array; } } } private Material CreateGhostMaterial(Material sourceMat) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) Shader val = Shader.Find("Standard"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Sprites/Default"); } Material val2 = new Material(val); if ((Object)(object)sourceMat != (Object)null && sourceMat.HasProperty("_MainTex")) { val2.mainTexture = sourceMat.mainTexture; } val2.color = GhostColor; val2.SetFloat("_Mode", 3f); val2.SetInt("_SrcBlend", 5); val2.SetInt("_DstBlend", 10); val2.SetInt("_ZWrite", 0); val2.DisableKeyword("_ALPHATEST_ON"); val2.EnableKeyword("_ALPHABLEND_ON"); val2.DisableKeyword("_ALPHAPREMULTIPLY_ON"); val2.renderQueue = 3000; val2.EnableKeyword("_EMISSION"); val2.SetColor("_EmissionColor", new Color(0.3f, 0.4f, 0.5f)); return val2; } private void CreateFallbackGhost() { //IL_0059: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) ManualLogSource log = VikingMessagesPlugin.Log; if (log != null) { log.LogInfo((object)"Creating fallback ghost (primitive shapes)"); } Material val = CreateGhostMaterial(null); GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)1); ((Object)val2).name = "GhostBody"; val2.transform.SetParent(((Component)this).transform); val2.transform.localPosition = new Vector3(0f, 1f, 0f); val2.transform.localScale = new Vector3(0.5f, 0.7f, 0.35f); Object.Destroy((Object)(object)val2.GetComponent()); Renderer component = val2.GetComponent(); component.material = val; _renderers.Add(component); GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)val3).name = "GhostHead"; val3.transform.SetParent(((Component)this).transform); val3.transform.localPosition = new Vector3(0f, 1.85f, 0f); val3.transform.localScale = new Vector3(0.35f, 0.35f, 0.35f); Object.Destroy((Object)(object)val3.GetComponent()); Renderer component2 = val3.GetComponent(); component2.material = Object.Instantiate(val); _renderers.Add(component2); GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)1); val4.transform.SetParent(((Component)this).transform); val4.transform.localPosition = new Vector3(-0.4f, 1.2f, 0f); val4.transform.localRotation = Quaternion.Euler(0f, 0f, 30f); val4.transform.localScale = new Vector3(0.12f, 0.35f, 0.12f); Object.Destroy((Object)(object)val4.GetComponent()); val4.GetComponent().material = Object.Instantiate(val); _renderers.Add(val4.GetComponent()); GameObject val5 = GameObject.CreatePrimitive((PrimitiveType)1); val5.transform.SetParent(((Component)this).transform); val5.transform.localPosition = new Vector3(0.4f, 1.2f, 0f); val5.transform.localRotation = Quaternion.Euler(0f, 0f, -30f); val5.transform.localScale = new Vector3(0.12f, 0.35f, 0.12f); Object.Destroy((Object)(object)val5.GetComponent()); val5.GetComponent().material = Object.Instantiate(val); _renderers.Add(val5.GetComponent()); } private void CreateGlowLight() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0033: 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) GameObject val = new GameObject("GhostLight"); val.transform.SetParent(((Component)this).transform); val.transform.localPosition = new Vector3(0f, 1.2f, 0f); _glowLight = val.AddComponent(); _glowLight.type = (LightType)2; _glowLight.color = new Color(0.7f, 0.8f, 1f); _glowLight.intensity = 0.8f; _glowLight.range = 3f; _glowLight.shadows = (LightShadows)0; } public void Show() { ((Component)this).gameObject.SetActive(true); _isVisible = true; _currentTimer = _displayDuration; if (!string.IsNullOrEmpty(_pendingEmote)) { ((MonoBehaviour)this).StartCoroutine(PlayEmoteDelayed(_pendingEmote)); } UpdateAlpha(0f); } [IteratorStateMachine(typeof(d__21))] private IEnumerator PlayEmoteDelayed(string emoteName) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__21(0) { <>4__this = this, emoteName = emoteName }; } public void Hide() { _isVisible = false; ((Component)this).gameObject.SetActive(false); foreach (Renderer renderer in _renderers) { if (!((Object)(object)renderer != (Object)null)) { continue; } Material[] materials = renderer.materials; foreach (Material val in materials) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } } Object.Destroy((Object)(object)((Component)this).gameObject, 0.1f); } private void Update() { if (_isVisible) { _currentTimer -= Time.deltaTime; EnsureRenderersEnabled(); float num = _displayDuration - _currentTimer; float num2 = 2f; float alpha = ((num < _fadeInTime) ? (num / _fadeInTime * 0.7f) : ((!(_currentTimer < num2)) ? 0.7f : (_currentTimer / num2 * 0.7f))); UpdateAlpha(alpha); if ((Object)(object)_glowLight != (Object)null) { _glowLight.intensity = 0.6f + Mathf.Sin(Time.time * 3f) * 0.2f; } if (_currentTimer <= 0f) { Hide(); } } } private void EnsureRenderersEnabled() { if ((Object)(object)_visualClone == (Object)null) { return; } Renderer[] componentsInChildren = _visualClone.GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if ((Object)(object)val != (Object)null && !val.enabled) { val.enabled = true; } } Transform[] componentsInChildren2 = _visualClone.GetComponentsInChildren(true); foreach (Transform val2 in componentsInChildren2) { if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).gameObject != (Object)null && !((Component)val2).gameObject.activeSelf && ((Object)(object)((Component)val2).GetComponent() != (Object)null || (Object)(object)((Component)val2).GetComponent() != (Object)null)) { ((Component)val2).gameObject.SetActive(true); } } } private void UpdateAlpha(float alpha) { //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_005b: Unknown result type (might be due to invalid IL or missing references) Color ghostColor = GhostColor; ghostColor.a = alpha; foreach (Renderer renderer in _renderers) { if ((Object)(object)renderer == (Object)null) { continue; } Material[] materials = renderer.materials; foreach (Material val in materials) { if ((Object)(object)val != (Object)null) { val.color = ghostColor; } } } } private string GetEmoteName(int emoteIndex) { List availableEmotes = MessageTemplates.AvailableEmotes; if (availableEmotes != null && emoteIndex >= 0 && emoteIndex < availableEmotes.Count) { return availableEmotes[emoteIndex]; } return "wave"; } private void OnDestroy() { foreach (Renderer renderer in _renderers) { if (!((Object)(object)renderer != (Object)null)) { continue; } Material[] materials = renderer.materials; foreach (Material val in materials) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } } _renderers.Clear(); } } public static class GhostPhantomManager { private static GhostPhantom _currentGhost; public static void ShowGhost(Vector3 position, Quaternion rotation, VikingMessage message, float duration = 5f) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0035: 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_0071: 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) try { if ((Object)(object)_currentGhost != (Object)null) { _currentGhost.Hide(); _currentGhost = null; } GameObject val = new GameObject("VikingMessageGhost"); val.transform.position = position; val.transform.rotation = rotation; _currentGhost = val.AddComponent(); _currentGhost.Initialize(message, duration); ManualLogSource log = VikingMessagesPlugin.Log; if (log != null) { log.LogInfo((object)$"Ghost spawned at {position} with rotation {((Quaternion)(ref rotation)).eulerAngles}"); } } catch (Exception arg) { ManualLogSource log2 = VikingMessagesPlugin.Log; if (log2 != null) { log2.LogError((object)$"Failed to spawn ghost: {arg}"); } } } public static void HideCurrentGhost() { if ((Object)(object)_currentGhost != (Object)null) { _currentGhost.Hide(); _currentGhost = null; } } public static void Cleanup() { HideCurrentGhost(); } } public static class LeaderboardManager { [CompilerGenerated] private static class <>O { public static UnityAction <0>__CloseLeaderboard; } private static GameObject _leaderboardUI; private static bool _isVisible; private static bool _hasStealthBuff; private static bool _hasCarryBuff; public const float CARRY_WEIGHT_BONUS = 500f; private static SE_Stats _reputationBuff; private const string BUFF_NAME = "SE_ReputationTop3"; public static bool IsVisible => _isVisible; public static void ShowLeaderboard() { if ((Object)(object)_leaderboardUI != (Object)null) { CloseLeaderboard(); return; } CreateLeaderboardUI(); _isVisible = true; GUIManager.BlockInput(true); } public static void CloseLeaderboard() { if ((Object)(object)_leaderboardUI != (Object)null) { Object.Destroy((Object)(object)_leaderboardUI); _leaderboardUI = null; } _isVisible = false; GUIManager.BlockInput(false); } private static void CreateLeaderboardUI() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (GUIManager.Instance == null) { ManualLogSource log = VikingMessagesPlugin.Log; if (log != null) { log.LogWarning((object)"GUIManager not ready"); } return; } try { _leaderboardUI = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), 500f, 550f, false); } catch (Exception ex) { ManualLogSource log2 = VikingMessagesPlugin.Log; if (log2 != null) { log2.LogWarning((object)("CreateWoodpanel failed: " + ex.Message)); } } if ((Object)(object)_leaderboardUI == (Object)null) { _leaderboardUI = CreateFallbackPanel(); } if ((Object)(object)_leaderboardUI == (Object)null) { ManualLogSource log3 = VikingMessagesPlugin.Log; if (log3 != null) { log3.LogError((object)"Failed to create leaderboard UI"); } } else { PopulateLeaderboardContent(); } } private static GameObject CreateFallbackPanel() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003e: 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: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("VikingMessages_LeaderboardCanvas"); Canvas val2 = val.AddComponent(); val2.renderMode = (RenderMode)0; val2.sortingOrder = 100; CanvasScaler val3 = val.AddComponent(); val3.uiScaleMode = (ScaleMode)1; val3.referenceResolution = new Vector2(1920f, 1080f); val.AddComponent(); GameObject val4 = new GameObject("Panel"); val4.transform.SetParent(val.transform, false); RectTransform val5 = val4.AddComponent(); val5.sizeDelta = new Vector2(500f, 550f); val5.anchorMin = new Vector2(0.5f, 0.5f); val5.anchorMax = new Vector2(0.5f, 0.5f); val5.anchoredPosition = Vector2.zero; Image val6 = val4.AddComponent(); ((Graphic)val6).color = new Color(0.18f, 0.12f, 0.08f, 0.97f); CreateBorderFrame(val4.transform, new Vector2(500f, 550f)); return val4; } private static void CreateBorderFrame(Transform parent, Vector2 size) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00b1: 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_00d2: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: 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_01bb: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("OuterBorder"); val.transform.SetParent(parent, false); Image val2 = val.AddComponent(); ((Graphic)val2).color = new Color(0.6f, 0.45f, 0.2f); RectTransform component = val.GetComponent(); component.sizeDelta = new Vector2(size.x + 8f, size.y + 8f); component.anchoredPosition = Vector2.zero; val.transform.SetAsFirstSibling(); GameObject val3 = new GameObject("InnerBorder"); val3.transform.SetParent(parent, false); Image val4 = val3.AddComponent(); ((Graphic)val4).color = new Color(0.1f, 0.07f, 0.04f); RectTransform component2 = val3.GetComponent(); component2.sizeDelta = new Vector2(size.x + 4f, size.y + 4f); component2.anchoredPosition = Vector2.zero; val3.transform.SetSiblingIndex(1); GameObject val5 = new GameObject("TopBar"); val5.transform.SetParent(parent, false); Image val6 = val5.AddComponent(); ((Graphic)val6).color = new Color(0.5f, 0.38f, 0.18f); RectTransform component3 = val5.GetComponent(); component3.sizeDelta = new Vector2(size.x - 40f, 4f); component3.anchorMin = new Vector2(0.5f, 1f); component3.anchorMax = new Vector2(0.5f, 1f); component3.anchoredPosition = new Vector2(0f, -25f); GameObject val7 = new GameObject("BottomBar"); val7.transform.SetParent(parent, false); Image val8 = val7.AddComponent(); ((Graphic)val8).color = new Color(0.5f, 0.38f, 0.18f); RectTransform component4 = val7.GetComponent(); component4.sizeDelta = new Vector2(size.x - 40f, 4f); component4.anchorMin = new Vector2(0.5f, 0f); component4.anchorMax = new Vector2(0.5f, 0f); component4.anchoredPosition = new Vector2(0f, 25f); } private static void PopulateLeaderboardContent() { //IL_003b: 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_0040: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00e3: 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_0117: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) GUIManager instance = GUIManager.Instance; Font font = ((instance != null) ? instance.AveriaSerifBold : null); Font font2 = ((instance != null) ? instance.AveriaSerif : null); Color color = (Color)(((??)instance?.ValheimOrange) ?? new Color(1f, 0.64f, 0.1f)); CreateStyledText(_leaderboardUI.transform, "Reputation Leaderboard", new Vector2(0f, -40f), 28, color, font, (TextAnchor)4, outline: true); CreateStyledText(_leaderboardUI.transform, "Top 3 players gain +100% Stamina Regen & +500 Carry Weight", new Vector2(0f, -75f), 14, new Color(0.85f, 0.8f, 0.65f), font2, (TextAnchor)4, outline: true); CreateStyledText(_leaderboardUI.transform, "[F7] Toggle", new Vector2(0f, -95f), 12, new Color(0.6f, 0.55f, 0.4f), font2, (TextAnchor)4, outline: false); CreateStyledText(_leaderboardUI.transform, "Rank", new Vector2(-180f, -130f), 16, color, font, (TextAnchor)4, outline: true, bottomAnchor: false, 60f); CreateStyledText(_leaderboardUI.transform, "Player", new Vector2(-50f, -130f), 16, color, font, (TextAnchor)3, outline: true, bottomAnchor: false, 150f); CreateStyledText(_leaderboardUI.transform, "Reputation", new Vector2(140f, -130f), 16, color, font, (TextAnchor)4, outline: true, bottomAnchor: false, 100f); CreateDividerLine(_leaderboardUI.transform, new Vector2(0f, -150f), 420f); List leaderboard = MessageManagerAlt.GetLeaderboard(); float num = -175f; int num2 = 1; foreach (PlayerReputation item in leaderboard.Take(12)) { bool flag = num2 <= 3; Color val = (Color)(flag ? GetRankColor(num2) : new Color(0.9f, 0.85f, 0.7f)); if (flag) { CreateRowHighlight(_leaderboardUI.transform, new Vector2(0f, num), val); } string rankDisplay = GetRankDisplay(num2); CreateStyledText(_leaderboardUI.transform, rankDisplay, new Vector2(-180f, num), 16, val, font, (TextAnchor)4, outline: true, bottomAnchor: false, 60f); string text = item.PlayerName ?? "Unknown"; if (string.IsNullOrEmpty(text) || string.IsNullOrWhiteSpace(text)) { text = "Anonymous"; } if (text.Length > 18) { text = text.Substring(0, 15) + "..."; } ManualLogSource log = VikingMessagesPlugin.Log; if (log != null) { log.LogInfo((object)$"Leaderboard display: rank={num2}, name='{text}', rep={item.TotalReputation}"); } CreateStyledText(_leaderboardUI.transform, text, new Vector2(-50f, num), 15, val, font2, (TextAnchor)3, outline: true, bottomAnchor: false, 150f); CreateStyledText(_leaderboardUI.transform, item.TotalReputation.ToString(), new Vector2(140f, num), 16, val, font, (TextAnchor)4, outline: true, bottomAnchor: false, 100f); num -= 32f; num2++; } if (leaderboard.Count == 0) { CreateStyledText(_leaderboardUI.transform, "No reputation data yet!", new Vector2(0f, -220f), 18, new Color(0.75f, 0.7f, 0.55f), font, (TextAnchor)4, outline: true); CreateStyledText(_leaderboardUI.transform, "Place messages and earn votes to appear here.", new Vector2(0f, -255f), 14, new Color(0.6f, 0.55f, 0.45f), font2, (TextAnchor)4, outline: true); } if ((Object)(object)Player.m_localPlayer != (Object)null) { long playerID = Player.m_localPlayer.GetPlayerID(); if (MessageManagerAlt.IsPlayerInTop3(playerID)) { CreateStyledText(_leaderboardUI.transform, "★ You are in the Top 3! Buffs Active ★", new Vector2(0f, 80f), 16, new Color(0.4f, 1f, 0.4f), font, (TextAnchor)4, outline: true, bottomAnchor: true); } } CreateCloseButton(_leaderboardUI.transform); } private static void CreateStyledText(Transform parent, string text, Vector2 position, int fontSize, Color color, Font font, TextAnchor alignment, bool outline, bool bottomAnchor = false, float width = 400f) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0062: 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_0092: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Text_" + text.Substring(0, Math.Min(10, text.Length))); val.transform.SetParent(parent, false); Text val2 = val.AddComponent(); val2.text = text; val2.font = font ?? Resources.GetBuiltinResource("Arial.ttf"); val2.fontSize = fontSize; ((Graphic)val2).color = color; val2.alignment = alignment; val2.horizontalOverflow = (HorizontalWrapMode)1; val2.verticalOverflow = (VerticalWrapMode)1; RectTransform component = val.GetComponent(); component.sizeDelta = new Vector2(width, 30f); if (bottomAnchor) { component.anchorMin = new Vector2(0.5f, 0f); component.anchorMax = new Vector2(0.5f, 0f); } else { component.anchorMin = new Vector2(0.5f, 1f); component.anchorMax = new Vector2(0.5f, 1f); } component.anchoredPosition = position; if (outline) { Outline val3 = val.AddComponent(); ((Shadow)val3).effectColor = Color.black; ((Shadow)val3).effectDistance = new Vector2(1f, -1f); } } private static void CreateDividerLine(Transform parent, Vector2 position, float width) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0031: 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_0060: 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_0082: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Divider"); val.transform.SetParent(parent, false); Image val2 = val.AddComponent(); ((Graphic)val2).color = new Color(0.5f, 0.4f, 0.25f); RectTransform component = val.GetComponent(); component.sizeDelta = new Vector2(width, 2f); component.anchorMin = new Vector2(0.5f, 1f); component.anchorMax = new Vector2(0.5f, 1f); component.anchoredPosition = position; } private static void CreateRowHighlight(Transform parent, Vector2 position, Color baseColor) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("RowHighlight"); val.transform.SetParent(parent, false); Image val2 = val.AddComponent(); ((Graphic)val2).color = new Color(baseColor.r * 0.25f, baseColor.g * 0.25f, baseColor.b * 0.15f, 0.4f); RectTransform component = val.GetComponent(); component.sizeDelta = new Vector2(420f, 28f); component.anchorMin = new Vector2(0.5f, 1f); component.anchorMax = new Vector2(0.5f, 1f); component.anchoredPosition = position; val.transform.SetSiblingIndex(3); } private static void CreateCloseButton(Transform parent) { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00db: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Expected O, but got Unknown //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Expected O, but got Unknown //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown //IL_0027: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_033a: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown GUIManager instance = GUIManager.Instance; if (instance != null) { try { GameObject val = instance.CreateButton("Close", parent, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 45f), 140f, 45f); if ((Object)(object)val != (Object)null) { Button component = val.GetComponent