using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Managers; using Microsoft.CodeAnalysis; using Splatform; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; using Windheim.Config; using Windheim.ShipRecall; [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("Windheim")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Windheim")] [assembly: AssemblyTitle("Windheim")] [assembly: AssemblyVersion("1.0.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 Windheim { [BepInPlugin("com.TAIJI.windheim", "WindheimShips", "0.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class WindheimPlugin : BaseUnityPlugin { public const string PluginGUID = "com.TAIJI.windheim"; public const string PluginName = "WindheimShips"; public const string PluginVersion = "0.1.0"; public static WindheimPlugin Instance { get; private set; } private void Awake() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00c2: 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) Instance = this; GeneralConfig.Bind(((BaseUnityPlugin)this).Config); FleetConfig.Bind(((BaseUnityPlugin)this).Config); RecallConfig.Bind(((BaseUnityPlugin)this).Config); MapConfig.Bind(((BaseUnityPlugin)this).Config); UIConfig.Bind(((BaseUnityPlugin)this).Config); PersistenceConfig.Bind(((BaseUnityPlugin)this).Config); CompatibilityConfig.Bind(((BaseUnityPlugin)this).Config); DebugConfig.Bind(((BaseUnityPlugin)this).Config); ExperimentalConfig.Bind(((BaseUnityPlugin)this).Config); InputManager.Instance.AddButton("com.TAIJI.windheim", new ButtonConfig { Name = "WH_ShipRecall", Key = RecallConfig.RecallKey.Value, HintToken = "Recall Ship" }); new Harmony("com.TAIJI.windheim").PatchAll(); GameObject val = new GameObject("Windheim_Host"); Object.DontDestroyOnLoad((Object)val); val.AddComponent(); val.AddComponent(); val.AddComponent(); if (GeneralConfig.ShowWelcomeMessage.Value) { Logger.LogInfo((object)"WindheimShips 0.1.0 loaded."); } } private void Update() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Player.m_localPlayer == (Object)null)) { QuickRecallUI instance = QuickRecallUI.Instance; if ((instance == null || !instance.IsOpen) && !IsTyping() && Input.GetKeyDown(RecallConfig.RecallKey.Value)) { ShipRecallSystem.Instance?.TrySummon(); } } } private static bool IsTyping() { try { EventSystem current = EventSystem.current; if ((Object)(object)current == (Object)null) { return false; } GameObject currentSelectedGameObject = current.currentSelectedGameObject; InputField val = default(InputField); return (Object)(object)currentSelectedGameObject != (Object)null && currentSelectedGameObject.TryGetComponent(ref val); } catch { return false; } } } [HarmonyPatch(typeof(Ship), "Awake")] internal static class Patch_Ship_Awake { private static void Postfix(Ship __instance) { ShipRegistry.Instance?.RegisterShip(__instance); } } } namespace Windheim.ShipRecall { public class QuickRecallUI : MonoBehaviour { private Canvas _canvas; private CanvasGroup _group; private GameObject _root; private const float W = 460f; private const float CARD_W = 310f; private const float CARD_H = 52f; private const float ICON_W = 44f; private const float PAD_TOP = 28f; private const float TITLE_H = 54f; private const float SUB_H = 22f; private const float GAP = 44f; private const float CARD_GAP = 10f; private const float PAD_BOT = 28f; private static readonly Color C_Title = new Color(0.97f, 0.94f, 0.83f, 1f); private static readonly Color C_Sub = new Color(0.78f, 0.72f, 0.58f, 1f); private static readonly Color C_CardBg = new Color(0.04f, 0.04f, 0.03f, 0.84f); private static readonly Color C_CardHov = new Color(0.16f, 0.12f, 0.05f, 0.92f); private static readonly Color C_CardPrs = new Color(0.26f, 0.18f, 0.06f, 0.96f); private static readonly Color C_Name = new Color(0.97f, 0.93f, 0.82f, 1f); private static readonly Color C_NameNone = new Color(0.6f, 0.54f, 0.44f, 1f); private static readonly Color C_IconPri = new Color(0.97f, 0.8f, 0.24f, 1f); private static readonly Color C_IconSec = new Color(0.86f, 0.9f, 0.96f, 1f); private static readonly Color C_Overlay = new Color(0f, 0f, 0f, 0.42f); private static readonly Color C_Border = new Color(0.58f, 0.46f, 0.18f, 0.85f); public static QuickRecallUI Instance { get; private set; } public bool IsOpen { get { if ((Object)(object)_root != (Object)null) { return _root.activeSelf; } return false; } } private static Font NorseFont { get { GUIManager instance = GUIManager.Instance; return ((instance != null) ? instance.NorseBold : null) ?? Resources.GetBuiltinResource("Arial.ttf"); } } private static Font BodyFont { get { GUIManager instance = GUIManager.Instance; object obj = ((instance != null) ? instance.AveriaSerifBold : null); if (obj == null) { GUIManager instance2 = GUIManager.Instance; obj = ((instance2 != null) ? instance2.AveriaSerif : null) ?? Resources.GetBuiltinResource("Arial.ttf"); } return (Font)obj; } } private void Awake() { Instance = this; } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } GUIManager.BlockInput(false); } private void LateUpdate() { if (IsOpen) { Cursor.visible = true; Cursor.lockState = (CursorLockMode)2; if (Input.GetKeyDown((KeyCode)27)) { Close(); } } } public void Open() { EnsureCanvas(); Rebuild(); _root.SetActive(true); GUIManager.BlockInput(true); ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(FadeIn()); } public void Close() { if (IsOpen) { ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(FadeClose()); } } private IEnumerator FadeIn() { if (!((Object)(object)_group == (Object)null)) { _group.alpha = 0f; float t = 0f; while (t < 0.2f) { t += Time.unscaledDeltaTime; _group.alpha = Mathf.Clamp01(t / 0.2f); yield return null; } _group.alpha = 1f; } } private IEnumerator FadeClose() { if ((Object)(object)_group != (Object)null) { float s = _group.alpha; float t = 0f; while (t < 0.14f) { t += Time.unscaledDeltaTime; _group.alpha = Mathf.Lerp(s, 0f, t / 0.14f); yield return null; } _group.alpha = 0f; } if ((Object)(object)_root != (Object)null) { _root.SetActive(false); } GUIManager.BlockInput(false); } private void Rebuild() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_007f: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_0139: 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) if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } ShipRegistry instance = ShipRegistry.Instance; if (!((Object)(object)instance == (Object)null)) { float num = 290f; float leftX = 75f; _root = new GameObject("WH_QR_Root"); _root.transform.SetParent(((Component)_canvas).transform, false); RectTransform obj = _root.AddComponent(); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.5f); obj.anchorMax = val; obj.anchorMin = val; obj.pivot = new Vector2(0.5f, 0.5f); obj.anchoredPosition = Vector2.zero; obj.sizeDelta = new Vector2(460f, num); _group = _root.AddComponent(); GameObject obj2 = MakeGo("Bg", _root.transform); ((Graphic)obj2.AddComponent()).color = C_Overlay; Fill(obj2.GetComponent()); float num2 = -28f; GameObject obj3 = MakeGo("Title", _root.transform); Text obj4 = obj3.AddComponent(); obj4.font = NorseFont; obj4.fontSize = 36; obj4.fontStyle = (FontStyle)1; ((Graphic)obj4).color = C_Title; obj4.alignment = (TextAnchor)4; obj4.supportRichText = true; obj4.text = "∾∾ Windheim Fleet ∾∾"; obj4.horizontalOverflow = (HorizontalWrapMode)1; obj4.verticalOverflow = (VerticalWrapMode)1; PinRT(obj3.GetComponent(), 0f, num2, 460f, 54f); num2 -= 54f; GameObject obj5 = MakeGo("Sub", _root.transform); Text obj6 = obj5.AddComponent(); obj6.font = BodyFont; obj6.fontSize = 12; ((Graphic)obj6).color = C_Sub; obj6.alignment = (TextAnchor)4; obj6.text = "Choose a ship to recall"; obj6.horizontalOverflow = (HorizontalWrapMode)1; obj6.verticalOverflow = (VerticalWrapMode)1; PinRT(obj5.GetComponent(), 0f, num2, 460f, 22f); num2 -= 66f; Game instance2 = Game.instance; object obj7; if (instance2 == null) { obj7 = null; } else { PlayerProfile playerProfile = instance2.GetPlayerProfile(); obj7 = ((playerProfile != null) ? playerProfile.GetName() : null); } if (obj7 == null) { Player localPlayer = Player.m_localPlayer; obj7 = ((localPlayer != null) ? localPlayer.GetPlayerName() : null) ?? "Wanderer"; } string playerName = (string)obj7; BuildCard(_root.transform, instance.Primary, isPrimary: true, leftX, num2, playerName); num2 -= 62f; BuildCard(_root.transform, instance.Secondary, isPrimary: false, leftX, num2, playerName); } } private void BuildCard(Transform parent, ShipRecord rec, bool isPrimary, float leftX, float topY, string playerName) { //IL_0024: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: 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_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: 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_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Expected O, but got Unknown float num = 308f; float num2 = 50f; GameObject val = MakeGo("Border", parent); ((Graphic)val.AddComponent()).color = C_Border; PinRT(val.GetComponent(), leftX, topY, 310f, 52f); GameObject val2 = MakeGo("Fill", val.transform); Image val3 = val2.AddComponent(); ((Graphic)val3).color = C_CardBg; PinRT(val2.GetComponent(), 1f, -1f, num, num2); GameObject obj = MakeGo("IconBg", val2.transform); ((Graphic)obj.AddComponent()).color = new Color(0.07f, 0.06f, 0.04f, 0.72f); PinRT(obj.GetComponent(), 0f, 0f, 44f, num2); float num3 = 24f; BuildIconCell(x: (44f - num3) * 0.5f, y: 0f - Mathf.Floor((num2 - num3) * 0.5f), parent: obj.transform, rec: rec, isPrimary: isPrimary, size: num3); GameObject obj2 = MakeGo("Div", val2.transform); ((Graphic)obj2.AddComponent()).color = new Color(0.5f, 0.4f, 0.16f, 0.6f); PinRT(obj2.GetComponent(), 44f, -8f, 1f, num2 - 16f); float num4 = 58f; float w = num - num4 - 10f; float num5 = 22f; float y = 0f - Mathf.Floor((num2 - num5) * 0.5f); string text = ((rec == null) ? (isPrimary ? "No Flagship" : "No Boat") : (isPrimary ? "Flagship" : "Boat")); GameObject obj3 = MakeGo("Name", val2.transform); Text obj4 = obj3.AddComponent(); obj4.font = NorseFont; obj4.fontSize = 16; ((Graphic)obj4).color = ((rec != null) ? C_Name : C_NameNone); obj4.alignment = (TextAnchor)3; obj4.text = text; obj4.horizontalOverflow = (HorizontalWrapMode)1; obj4.verticalOverflow = (VerticalWrapMode)1; PinRT(obj3.GetComponent(), num4, y, w, num5); if (rec != null) { Button obj5 = val.AddComponent