Combat + Skip updates
This commit is contained in:
parent
e40084ada1
commit
377b5501b6
@ -21,6 +21,8 @@ public sealed class SkipStepConditions
|
||||
|
||||
public bool HasSkipConditions()
|
||||
{
|
||||
return Never || Flying != null || Chocobo != null || InTerritory.Count > 0 || NotInTerritory.Count > 0 || Item != null;
|
||||
if (Never)
|
||||
return false;
|
||||
return Flying != null || Chocobo != null || InTerritory.Count > 0 || NotInTerritory.Count > 0 || Item != null;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Plugin.Services;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||
using FFXIVClientStructs.FFXIV.Common.Math;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Questionable.Controller.CombatModules;
|
||||
@ -211,24 +212,43 @@ internal sealed class CombatController : IDisposable
|
||||
if (battleNpc.BattleNpcKind is BattleNpcSubKind.BattleNpcPart or BattleNpcSubKind.Enemy)
|
||||
{
|
||||
var gameObjectStruct = (GameObject*)gameObject.Address;
|
||||
if (gameObjectStruct->NamePlateIconId is 60093 or 60732) // npc that starts a fate or does turn-ins; not sure why they're marked as hostile
|
||||
|
||||
// npc that starts a fate or does turn-ins; not sure why they're marked as hostile
|
||||
if (gameObjectStruct->NamePlateIconId is 60093 or 60732)
|
||||
return 0;
|
||||
|
||||
var enemyData = _currentFight?.Data.ComplexCombatDatas.FirstOrDefault(x => x.DataId == battleNpc.DataId);
|
||||
var enemyData =
|
||||
_currentFight?.Data.ComplexCombatDatas.FirstOrDefault(x => x.DataId == battleNpc.DataId);
|
||||
if (enemyData is { IgnoreQuestMarker: true })
|
||||
return battleNpc.StatusFlags.HasFlag(StatusFlags.InCombat) ? 20 : 0;
|
||||
{
|
||||
if (battleNpc.StatusFlags.HasFlag(StatusFlags.InCombat))
|
||||
return 20;
|
||||
}
|
||||
else
|
||||
return gameObjectStruct->NamePlateIconId != 0 ? 30 : 0;
|
||||
{
|
||||
if (gameObjectStruct->NamePlateIconId != 0)
|
||||
return 30;
|
||||
}
|
||||
}
|
||||
|
||||
// stuff trying to kill us
|
||||
if (battleNpc.TargetObjectId == _clientState.LocalPlayer?.GameObjectId)
|
||||
return 10;
|
||||
|
||||
// stuff on our enmity list that's not necessarily targeting us
|
||||
var haters = UIState.Instance()->Hater;
|
||||
for (int i = 0; i < haters.HaterCount; ++i)
|
||||
{
|
||||
var hater = haters.Haters[i];
|
||||
if (hater.EntityId == battleNpc.GameObjectId)
|
||||
return 5;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
|
@ -113,7 +113,9 @@ internal static class Combat
|
||||
if (questWork == null)
|
||||
return ETaskResult.StillRunning;
|
||||
|
||||
if (!QuestWorkUtils.MatchesQuestWork(_completionQuestVariableFlags, questWork.Value, false))
|
||||
if (QuestWorkUtils.MatchesQuestWork(_completionQuestVariableFlags, questWork.Value, false))
|
||||
return ETaskResult.TaskComplete;
|
||||
else
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
|
||||
|
@ -22,23 +22,23 @@ internal static class SkipCondition
|
||||
public ITask? CreateTask(Quest quest, QuestSequence sequence, QuestStep step)
|
||||
{
|
||||
var skipConditions = step.SkipConditions?.StepIf;
|
||||
if (skipConditions == null || skipConditions.Never)
|
||||
if (skipConditions is { Never: true })
|
||||
return null;
|
||||
|
||||
if (skipConditions.HasSkipConditions() &&
|
||||
step.CompletionQuestVariablesFlags.Count == 0 &&
|
||||
if ((skipConditions == null || !skipConditions.HasSkipConditions()) &&
|
||||
!QuestWorkUtils.HasCompletionFlags(step.CompletionQuestVariablesFlags) &&
|
||||
step.RequiredQuestVariables.Count == 0 &&
|
||||
step.PickUpQuestId == null &&
|
||||
step.NextQuestId == null)
|
||||
return null;
|
||||
|
||||
return serviceProvider.GetRequiredService<CheckTask>()
|
||||
.With(step, skipConditions, quest.QuestId);
|
||||
return serviceProvider.GetRequiredService<CheckSkip>()
|
||||
.With(step, skipConditions ?? new(), quest.QuestId);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class CheckTask(
|
||||
ILogger<CheckTask> logger,
|
||||
internal sealed class CheckSkip(
|
||||
ILogger<CheckSkip> logger,
|
||||
GameFunctions gameFunctions,
|
||||
IClientState clientState) : ITask
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ internal static class QuestWorkUtils
|
||||
}
|
||||
|
||||
public static bool MatchesRequiredQuestWorkConfig(List<List<QuestWorkValue>?> requiredQuestVariables,
|
||||
QuestWork questWork, ILogger<SkipCondition.CheckTask> logger)
|
||||
QuestWork questWork, ILogger<SkipCondition.CheckSkip> logger)
|
||||
{
|
||||
if (requiredQuestVariables.Count != 6 || requiredQuestVariables.All(x => x == null || x.Count == 0))
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ public sealed class QuestionablePlugin : IDalamudPlugin
|
||||
// task factories
|
||||
serviceCollection.AddTaskWithFactory<StepDisabled.Factory, StepDisabled.Task>();
|
||||
serviceCollection.AddTaskWithFactory<AetheryteShortcut.Factory, AetheryteShortcut.UseAetheryteShortcut>();
|
||||
serviceCollection.AddTaskWithFactory<SkipCondition.Factory, SkipCondition.CheckTask>();
|
||||
serviceCollection.AddTaskWithFactory<SkipCondition.Factory, SkipCondition.CheckSkip>();
|
||||
serviceCollection.AddTaskWithFactory<AethernetShortcut.Factory, AethernetShortcut.UseAethernetShortcut>();
|
||||
serviceCollection.AddTaskWithFactory<WaitAtStart.Factory, WaitAtStart.WaitDelay>();
|
||||
serviceCollection.AddTaskWithFactory<Move.Factory, Move.MoveInternal, Move.ExpectToBeNearDataId, Move.Land>();
|
||||
|
Loading…
Reference in New Issue
Block a user