forked from liza/Questionable
Handle specific dialogue interactions while in a duty
This commit is contained in:
parent
15c97d55f7
commit
2a4ce09cda
Questionable
@ -42,6 +42,7 @@ internal sealed class InteractionUiController : IDisposable
|
|||||||
private readonly GatheringPointRegistry _gatheringPointRegistry;
|
private readonly GatheringPointRegistry _gatheringPointRegistry;
|
||||||
private readonly QuestRegistry _questRegistry;
|
private readonly QuestRegistry _questRegistry;
|
||||||
private readonly QuestData _questData;
|
private readonly QuestData _questData;
|
||||||
|
private readonly TerritoryData _territoryData;
|
||||||
private readonly IGameGui _gameGui;
|
private readonly IGameGui _gameGui;
|
||||||
private readonly ITargetManager _targetManager;
|
private readonly ITargetManager _targetManager;
|
||||||
private readonly IClientState _clientState;
|
private readonly IClientState _clientState;
|
||||||
@ -61,6 +62,7 @@ internal sealed class InteractionUiController : IDisposable
|
|||||||
GatheringPointRegistry gatheringPointRegistry,
|
GatheringPointRegistry gatheringPointRegistry,
|
||||||
QuestRegistry questRegistry,
|
QuestRegistry questRegistry,
|
||||||
QuestData questData,
|
QuestData questData,
|
||||||
|
TerritoryData territoryData,
|
||||||
IGameGui gameGui,
|
IGameGui gameGui,
|
||||||
ITargetManager targetManager,
|
ITargetManager targetManager,
|
||||||
IPluginLog pluginLog,
|
IPluginLog pluginLog,
|
||||||
@ -77,6 +79,7 @@ internal sealed class InteractionUiController : IDisposable
|
|||||||
_gatheringPointRegistry = gatheringPointRegistry;
|
_gatheringPointRegistry = gatheringPointRegistry;
|
||||||
_questRegistry = questRegistry;
|
_questRegistry = questRegistry;
|
||||||
_questData = questData;
|
_questData = questData;
|
||||||
|
_territoryData = territoryData;
|
||||||
_gameGui = gameGui;
|
_gameGui = gameGui;
|
||||||
_targetManager = targetManager;
|
_targetManager = targetManager;
|
||||||
_clientState = clientState;
|
_clientState = clientState;
|
||||||
@ -101,7 +104,9 @@ internal sealed class InteractionUiController : IDisposable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldHandleUiInteractions => _isInitialCheck || _questController.IsRunning;
|
private bool ShouldHandleUiInteractions => _isInitialCheck ||
|
||||||
|
_questController.IsRunning ||
|
||||||
|
_territoryData.IsQuestBattleInstance(_clientState.TerritoryType);
|
||||||
|
|
||||||
internal unsafe void HandleCurrentDialogueChoices()
|
internal unsafe void HandleCurrentDialogueChoices()
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@ internal sealed class TerritoryData
|
|||||||
{
|
{
|
||||||
private readonly ImmutableDictionary<uint, string> _territoryNames;
|
private readonly ImmutableDictionary<uint, string> _territoryNames;
|
||||||
private readonly ImmutableHashSet<ushort> _territoriesWithMount;
|
private readonly ImmutableHashSet<ushort> _territoriesWithMount;
|
||||||
private readonly ImmutableHashSet<ushort> _dutyTerritories;
|
private readonly ImmutableDictionary<ushort, uint> _dutyTerritories;
|
||||||
private readonly ImmutableDictionary<ushort, string> _instanceNames;
|
private readonly ImmutableDictionary<ushort, string> _instanceNames;
|
||||||
|
|
||||||
public TerritoryData(IDataManager dataManager)
|
public TerritoryData(IDataManager dataManager)
|
||||||
@ -35,8 +35,7 @@ internal sealed class TerritoryData
|
|||||||
|
|
||||||
_dutyTerritories = dataManager.GetExcelSheet<TerritoryType>()!
|
_dutyTerritories = dataManager.GetExcelSheet<TerritoryType>()!
|
||||||
.Where(x => x.RowId > 0 && x.ContentFinderCondition.Row != 0)
|
.Where(x => x.RowId > 0 && x.ContentFinderCondition.Row != 0)
|
||||||
.Select(x => (ushort)x.RowId)
|
.ToImmutableDictionary(x => (ushort)x.RowId, x => x.ContentFinderCondition.Value!.ContentType.Row);
|
||||||
.ToImmutableHashSet();
|
|
||||||
|
|
||||||
_instanceNames = dataManager.GetExcelSheet<ContentFinderCondition>()!
|
_instanceNames = dataManager.GetExcelSheet<ContentFinderCondition>()!
|
||||||
.Where(x => x.RowId > 0 && x.Content != 0 && x.ContentLinkType == 1 && x.ContentType.Row != 6)
|
.Where(x => x.RowId > 0 && x.Content != 0 && x.ContentLinkType == 1 && x.ContentType.Row != 6)
|
||||||
@ -56,7 +55,10 @@ internal sealed class TerritoryData
|
|||||||
|
|
||||||
public bool CanUseMount(ushort territoryId) => _territoriesWithMount.Contains(territoryId);
|
public bool CanUseMount(ushort territoryId) => _territoriesWithMount.Contains(territoryId);
|
||||||
|
|
||||||
public bool IsDutyInstance(ushort territoryId) => _dutyTerritories.Contains(territoryId);
|
public bool IsDutyInstance(ushort territoryId) => _dutyTerritories.ContainsKey(territoryId);
|
||||||
|
|
||||||
|
public bool IsQuestBattleInstance(ushort territoryId) =>
|
||||||
|
_dutyTerritories.TryGetValue(territoryId, out uint contentType) && contentType == 7;
|
||||||
|
|
||||||
public string? GetInstanceName(ushort instanceId) => _instanceNames.GetValueOrDefault(instanceId);
|
public string? GetInstanceName(ushort instanceId) => _instanceNames.GetValueOrDefault(instanceId);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user