-
Notifications
You must be signed in to change notification settings - Fork 4
/
ReadDialogueHelper.cs
78 lines (74 loc) · 2.66 KB
/
ReadDialogueHelper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System.Collections.Generic;
using System.Linq;
using Archipelago.MultiClient.Net.Enums;
using Archipelago.MultiClient.Net.Models;
using BepInEx.Logging;
using HarmonyLib;
using LunacidAP.Data;
using UnityEngine.SceneManagement;
namespace LunacidAP
{
public class ReadDialogueHelper
{
private static ManualLogSource _log;
public static void Awake(ManualLogSource log)
{
_log = log;
Harmony.CreateAndPatchAll(typeof(ReadDialogueHelper));
}
[HarmonyPatch(typeof(LoreBlock), "ACT")]
[HarmonyPrefix]
private static bool ACT_ExchangeLoreForHelp(LoreBlock __instance)
{
var scene = SceneManager.GetActiveScene().name;
switch (scene)
{
case "HUB_01":
{
switch (__instance.which)
{
case 75:
{
__instance.test_string = DetermineRequestedHints();
break;
}
}
return true;
}
}
return true;
}
private static string DetermineRequestedHints()
{
var hintString = "<size=100%>Clint's Hintbook \n (Be sure to pick up anything in here!)</size> \n \n";
var hints = ArchipelagoClient.AP.Session.DataStorage.GetHints(ArchipelagoClient.AP.SlotID);
var goodHints = new List<Hint>() { };
foreach (var hint in hints)
{
if (!hint.Found && hint.ItemFlags.HasFlag(ItemFlags.Advancement) && hint.FindingPlayer == ArchipelagoClient.AP.SlotID)
{
goodHints.Add(hint);
}
}
if (goodHints.Count() == 0)
{
return hintString + "<size=50%>Nothing to do; good job!</size>";
}
foreach (var hint in goodHints)
{
var item = ConnectionData.ScoutedLocations[hint.LocationId];
var locationName = ArchipelagoClient.AP.GetLocationNameFromID(hint.LocationId);
hintString += $"<size=50%>{item.SlotName} wants {item.Name} at {locationName}</size>\n";
}
return hintString;
}
[HarmonyPatch(typeof(Dialog), "Bye")]
[HarmonyPrefix]
private static bool Bye_MoveStateAhead(Dialog __instance)
{
var sceneName = __instance.gameObject.scene.name;
_log.LogInfo($"{__instance.npc_name}");
return true;
}
}
}