From 28068f197601f76e8cc9633899d464bcd5d4fcd4 Mon Sep 17 00:00:00 2001 From: Witchybun Date: Wed, 30 Oct 2024 21:33:16 -0500 Subject: [PATCH] Add Fortune Teller Hint System --- .gitignore | 2 ++ Archipelago/ArchipelagoData.cs | 15 +++++++++++---- DialogueHelper.cs | 30 ++++++++++++++++++++++++++++++ Plugin.cs | 3 ++- QuestFixer.cs | 32 ++++++++++++++++++++++++++++++-- 5 files changed, 75 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 90e9b20..0e62d79 100644 --- a/.gitignore +++ b/.gitignore @@ -118,3 +118,5 @@ obj/Release/netstandard2.1/FlipwitchAP.pdb obj/Release/netstandard2.1/MyPluginInfo.cs bin/Debug/netstandard2.1/Ak.Wwise.Api.WAAPI.dll bin/Debug/netstandard2.1/AK.Wwise.Unity.Timeline.dll +bin/Release/netstandard2.1/Ak.Wwise.Api.WAAPI.dll +bin/Release/netstandard2.1/AK.Wwise.Unity.Timeline.dll diff --git a/Archipelago/ArchipelagoData.cs b/Archipelago/ArchipelagoData.cs index 43e1f83..58cd6cf 100644 --- a/Archipelago/ArchipelagoData.cs +++ b/Archipelago/ArchipelagoData.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using Archipelago.MultiClient.Net.Models; using FlipwitchAP.Data; using Newtonsoft.Json; @@ -28,6 +29,7 @@ public class ArchipelagoData private string ANGEL_KEY = "angel_order"; private string HINT_KEY = "hints"; private string QUEST_KEY = "quest_for_sex"; + private string FORTUNE_KEY = "path"; public string ClientVersion { get; private set; } public int Seed { get; set; } public Gender StartingGender { get; private set; } @@ -35,11 +37,13 @@ public class ArchipelagoData public bool CrystalTeleport { get; private set; } public Quest QuestForSex { get; private set; } public bool DeathLink { get; private set; } - public List AnimalGachaOrder {get; private set; } - public List BunnyGachaOrder {get; private set; } - public List MonsterGachaOrder {get; private set; } - public List AngelGachaOrder {get; private set; } + public List AnimalGachaOrder { get; private set; } + public List BunnyGachaOrder { get; private set; } + public List MonsterGachaOrder { get; private set; } + public List AngelGachaOrder { get; private set; } public Dictionary HintLookup { get; private set; } + public Dictionary FortuneTellerLookup { get; private set; } + public bool IsTherePlaythroughGenerated { get; private set; } public SortedDictionary ScoutedLocations = new() { }; private Dictionary slotData; @@ -80,6 +84,9 @@ public void SetupSession(Dictionary roomSlotData) AngelGachaOrder = ProcessGachaList(JsonConvert.DeserializeObject>(angelOrderData)); var hintData = GetSlotSetting(HINT_KEY, ""); HintLookup = JsonConvert.DeserializeObject>(hintData); + var pathData = GetSlotSetting(FORTUNE_KEY, ""); + FortuneTellerLookup = JsonConvert.DeserializeObject>(pathData); + IsTherePlaythroughGenerated = FortuneTellerLookup.Any(); } // Why...? diff --git a/DialogueHelper.cs b/DialogueHelper.cs index c691460..d06fa05 100644 --- a/DialogueHelper.cs +++ b/DialogueHelper.cs @@ -146,5 +146,35 @@ private static Dictionary HandleGroupedMessages(Dictionary) translationDictionaryField.GetValue(SwitchDatabase.instance.dialogueManager); + foreach (var fortunePair in ArchipelagoClient.ServerData.FortuneTellerLookup) + { + if (fortunePair.Key == -100) // Last one; victory + { + translationDictionary["Psychic.1.1"] = fortunePair.Value; + break; + } + var wasLocationChecked = Plugin.ArchipelagoClient.IsLocationChecked(fortunePair.Key); + if (wasLocationChecked) + { + continue; + } + translationDictionary["Psychic.1.1"] = fortunePair.Value; + break; + } + translationDictionaryField.SetValue(SwitchDatabase.instance.dialogueManager, translationDictionary); + } } } \ No newline at end of file diff --git a/Plugin.cs b/Plugin.cs index 65867d2..d91b0ac 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -15,7 +15,7 @@ public class Plugin : BaseUnityPlugin { public const string PluginGUID = "com.Albrekka.FlipwitchAP"; public const string PluginName = "FlipwitchAP"; - public const string PluginVersion = "0.2.0pre3"; + public const string PluginVersion = "0.2.0pre4"; private const string APDisplayInfo = $"Archipelago v{ArchipelagoClient.APVersion}"; public static ArchipelagoClient ArchipelagoClient { get; private set; } public static bool IsInGame = false; @@ -118,6 +118,7 @@ private void OnSceneLoaded(Scene scene, LoadSceneMode mode) ArchipelagoClient.SendCurrentScene(trueName); } } + DialogueHelper.GenerateCurrentHintForFortuneTeller(scene.name); } // Display was shamelessly used from Hunie Pop 2's implementation, by dotsofdarkness, since I just want the window on the right. diff --git a/QuestFixer.cs b/QuestFixer.cs index fc368f1..ecfc5c6 100644 --- a/QuestFixer.cs +++ b/QuestFixer.cs @@ -1,4 +1,5 @@ using System.Linq; +using FlipwitchAP.Data; using HarmonyLib; using UnityEngine; @@ -420,7 +421,7 @@ private static void Start_FixQuests(NPCDialogueAdvanced __instance) switchValue = 2, comparisonOperator = ComparisonOperators.IS_LESS_THAN }; - + if (!senseiGroups[4].switches.Any(x => x.switchName == "APPlayerWand")) { senseiGroups[4].switches[1] = receivedNoWandUpgrade; @@ -437,7 +438,7 @@ private static void Start_FixQuests(NPCDialogueAdvanced __instance) { senseiGroups[7].switches[1] = receivedFirstWandNotSecond; } - + // 4 is first wand upgrade but wrong // 5 is first wand upgrade // 6 is second but you're a woman @@ -474,6 +475,33 @@ private static void Start_FixQuests(NPCDialogueAdvanced __instance) } return; } + case "FortuneTeller": + { + var madeUpShit = new NPCDialogueAdvanced.SwitchRequirement() + { + switchName = "APMYFUGGENDICC", + switchValue = 999, + comparisonOperator = ComparisonOperators.IS_EQUAL_TO + }; + var fortuneGroups = __instance.dialogueGroups; + if (!fortuneGroups[0].switches.Any(x => x.switchName == "APMYFUGGENDICC")) + { + fortuneGroups[0].switches.Add(madeUpShit); + } + if (!fortuneGroups[2].switches.Any(x => x.switchName == "APMYFUGGENDICC")) + { + fortuneGroups[2].itemRequirements.Clear(); + } + for (var i = 3; i < 9; i++) + { + if (!fortuneGroups[i].switches.Any(x => x.switchName == "APMYFUGGENDICC")) + { + fortuneGroups[i].switches.Add(madeUpShit); + } + } + DialogueHelper.GenerateCurrentHintForFortuneTeller(__instance.gameObject.scene.name); + return; + } } } }