forked from liza/Questionable
Handle specific dialogue interactions while in a duty
This commit is contained in:
parent
15c97d55f7
commit
2a4ce09cda
@ -42,6 +42,7 @@ internal sealed class InteractionUiController : IDisposable
|
||||
private readonly GatheringPointRegistry _gatheringPointRegistry;
|
||||
private readonly QuestRegistry _questRegistry;
|
||||
private readonly QuestData _questData;
|
||||
private readonly TerritoryData _territoryData;
|
||||
private readonly IGameGui _gameGui;
|
||||
private readonly ITargetManager _targetManager;
|
||||
private readonly IClientState _clientState;
|
||||
@ -61,6 +62,7 @@ internal sealed class InteractionUiController : IDisposable
|
||||
GatheringPointRegistry gatheringPointRegistry,
|
||||
QuestRegistry questRegistry,
|
||||
QuestData questData,
|
||||
TerritoryData territoryData,
|
||||
IGameGui gameGui,
|
||||
ITargetManager targetManager,
|
||||
IPluginLog pluginLog,
|
||||
@ -77,6 +79,7 @@ internal sealed class InteractionUiController : IDisposable
|
||||
_gatheringPointRegistry = gatheringPointRegistry;
|
||||
_questRegistry = questRegistry;
|
||||
_questData = questData;
|
||||
_territoryData = territoryData;
|
||||
_gameGui = gameGui;
|
||||
_targetManager = targetManager;
|
||||
_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()
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ internal sealed class TerritoryData
|
||||
{
|
||||
private readonly ImmutableDictionary<uint, string> _territoryNames;
|
||||
private readonly ImmutableHashSet<ushort> _territoriesWithMount;
|
||||
private readonly ImmutableHashSet<ushort> _dutyTerritories;
|
||||
private readonly ImmutableDictionary<ushort, uint> _dutyTerritories;
|
||||
private readonly ImmutableDictionary<ushort, string> _instanceNames;
|
||||
|
||||
public TerritoryData(IDataManager dataManager)
|
||||
@ -35,8 +35,7 @@ internal sealed class TerritoryData
|
||||
|
||||
_dutyTerritories = dataManager.GetExcelSheet<TerritoryType>()!
|
||||
.Where(x => x.RowId > 0 && x.ContentFinderCondition.Row != 0)
|
||||
.Select(x => (ushort)x.RowId)
|
||||
.ToImmutableHashSet();
|
||||
.ToImmutableDictionary(x => (ushort)x.RowId, x => x.ContentFinderCondition.Value!.ContentType.Row);
|
||||
|
||||
_instanceNames = dataManager.GetExcelSheet<ContentFinderCondition>()!
|
||||
.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 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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user