forked from liza/Questionable
add startsinglequest too
this is probably more useful for my usecases anyway after a bit of testing
This commit is contained in:
parent
f72fafbf6a
commit
e24c28b4a4
12
Questionable/External/QuestionableIpc.cs
vendored
12
Questionable/External/QuestionableIpc.cs
vendored
@ -15,11 +15,13 @@ internal sealed class QuestionableIpc : IDisposable
|
|||||||
private const string IpcGetCurrentQuestId = "Questionable.GetCurrentQuestId";
|
private const string IpcGetCurrentQuestId = "Questionable.GetCurrentQuestId";
|
||||||
private const string IpcGetCurrentlyActiveEventQuests = "Questionable.GetCurrentlyActiveEventQuests";
|
private const string IpcGetCurrentlyActiveEventQuests = "Questionable.GetCurrentlyActiveEventQuests";
|
||||||
private const string IpcStartQuest = "Questionable.StartQuest";
|
private const string IpcStartQuest = "Questionable.StartQuest";
|
||||||
|
private const string IpcStartSingleQuest = "Questionable.StartSingleQuest";
|
||||||
|
|
||||||
private readonly ICallGateProvider<bool> _isRunning;
|
private readonly ICallGateProvider<bool> _isRunning;
|
||||||
private readonly ICallGateProvider<string?> _getCurrentQuestId;
|
private readonly ICallGateProvider<string?> _getCurrentQuestId;
|
||||||
private readonly ICallGateProvider<List<string>> _getCurrentlyActiveEventQuests;
|
private readonly ICallGateProvider<List<string>> _getCurrentlyActiveEventQuests;
|
||||||
private readonly ICallGateProvider<string, bool> _startQuest;
|
private readonly ICallGateProvider<string, bool> _startQuest;
|
||||||
|
private readonly ICallGateProvider<string, bool> _startSingleQuest;
|
||||||
|
|
||||||
public QuestionableIpc(
|
public QuestionableIpc(
|
||||||
QuestController questController,
|
QuestController questController,
|
||||||
@ -39,14 +41,20 @@ internal sealed class QuestionableIpc : IDisposable
|
|||||||
eventInfoComponent.GetCurrentlyActiveEventQuests().Select(q => q.ToString()).ToList());
|
eventInfoComponent.GetCurrentlyActiveEventQuests().Select(q => q.ToString()).ToList());
|
||||||
|
|
||||||
_startQuest = pluginInterface.GetIpcProvider<string, bool>(IpcStartQuest);
|
_startQuest = pluginInterface.GetIpcProvider<string, bool>(IpcStartQuest);
|
||||||
_startQuest.RegisterFunc((string questId) => StartQuest(questController, questRegistry, questId));
|
_startQuest.RegisterFunc((string questId) => StartQuest(questController, questRegistry, questId, false));
|
||||||
|
|
||||||
|
_startSingleQuest = pluginInterface.GetIpcProvider<string, bool>(IpcStartSingleQuest);
|
||||||
|
_startSingleQuest.RegisterFunc((string questId) => StartQuest(questController, questRegistry, questId, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool StartQuest(QuestController qc, QuestRegistry qr, string questId)
|
private static bool StartQuest(QuestController qc, QuestRegistry qr, string questId, bool single)
|
||||||
{
|
{
|
||||||
if (ElementId.TryFromString(questId, out var elementId) && elementId != null && qr.TryGetQuest(elementId, out var quest))
|
if (ElementId.TryFromString(questId, out var elementId) && elementId != null && qr.TryGetQuest(elementId, out var quest))
|
||||||
{
|
{
|
||||||
qc.SetNextQuest(quest);
|
qc.SetNextQuest(quest);
|
||||||
|
if (single)
|
||||||
|
qc.StartSingleQuest("IPCQuestSelection");
|
||||||
|
else
|
||||||
qc.Start("IPCQuestSelection");
|
qc.Start("IPCQuestSelection");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user