using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using SailwindModdingHelper;
using UnityEngine;
using cakeslice;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Sail-a-dex")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sail-a-dex")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("165a01b3-48da-400d-a25f-d6d01b2b3120")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace sailadex;
public class FishCaughtUI : MonoBehaviour
{
public static FishCaughtUI instance;
public Dictionary<string, int> caughtFish;
public TextMesh[] fishNameTMs;
public TextMesh[] caughtCountTMs;
private void Awake()
{
instance = this;
caughtFish = new Dictionary<string, int>();
GameObject[] value = Traverse.Create((object)OceanFishes.instance).Field("fishPrefabs").GetValue<GameObject[]>();
GameObject[] array = value;
foreach (GameObject val in array)
{
caughtFish.Add(((Object)val).name, 0);
}
}
public void RegisterCatch(string fishName)
{
caughtFish[fishName]++;
}
public void UpdateTexts()
{
int num = 0;
foreach (KeyValuePair<string, int> item in caughtFish)
{
if (Plugin.fishNamesHidden.Value)
{
fishNameTMs[num].text = ((item.Value > 0) ? item.Key.Substring(3, item.Key.IndexOf("(") - 4) : "???");
}
else
{
fishNameTMs[num].text = item.Key.Substring(3, item.Key.IndexOf("(") - 4);
}
caughtCountTMs[num].text = item.Value.ToString();
num++;
}
}
}
internal class LogUIPatches
{
[HarmonyPatch(typeof(MissionListUI))]
private class MissionListUIPatches
{
[HarmonyPostfix]
[HarmonyPatch("HideUI")]
public static void HideUIPatches(MissionListUI __instance)
{
if (Plugin.fishCaughtUIEnabled.Value)
{
fishCaughtUI.SetActive(false);
}
if (Plugin.portsVisitedUIEnabled.Value)
{
portsVisitedUI.SetActive(false);
}
}
[HarmonyPostfix]
[HarmonyPatch("SwitchMode")]
public static void SwitchModePatches(MissionListMode mode)
{
//IL_0035: 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_0037: 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_003b: Invalid comparison between Unknown and I4
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Invalid comparison between Unknown and I4
if (Plugin.fishCaughtUIEnabled.Value)
{
fishCaughtUI.SetActive(false);
}
if (Plugin.portsVisitedUIEnabled.Value)
{
portsVisitedUI.SetActive(false);
}
if ((int)mode != 5)
{
if ((int)mode == 6)
{
portsVisitedUI.SetActive(true);
portsVisitedUI.GetComponent<PortsVisitedUI>().UpdateTexts();
}
}
else
{
fishCaughtUI.SetActive(true);
fishCaughtUI.GetComponent<FishCaughtUI>().UpdateTexts();
}
}
[HarmonyPrefix]
[HarmonyPatch("Start")]
public static void StartPatch(MissionListUI __instance, GameObject ___modeButtons, GameObject ___reputationUI)
{
if (Plugin.fishCaughtUIEnabled.Value)
{
MakeFishCaughtUI(___modeButtons, ___reputationUI);
}
if (Plugin.portsVisitedUIEnabled.Value)
{
MakePortsVisitedUI(___modeButtons, ___reputationUI);
}
}
private static void MakeFishCaughtUI(GameObject modeButtons, GameObject repUI)
{
//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_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_006e: 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_00a4: 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_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_037f: Unknown result type (might be due to invalid IL or missing references)
//IL_0384: Unknown result type (might be due to invalid IL or missing references)
//IL_039e: Unknown result type (might be due to invalid IL or missing references)
//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
GameObject gameObject = ((Component)modeButtons.transform.GetChild(9)).gameObject;
bookmarkFishCaught = Object.Instantiate<GameObject>(gameObject);
bookmarkFishCaught.transform.parent = modeButtons.transform;
Transform transform = bookmarkFishCaught.transform;
Vector3 localPosition = gameObject.transform.localPosition;
float num = ((Vector3)(ref localPosition))[1];
localPosition = gameObject.transform.localPosition;
transform.localPosition = new Vector3(-0.27f, num, ((Vector3)(ref localPosition))[2]);
bookmarkFishCaught.transform.localRotation = gameObject.transform.localRotation;
bookmarkFishCaught.transform.localScale = gameObject.transform.localScale;
((Object)bookmarkFishCaught).name = "bookmark fish caught";
((Component)bookmarkFishCaught.transform.GetChild(0)).gameObject.GetComponent<TextMesh>().text = "fish caught";
GPButtonLogMode component = bookmarkFishCaught.GetComponent<GPButtonLogMode>();
Traverse.Create((object)component).Field("mode").SetValue((object)(MissionListMode)5);
Object.Destroy((Object)(object)bookmarkFishCaught.GetComponent<Outline>());
fishCaughtUI = Object.Instantiate<GameObject>(repUI);
Object.Destroy((Object)(object)fishCaughtUI.GetComponent<ReputationUI>());
fishCaughtUI.transform.parent = repUI.transform.parent;
fishCaughtUI.transform.localPosition = repUI.transform.localPosition;
fishCaughtUI.transform.localRotation = repUI.transform.localRotation;
fishCaughtUI.transform.localScale = repUI.transform.localScale;
((Object)fishCaughtUI).name = "fish caught ui";
Object.Destroy((Object)(object)((Component)fishCaughtUI.transform.GetChild(2)).gameObject);
Object.Destroy((Object)(object)((Component)fishCaughtUI.transform.GetChild(1)).gameObject);
fishCaughtUI.AddComponent<FishCaughtUI>();
GameObject[] value = Traverse.Create((object)OceanFishes.instance).Field("fishPrefabs").GetValue<GameObject[]>();
GameObject gameObject2 = ((Component)fishCaughtUI.transform.GetChild(0)).gameObject;
gameObject2.GetComponent<TextMesh>().font = ((Component)gameObject2.transform.GetChild(1)).GetComponent<TextMesh>().font;
((Renderer)gameObject2.GetComponent<MeshRenderer>()).material = ((Renderer)((Component)gameObject2.transform.GetChild(1)).GetComponent<MeshRenderer>()).material;
((Object)((Component)gameObject2.transform.GetChild(1)).gameObject).name = "caught count";
Transform child = gameObject2.transform.GetChild(1);
localPosition = gameObject2.transform.GetChild(1).localPosition;
child.localPosition = new Vector3(70f, 0f, ((Vector3)(ref localPosition))[2]);
TextMesh[] array = (TextMesh[])(object)new TextMesh[value.Length];
TextMesh[] array2 = (TextMesh[])(object)new TextMesh[value.Length];
for (int i = 0; i < value.Length; i++)
{
GameObject val = Object.Instantiate<GameObject>(gameObject2);
Object.Destroy((Object)(object)((Component)val.transform.GetChild(4)).gameObject);
Object.Destroy((Object)(object)((Component)val.transform.GetChild(3)).gameObject);
Object.Destroy((Object)(object)((Component)val.transform.GetChild(2)).gameObject);
Object.Destroy((Object)(object)((Component)val.transform.GetChild(0)).gameObject);
((Object)val).name = ((Object)value[i]).name;
val.transform.parent = gameObject2.transform.parent;
Transform transform2 = val.transform;
localPosition = gameObject2.transform.localPosition;
float num2 = ((Vector3)(ref localPosition))[1] - 0.04f * (float)i;
localPosition = gameObject2.transform.localPosition;
transform2.localPosition = new Vector3(0.75f, num2, ((Vector3)(ref localPosition))[2]);
val.transform.localRotation = gameObject2.transform.localRotation;
val.transform.localScale = gameObject2.transform.localScale;
array2[i] = val.GetComponent<TextMesh>();
array[i] = ((Component)val.transform.GetChild(1)).GetComponent<TextMesh>();
}
Object.Destroy((Object)(object)gameObject2);
fishCaughtUI.GetComponent<FishCaughtUI>().fishNameTMs = array2;
fishCaughtUI.GetComponent<FishCaughtUI>().caughtCountTMs = array;
}
private static void MakePortsVisitedUI(GameObject modeButtons, GameObject repUI)
{
//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_005e: 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_0094: 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_016c: 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_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: 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_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: 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_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
//IL_02d9: 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_031b: Unknown result type (might be due to invalid IL or missing references)
//IL_0400: Unknown result type (might be due to invalid IL or missing references)
//IL_042e: Unknown result type (might be due to invalid IL or missing references)
//IL_048f: Unknown result type (might be due to invalid IL or missing references)
//IL_0494: Unknown result type (might be due to invalid IL or missing references)
//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0506: Unknown result type (might be due to invalid IL or missing references)
//IL_0560: Unknown result type (might be due to invalid IL or missing references)
//IL_0565: Unknown result type (might be due to invalid IL or missing references)
//IL_0576: Unknown result type (might be due to invalid IL or missing references)
//IL_057b: Unknown result type (might be due to invalid IL or missing references)
//IL_0596: Unknown result type (might be due to invalid IL or missing references)
//IL_059b: Unknown result type (might be due to invalid IL or missing references)
//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
//IL_05be: Unknown result type (might be due to invalid IL or missing references)
//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
GameObject gameObject = ((Component)modeButtons.transform.GetChild(9)).gameObject;
bookmarkPortsVisited = Object.Instantiate<GameObject>(gameObject);
bookmarkPortsVisited.transform.parent = modeButtons.transform;
Transform transform = bookmarkPortsVisited.transform;
Vector3 localPosition = gameObject.transform.localPosition;
transform.localPosition = new Vector3(-0.397f, 0.0028f, ((Vector3)(ref localPosition))[2]);
bookmarkPortsVisited.transform.localRotation = gameObject.transform.localRotation;
bookmarkPortsVisited.transform.localScale = gameObject.transform.localScale;
((Object)bookmarkPortsVisited).name = "bookmark ports visited";
((Component)bookmarkPortsVisited.transform.GetChild(0)).gameObject.GetComponent<TextMesh>().text = "ports visited";
GPButtonLogMode component = bookmarkPortsVisited.GetComponent<GPButtonLogMode>();
Traverse.Create((object)component).Field("mode").SetValue((object)(MissionListMode)6);
Object.Destroy((Object)(object)bookmarkPortsVisited.GetComponent<Outline>());
portsVisitedUI = Object.Instantiate<GameObject>(repUI);
Object.Destroy((Object)(object)portsVisitedUI.GetComponent<ReputationUI>());
portsVisitedUI.transform.parent = repUI.transform.parent;
portsVisitedUI.transform.localPosition = repUI.transform.localPosition;
portsVisitedUI.transform.localRotation = repUI.transform.localRotation;
portsVisitedUI.transform.localScale = repUI.transform.localScale;
((Object)portsVisitedUI).name = "ports visited ui";
portsVisitedUI.AddComponent<PortsVisitedUI>();
Transform child = portsVisitedUI.transform.GetChild(0);
localPosition = portsVisitedUI.transform.GetChild(0).localPosition;
child.localPosition = new Vector3(0.75f, 0.22f, ((Vector3)(ref localPosition))[2]);
Transform child2 = portsVisitedUI.transform.GetChild(1);
localPosition = portsVisitedUI.transform.GetChild(1).localPosition;
child2.localPosition = new Vector3(0.75f, 0.01f, ((Vector3)(ref localPosition))[2]);
Transform child3 = portsVisitedUI.transform.GetChild(2);
localPosition = portsVisitedUI.transform.GetChild(2).localPosition;
child3.localPosition = new Vector3(0.02f, 0.22f, ((Vector3)(ref localPosition))[2]);
GameObject val = Object.Instantiate<GameObject>(((Component)portsVisitedUI.transform.GetChild(1)).gameObject);
val.transform.parent = portsVisitedUI.transform;
Transform transform2 = val.transform;
localPosition = portsVisitedUI.transform.GetChild(1).localPosition;
transform2.localPosition = new Vector3(0.02f, 0.01f, ((Vector3)(ref localPosition))[2]);
val.transform.localRotation = portsVisitedUI.transform.GetChild(1).localRotation;
val.transform.localScale = portsVisitedUI.transform.GetChild(1).localScale;
((Object)val).name = "lagoon";
val.GetComponent<TextMesh>().text = "Fire Fish Lagoon";
TextMesh[] array = (TextMesh[])(object)new TextMesh[24];
TextMesh[] array2 = (TextMesh[])(object)new TextMesh[24];
int num = 0;
int[] array3 = new int[4] { 7, 6, 7, 4 };
for (int i = 0; i < 4; i++)
{
Transform child4 = portsVisitedUI.transform.GetChild(i);
Object.Destroy((Object)(object)((Component)child4.GetChild(1)).gameObject);
Object.Destroy((Object)(object)((Component)child4.GetChild(2)).gameObject);
Object.Destroy((Object)(object)((Component)child4.GetChild(4)).gameObject);
GameObject gameObject2 = ((Component)child4.GetChild(0)).gameObject;
GameObject gameObject3 = ((Component)child4.GetChild(3)).gameObject;
((Object)gameObject2).name = "port1";
gameObject2.transform.localPosition = new Vector3(5f, -8f, -0.1f);
((Object)gameObject3).name = "visited port1";
gameObject3.transform.localPosition = new Vector3(70f, -9f, 0f);
array[num] = gameObject2.GetComponent<TextMesh>();
array2[num] = gameObject3.GetComponent<TextMesh>();
num++;
for (int j = 1; j < array3[i]; j++)
{
GameObject val2 = Object.Instantiate<GameObject>(gameObject2);
val2.transform.parent = gameObject2.transform.parent;
Transform transform3 = val2.transform;
localPosition = gameObject2.transform.localPosition;
float num2 = ((Vector3)(ref localPosition))[0];
localPosition = gameObject2.transform.localPosition;
float num3 = ((Vector3)(ref localPosition))[1] - 7.5f * (float)j;
localPosition = gameObject2.transform.localPosition;
transform3.localPosition = new Vector3(num2, num3, ((Vector3)(ref localPosition))[2]);
val2.transform.localRotation = gameObject2.transform.localRotation;
val2.transform.localScale = gameObject2.transform.localScale;
((Object)val2).name = "port" + (j + 1);
GameObject val3 = Object.Instantiate<GameObject>(gameObject3);
val3.transform.parent = gameObject3.transform.parent;
Transform transform4 = val3.transform;
localPosition = gameObject3.transform.localPosition;
float num4 = ((Vector3)(ref localPosition))[0];
localPosition = gameObject3.transform.localPosition;
float num5 = ((Vector3)(ref localPosition))[1] - 7.5f * (float)j;
localPosition = gameObject3.transform.localPosition;
transform4.localPosition = new Vector3(num4, num5, ((Vector3)(ref localPosition))[2]);
val3.transform.localRotation = gameObject3.transform.localRotation;
val3.transform.localScale = gameObject3.transform.localScale;
((Object)val3).name = "visited port" + (j + 1);
array[num] = val2.GetComponent<TextMesh>();
array2[num] = val3.GetComponent<TextMesh>();
num++;
}
}
portsVisitedUI.GetComponent<PortsVisitedUI>().portNameTMs = array;
portsVisitedUI.GetComponent<PortsVisitedUI>().portVisitedTMs = array2;
}
}
[HarmonyPatch(typeof(FishingRodFish))]
private class FishingRodFishPatches
{
[HarmonyPrefix]
[HarmonyPatch("CollectFish")]
public static void CollectFishPatch(FishingRodFish __instance, GameObject ___currentFish)
{
if (Plugin.fishCaughtUIEnabled.Value)
{
fishCaughtUI.GetComponent<FishCaughtUI>().RegisterCatch(((Object)___currentFish).name);
}
}
}
[HarmonyPatch(typeof(IslandMarketWarehouseArea))]
private class IslandMarketWarehouseAreaPatches
{
[HarmonyPostfix]
[HarmonyPatch("OnTriggerEnter")]
public static void OnTriggerEnterPatch(IslandMarketWarehouseArea __instance, IslandMarket ___market, Collider other)
{
if (Plugin.portsVisitedUIEnabled.Value && ((Component)other).CompareTag("Player"))
{
portsVisitedUI.GetComponent<PortsVisitedUI>().RegisterVisit(___market.GetPortName());
}
}
}
[HarmonyPatch(typeof(SaveLoadManager))]
private class SaveLoadManagerPatches
{
[HarmonyPostfix]
[HarmonyPatch("SaveModData")]
public static void DoSaveGamePatch()
{
RaddudeSaveContainer raddudeSaveContainer = new RaddudeSaveContainer();
if (Plugin.fishCaughtUIEnabled.Value)
{
raddudeSaveContainer.caughtFish = fishCaughtUI.GetComponent<FishCaughtUI>().caughtFish.ToDictionary((KeyValuePair<string, int> entry) => entry.Key, (KeyValuePair<string, int> entry) => entry.Value);
}
if (Plugin.portsVisitedUIEnabled.Value)
{
raddudeSaveContainer.visitedPorts = portsVisitedUI.GetComponent<PortsVisitedUI>().visitedPorts.ToDictionary((KeyValuePair<string, bool> entry) => entry.Key, (KeyValuePair<string, bool> entry) => entry.Value);
}
ModSave.Save(((BaseUnityPlugin)Plugin.instance).Info, (object)raddudeSaveContainer);
}
[HarmonyPatch("LoadModData")]
[HarmonyPostfix]
public static void LoadModDataPatch()
{
RaddudeSaveContainer raddudeSaveContainer = default(RaddudeSaveContainer);
if (!ModSave.Load<RaddudeSaveContainer>(((BaseUnityPlugin)Plugin.instance).Info, ref raddudeSaveContainer))
{
Plugin.logger.LogWarning((object)"Raddude.sailadex: Save file loading failed. File is either corrupt or does not exist. If this is the first time loading this save with this mod, this is normal.");
return;
}
if (raddudeSaveContainer.caughtFish != null && Plugin.fishCaughtUIEnabled.Value)
{
foreach (KeyValuePair<string, int> item in raddudeSaveContainer.caughtFish)
{
if (fishCaughtUI.GetComponent<FishCaughtUI>().caughtFish.ContainsKey(item.Key))
{
fishCaughtUI.GetComponent<FishCaughtUI>().caughtFish[item.Key] = item.Value;
}
}
}
if (raddudeSaveContainer.visitedPorts == null || !Plugin.portsVisitedUIEnabled.Value)
{
return;
}
foreach (KeyValuePair<string, bool> visitedPort in raddudeSaveContainer.visitedPorts)
{
if (portsVisitedUI.GetComponent<PortsVisitedUI>().visitedPorts.ContainsKey(visitedPort.Key))
{
portsVisitedUI.GetComponent<PortsVisitedUI>().visitedPorts[visitedPort.Key] = visitedPort.Value;
}
}
}
}
[Serializable]
public class RaddudeSaveContainer
{
public Dictionary<string, int> caughtFish;
public Dictionary<string, bool> visitedPorts;
}
private static GameObject bookmarkFishCaught;
private static GameObject bookmarkPortsVisited;
private static GameObject fishCaughtUI;
private static GameObject portsVisitedUI;
public const MissionListMode fishCaught = 5;
public const MissionListMode portsVisited = 6;
}
[BepInPlugin("com.raddude82.sailadex", "Sail-A-Dex", "1.0.0")]
[BepInDependency("com.app24.sailwindmoddinghelper", "2.0.3")]
public class Plugin : BaseUnityPlugin
{
public const string PLUGIN_ID = "com.raddude82.sailadex";
public const string PLUGIN_NAME = "Sail-A-Dex";
public const string PLUGIN_VERSION = "1.0.0";
internal static Plugin instance;
internal static ManualLogSource logger;
internal static ConfigEntry<bool> fishNamesHidden;
internal static ConfigEntry<bool> portNamesHidden;
internal static ConfigEntry<bool> fishCaughtUIEnabled;
internal static ConfigEntry<bool> portsVisitedUIEnabled;
internal static Harmony harmony;
private void Awake()
{
instance = this;
logger = ((BaseUnityPlugin)this).Logger;
fishNamesHidden = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Hide Fish Names Before Caught", true, "true = the fish names will be hidden before being caught for the first time.");
portNamesHidden = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Hide Port Names Before Visited", false, "true = the port names will be hidden before visited for the first time.");
fishCaughtUIEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Enable Fish Caught UI", true, "true = the UI for how many fish you caught will be enabled. Setting to false, continuing a game where previously enabled, and then saving will erase all previous recorded fish caught progress.");
portsVisitedUIEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Enable Ports Visited UI", true, "true = the UI which ports you have visited will be enabled. Setting to false, continuing a game where previously enabled, and then saving will erase all previous recorded port visit progress.");
harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.raddude82.sailadex");
}
private void OnDestroy()
{
logger.LogInfo((object)"Destroying and unpatching com.raddude82.sailadex");
harmony.UnpatchSelf();
}
}
public class PortsVisitedUI : MonoBehaviour
{
public static PortsVisitedUI instance;
public Dictionary<string, bool> visitedPorts;
public TextMesh[] portNameTMs;
public TextMesh[] portVisitedTMs;
private void Awake()
{
instance = this;
visitedPorts = new Dictionary<string, bool>();
string[] array = new string[24]
{
"Gold Rock City", "Al'Nilem", "Neverdin", "Albacore Town", "Alchemist's Island", "Al'Ankh Academy", "Oasis", "Dragon Cliffs", "Sanctuary", "Crab Beach",
"New Port", "Sage Hills", "Serpent Isle", "Fort Aestrin", "Sunspire", "Mount Malefic", "Siren Song", "Eastwind", "Happy Bay", "Chronos",
"Kicia Bay", "Fire Fish Town", "On'na", "Sen'na"
};
string[] array2 = array;
foreach (string key in array2)
{
visitedPorts.Add(key, value: false);
}
}
public void RegisterVisit(string portName)
{
if (visitedPorts.ContainsKey(portName))
{
visitedPorts[portName] = true;
}
}
public void UpdateTexts()
{
int num = 0;
foreach (KeyValuePair<string, bool> visitedPort in visitedPorts)
{
if (Plugin.portNamesHidden.Value)
{
portNameTMs[num].text = (visitedPort.Value ? visitedPort.Key : "???");
}
else
{
portNameTMs[num].text = visitedPort.Key;
}
portVisitedTMs[num].text = (visitedPort.Value ? "✓" : "✗");
num++;
}
}
}