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.InteropServices; using System.Runtime.Versioning; using BepInEx; using DiskCardGame; using HarmonyLib; using OLD_SA.CardTraits; using OLD_SA.Evolution; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("OLD_SA_Sigil")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OLD_SA_Sigil")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("59150cfa-2a48-413c-bd72-7da85784e761")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace OLD_SA.Dialogue; public static class DialogueColorAPI { public static Color? CurrentColor; } public static class OLD_SA_SaveManager { [Serializable] private class DialogueSaveData { public List SigilDialogues = new List(); public List EvolutionDialogues = new List(); public List TraitDialogues = new List(); } private static string PathFile => Path.Combine(Application.persistentDataPath, "OLD_SA_Save.json"); public static void Save() { DialogueSaveData dialogueSaveData = new DialogueSaveData(); dialogueSaveData.SigilDialogues = SigilDialogueSaveData.GetSaveList(); dialogueSaveData.EvolutionDialogues = EvolutionAPI.GetTriggeredDialogues(); dialogueSaveData.TraitDialogues = CardTraitDialogueSaveData.GetSaveList(); string contents = JsonUtility.ToJson((object)dialogueSaveData, true); try { File.WriteAllText(PathFile, contents); Debug.Log((object)"OLD SA Save Complete"); } catch (Exception ex) { Debug.LogError((object)("OLD SA Save Failed: " + ex.Message)); } } public static void Load() { if (!File.Exists(PathFile)) { Debug.Log((object)"OLD SA Save Not Found"); return; } try { string text = File.ReadAllText(PathFile); DialogueSaveData dialogueSaveData = JsonUtility.FromJson(text); if (dialogueSaveData != null) { SigilDialogueSaveData.LoadFromList(dialogueSaveData.SigilDialogues); EvolutionAPI.LoadTriggeredDialogues(dialogueSaveData.EvolutionDialogues); CardTraitDialogueSaveData.LoadFromList(dialogueSaveData.TraitDialogues); Debug.Log((object)"OLD SA Load Complete"); } } catch (Exception ex) { Debug.LogError((object)("OLD SA Load Failed: " + ex.Message)); } } } [BepInPlugin("OLD_SA.Dialogue", "OLD SA Dialogue", "1.0.0")] public class Plugin : BaseUnityPlugin { private void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown OLD_SA_SaveManager.Load(); Harmony val = new Harmony("OLD_SA.Dialogue"); val.PatchAll(); Debug.Log((object)"OLD SA Dialogue Loaded"); } } public static class SigilDialogueAPI { public static bool ShowingDialogue; public static IEnumerator ShowFirstTime(string sigilID, string dialogue) { return ShowFirstTime(sigilID, dialogue, null); } public static IEnumerator ShowFirstTime(string sigilID, string dialogue, PlayableCard triggerCard = null) { if (SigilDialogueSaveData.HasTriggered(sigilID)) { yield break; } SigilDialogueSaveData.AddTriggered(sigilID); OLD_SA_SaveManager.Save(); DialogueColorAPI.CurrentColor = null; if ((Object)(object)triggerCard != (Object)null && (Object)(object)((Card)triggerCard).Info != (Object)null) { string cardName = ((Object)((Card)triggerCard).Info).name; if (cardName == "OLD_SA_WIND_PTEROSAUR") { DialogueColorAPI.CurrentColor = Color.cyan; } if (cardName == "OLD_SA_BEE_QUEEN") { DialogueColorAPI.CurrentColor = Color.yellow; } } ShowingDialogue = true; if ((Object)(object)Singleton.Instance != (Object)null) { Singleton.Instance.Controller.LockState = (ViewLockState)1; } if ((Object)(object)Singleton.Instance != (Object)null) { Singleton.Instance.PlayingLocked = true; } try { if ((Object)(object)Singleton.Instance != (Object)null) { yield return Singleton.Instance.ShowUntilInput(dialogue, -2.5f, 0.5f, (Emotion)0, (LetterAnimation)0, (Speaker)0, (string[])null, true); } } finally { if ((Object)(object)Singleton.Instance != (Object)null) { Singleton.Instance.PlayingLocked = false; } if ((Object)(object)Singleton.Instance != (Object)null) { Singleton.Instance.Controller.LockState = (ViewLockState)0; } DialogueColorAPI.CurrentColor = null; ShowingDialogue = false; } } } public static class SigilDialogueSaveData { private static HashSet Triggered = new HashSet(); public static int Count => Triggered.Count; public static bool HasTriggered(string id) { if (string.IsNullOrEmpty(id)) { return false; } return Triggered.Contains(id); } public static void AddTriggered(string id) { if (!string.IsNullOrEmpty(id) && !Triggered.Contains(id)) { Triggered.Add(id); } } public static void Remove(string id) { if (!string.IsNullOrEmpty(id)) { Triggered.Remove(id); } } public static void Clear() { Triggered.Clear(); } public static List GetSaveList() { return new List(Triggered); } public static void LoadFromList(List data) { Triggered.Clear(); if (data == null) { return; } foreach (string datum in data) { if (!string.IsNullOrEmpty(datum)) { Triggered.Add(datum); } } } } [HarmonyPatch] public static class SigilDialogueSavePatch { [HarmonyPatch(typeof(SaveFile), "Initialize")] [HarmonyPostfix] public static void InitializePostfix() { OLD_SA_SaveManager.Load(); Debug.Log((object)"OLD SA Dialogue Save Loaded"); } [HarmonyPatch(typeof(SaveManager), "SaveToFile")] [HarmonyPostfix] public static void SaveToFilePostfix(bool saveActiveScene) { OLD_SA_SaveManager.Save(); Debug.Log((object)"OLD SA Dialogue Save Saved"); } } [HarmonyPatch(typeof(TextDisplayer), "ShowMessage")] public static class TextDisplayerColorPatch { [HarmonyPostfix] public static void Postfix(TextDisplayer __instance) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (!DialogueColorAPI.CurrentColor.HasValue) { return; } FieldInfo fieldInfo = AccessTools.Field(typeof(TextDisplayer), "textMesh"); if (fieldInfo == null) { return; } object value = fieldInfo.GetValue(__instance); if (value != null) { PropertyInfo property = value.GetType().GetProperty("color"); if (property != null && property.CanWrite) { property.SetValue(value, DialogueColorAPI.CurrentColor.Value); } } } }