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 NoMapHints v1.0.0
BepInEx/plugins/NoMapHints/NoMapHints.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("NoMapHints")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NoMapHints")] [assembly: AssemblyTitle("NoMapHints")] [assembly: AssemblyVersion("1.0.0.0")] namespace NoMapHints; internal static class InvasionHint { private const string JotunInvasionName = "jotun invasion"; private static readonly string[] LetterTokens = new string[4] { "$nomaphints_dir_n", "$nomaphints_dir_e", "$nomaphints_dir_s", "$nomaphints_dir_w" }; private static readonly int[][] CompassPoints = new int[16][] { new int[1], new int[3] { 0, 0, 1 }, new int[2] { 0, 1 }, new int[3] { 1, 0, 1 }, new int[1] { 1 }, new int[3] { 1, 2, 1 }, new int[2] { 2, 1 }, new int[3] { 2, 2, 1 }, new int[1] { 2 }, new int[3] { 2, 2, 3 }, new int[2] { 2, 3 }, new int[3] { 3, 2, 3 }, new int[1] { 3 }, new int[3] { 3, 0, 3 }, new int[2] { 0, 3 }, new int[3] { 0, 0, 3 } }; private static readonly HashSet<int> KnownEvents = new HashSet<int>(); private static readonly List<ActivePersistentEvent> ActiveInvasions = new List<ActivePersistentEvent>(); internal static void Tick() { if (Plugin.Enabled.Value) { PersistentEventSystem instance = PersistentEventSystem.instance; if (!((Object)(object)instance == (Object)null) && instance.m_activePersistentEvents != null) { RefreshActiveInvasions(instance); } } } private static void RefreshActiveInvasions(PersistentEventSystem eventSystem) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) ActiveInvasions.Clear(); List<ActivePersistentEvent> list = eventSystem.m_activePersistentEvents.list; if (list != null) { foreach (ActivePersistentEvent item in list) { if (item == null || item.sourceEventId < 0 || item.sourceEventId >= eventSystem.m_possibleEvents.Count) { continue; } PersistentEvent val = eventSystem.m_possibleEvents[item.sourceEventId]; if (val != null && IsJotunInvasion(val)) { ActiveInvasions.Add(item); if (!KnownEvents.Contains(item.eventId) && !((Object)(object)Chat.instance == (Object)null)) { string directionWords = GetDirectionWords(Vector3.zero, item.position); string localizedEventName = GetLocalizedEventName(eventSystem, item); string text = string.Format(Localization.instance.Localize("$nomaphints_hint"), localizedEventName, directionWords); ((Terminal)Chat.instance).AddString(text); KnownEvents.Add(item.eventId); } } } } List<int> list2 = new List<int>(); foreach (int knownEventId in KnownEvents) { if (!ActiveInvasions.Exists((ActivePersistentEvent x) => x.eventId == knownEventId)) { list2.Add(knownEventId); } } foreach (int item2 in list2) { KnownEvents.Remove(item2); } } private static bool IsJotunInvasion(PersistentEvent source) { if (!ContainsJotunInvasion(source.internalName)) { return ContainsJotunInvasion(source.mapTokenString); } return true; } private static bool ContainsJotunInvasion(string value) { if (string.IsNullOrEmpty(value)) { return false; } string text = value.Replace("_", "").Replace("-", "").Replace(" ", ""); if (text.IndexOf("jotuninvasion", StringComparison.OrdinalIgnoreCase) < 0) { return string.Equals(text, "jotun invasion".Replace(" ", ""), StringComparison.OrdinalIgnoreCase); } return true; } private static string GetLocalizedEventName(PersistentEventSystem eventSystem, ActivePersistentEvent activeEvent) { string mapTokenString = eventSystem.m_possibleEvents[activeEvent.sourceEventId].mapTokenString; if (!string.IsNullOrEmpty(mapTokenString)) { return Localization.instance.Localize(mapTokenString); } return Localization.instance.Localize("$nomaphints_event_generic"); } private static string GetDirectionWords(Vector3 from, Vector3 to) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = to - from; float num = Mathf.Atan2(val.x, val.z) * 57.29578f; if (num < 0f) { num += 360f; } int num2 = Mathf.RoundToInt(num / 22.5f) % 16; object obj; switch (Localization.instance.GetSelectedLanguage()) { default: obj = " "; break; case "Chinese": case "Japanese": case "Korean": obj = ""; break; } string value = (string)obj; StringBuilder stringBuilder = new StringBuilder(); int[] array = CompassPoints[num2]; for (int i = 0; i < array.Length; i++) { if (i > 0) { stringBuilder.Append(value); } stringBuilder.Append(Localization.instance.Localize(LetterTokens[array[i]])); } return stringBuilder.ToString(); } } [BepInPlugin("com.igentuman.nomaphints", "No Map Hints", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "com.igentuman.nomaphints"; public const string PluginName = "No Map Hints"; public const string PluginVersion = "1.0.0"; internal static ConfigEntry<bool> Enabled; private void Awake() { BindConfiguration(); AddLocalization(); } private void Update() { InvasionHint.Tick(); } private void BindConfiguration() { Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Post one directional chat message when a new Jotun Invasion is detected."); } private static void AddLocalization() { CustomLocalization localization = LocalizationManager.Instance.GetLocalization(); string text = "English"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "nomaphints_hint", "{0}: {1} from map center" }, { "nomaphints_event_generic", "Invasion" }, { "nomaphints_dir_n", "North" }, { "nomaphints_dir_e", "East" }, { "nomaphints_dir_s", "South" }, { "nomaphints_dir_w", "West" } }); text = "Russian"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "nomaphints_hint", "{0}: {1} от центра карты" }, { "nomaphints_event_generic", "Нашествие" }, { "nomaphints_dir_n", "Север" }, { "nomaphints_dir_e", "Восток" }, { "nomaphints_dir_s", "Юг" }, { "nomaphints_dir_w", "Запад" } }); text = "German"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "nomaphints_hint", "{0}: {1} vom Kartenmittelpunkt" }, { "nomaphints_event_generic", "Invasion" }, { "nomaphints_dir_n", "Nord" }, { "nomaphints_dir_e", "Ost" }, { "nomaphints_dir_s", "Süd" }, { "nomaphints_dir_w", "West" } }); text = "French"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "nomaphints_hint", "{0} : {1} du centre de la carte" }, { "nomaphints_event_generic", "Invasion" }, { "nomaphints_dir_n", "Nord" }, { "nomaphints_dir_e", "Est" }, { "nomaphints_dir_s", "Sud" }, { "nomaphints_dir_w", "Ouest" } }); text = "Spanish"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "nomaphints_hint", "{0}: {1} desde el centro del mapa" }, { "nomaphints_event_generic", "Invasión" }, { "nomaphints_dir_n", "Norte" }, { "nomaphints_dir_e", "Este" }, { "nomaphints_dir_s", "Sur" }, { "nomaphints_dir_w", "Oeste" } }); text = "Portuguese_Brazilian"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "nomaphints_hint", "{0}: {1} do centro do mapa" }, { "nomaphints_event_generic", "Invasão" }, { "nomaphints_dir_n", "Norte" }, { "nomaphints_dir_e", "Leste" }, { "nomaphints_dir_s", "Sul" }, { "nomaphints_dir_w", "Oeste" } }); text = "Polish"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "nomaphints_hint", "{0}: {1} od środka mapy" }, { "nomaphints_event_generic", "Inwazja" }, { "nomaphints_dir_n", "Północ" }, { "nomaphints_dir_e", "Wschód" }, { "nomaphints_dir_s", "Południe" }, { "nomaphints_dir_w", "Zachód" } }); text = "Ukrainian"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "nomaphints_hint", "{0}: {1} від центру мапи" }, { "nomaphints_event_generic", "Навала" }, { "nomaphints_dir_n", "Північ" }, { "nomaphints_dir_e", "Схід" }, { "nomaphints_dir_s", "Південь" }, { "nomaphints_dir_w", "Захід" } }); text = "Swedish"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "nomaphints_hint", "{0}: {1} från kartans mitt" }, { "nomaphints_event_generic", "Invasion" }, { "nomaphints_dir_n", "Norr" }, { "nomaphints_dir_e", "Öster" }, { "nomaphints_dir_s", "Söder" }, { "nomaphints_dir_w", "Väster" } }); text = "Chinese"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "nomaphints_hint", "{0}:从地图中心向{1}" }, { "nomaphints_event_generic", "入侵事件" }, { "nomaphints_dir_n", "北" }, { "nomaphints_dir_e", "东" }, { "nomaphints_dir_s", "南" }, { "nomaphints_dir_w", "西" } }); text = "Japanese"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "nomaphints_hint", "{0}:地図の中心から{1}" }, { "nomaphints_event_generic", "侵略イベント" }, { "nomaphints_dir_n", "北" }, { "nomaphints_dir_e", "東" }, { "nomaphints_dir_s", "南" }, { "nomaphints_dir_w", "西" } }); text = "Korean"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "nomaphints_hint", "{0}: 지도 중심에서 {1} 방향" }, { "nomaphints_event_generic", "침공 이벤트" }, { "nomaphints_dir_n", "북" }, { "nomaphints_dir_e", "동" }, { "nomaphints_dir_s", "남" }, { "nomaphints_dir_w", "서" } }); } }