muffin v7.4.15
This commit is contained in:
parent
9bf3dbdf69
commit
0b1b2d38c7
14 changed files with 1215 additions and 1057 deletions
|
|
@ -63,7 +63,7 @@ internal static class FateAction
|
|||
}
|
||||
foreach (FateActionTarget target in base.Task.Targets)
|
||||
{
|
||||
IGameObject gameObject = gameFunctions.FindObjectByDataId(target.DataId);
|
||||
IGameObject gameObject = gameFunctions.FindObjectByDataId(target.DataId, null, warnIfMissing: false);
|
||||
if (gameObject != null && gameObject.IsTargetable)
|
||||
{
|
||||
bool flag = gameFunctions.UseAction(gameObject, target.Action);
|
||||
|
|
|
|||
|
|
@ -21,9 +21,12 @@ internal static class FateFarming
|
|||
{
|
||||
private DateTime _nextPollAt = DateTime.MinValue;
|
||||
|
||||
private bool _loggedWaitingForFate;
|
||||
|
||||
protected override bool Start()
|
||||
{
|
||||
logger.LogInformation("Waiting for FATE targets to appear ({Count} targets)", base.Task.Targets.Count);
|
||||
_loggedWaitingForFate = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -33,12 +36,24 @@ internal static class FateFarming
|
|||
{
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
ushort currentFateId = gameFunctions.GetCurrentFateId();
|
||||
if (currentFateId == 0)
|
||||
{
|
||||
if (!_loggedWaitingForFate)
|
||||
{
|
||||
logger.LogInformation("No active FATE yet, waiting for FATE to start before checking targets");
|
||||
_loggedWaitingForFate = true;
|
||||
}
|
||||
_nextPollAt = DateTime.Now.AddSeconds(1.0);
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
_loggedWaitingForFate = false;
|
||||
foreach (FateActionTarget target in base.Task.Targets)
|
||||
{
|
||||
IGameObject gameObject = gameFunctions.FindObjectByDataId(target.DataId);
|
||||
IGameObject gameObject = gameFunctions.FindObjectByDataId(target.DataId, null, warnIfMissing: false);
|
||||
if (gameObject != null && gameObject.IsTargetable)
|
||||
{
|
||||
logger.LogInformation("FATE target {DataId} is now targetable", target.DataId);
|
||||
logger.LogInformation("FATE {FateId} active and target {DataId} is targetable", currentFateId, target.DataId);
|
||||
return ETaskResult.TaskComplete;
|
||||
}
|
||||
}
|
||||
|
|
@ -86,7 +101,7 @@ internal static class FateFarming
|
|||
}
|
||||
}
|
||||
|
||||
internal sealed record FateActionLoop(IReadOnlyList<FateActionTarget> Targets) : ITask
|
||||
internal sealed record FateActionLoop(IReadOnlyList<FateActionTarget> Targets, EStatus? RequiredStatusId = null) : ITask
|
||||
{
|
||||
public bool ShouldRedoOnInterrupt()
|
||||
{
|
||||
|
|
@ -103,12 +118,12 @@ internal static class FateFarming
|
|||
{
|
||||
private DateTime _nextActionAt = DateTime.MinValue;
|
||||
|
||||
private bool _fateWasActive;
|
||||
private ushort _trackedFateId;
|
||||
|
||||
protected override bool Start()
|
||||
{
|
||||
logger.LogInformation("Starting FATE action loop with {Count} targets", base.Task.Targets.Count);
|
||||
_fateWasActive = gameFunctions.GetCurrentFateId() != 0;
|
||||
_trackedFateId = gameFunctions.GetCurrentFateId();
|
||||
logger.LogInformation("Starting FATE action loop with {Count} targets, tracking FATE {FateId}", base.Task.Targets.Count, _trackedFateId);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -118,33 +133,31 @@ internal static class FateFarming
|
|||
{
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
bool flag = gameFunctions.GetCurrentFateId() != 0;
|
||||
if (_fateWasActive && !flag)
|
||||
if (base.Task.RequiredStatusId.HasValue && !gameFunctions.HasStatus(base.Task.RequiredStatusId.Value))
|
||||
{
|
||||
bool flag2 = false;
|
||||
foreach (FateActionTarget target in base.Task.Targets)
|
||||
logger.LogInformation("Required status {StatusId} lost during FATE action loop, ending cycle to re-apply", base.Task.RequiredStatusId.Value);
|
||||
return ETaskResult.TaskComplete;
|
||||
}
|
||||
if (_trackedFateId == 0)
|
||||
{
|
||||
_trackedFateId = gameFunctions.GetCurrentFateId();
|
||||
if (_trackedFateId != 0)
|
||||
{
|
||||
IGameObject gameObject = gameFunctions.FindObjectByDataId(target.DataId);
|
||||
if (gameObject != null && gameObject.IsTargetable)
|
||||
{
|
||||
flag2 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag2)
|
||||
{
|
||||
logger.LogInformation("FATE completed (was active, now inactive, no targetable NPCs)");
|
||||
return ETaskResult.TaskComplete;
|
||||
logger.LogInformation("Now tracking FATE {FateId}", _trackedFateId);
|
||||
}
|
||||
}
|
||||
_fateWasActive = flag;
|
||||
foreach (FateActionTarget target2 in base.Task.Targets)
|
||||
if (_trackedFateId != 0 && !gameFunctions.IsFateStillActive(_trackedFateId))
|
||||
{
|
||||
IGameObject gameObject2 = gameFunctions.FindObjectByDataId(target2.DataId);
|
||||
if (gameObject2 != null && gameObject2.IsTargetable)
|
||||
logger.LogInformation("FATE {FateId} is no longer running, cycle complete", _trackedFateId);
|
||||
return ETaskResult.TaskComplete;
|
||||
}
|
||||
foreach (FateActionTarget target in base.Task.Targets)
|
||||
{
|
||||
IGameObject gameObject = gameFunctions.FindObjectByDataId(target.DataId, null, warnIfMissing: false);
|
||||
if (gameObject != null && gameObject.IsTargetable)
|
||||
{
|
||||
bool flag3 = gameFunctions.UseAction(gameObject2, target2.Action);
|
||||
_nextActionAt = (flag3 ? DateTime.Now.AddSeconds(2.5) : DateTime.Now.AddSeconds(0.5));
|
||||
bool flag = gameFunctions.UseAction(gameObject, target.Action);
|
||||
_nextActionAt = (flag ? DateTime.Now.AddSeconds(2.5) : DateTime.Now.AddSeconds(0.5));
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,13 +107,13 @@ internal static class Interact
|
|||
|
||||
public SkipStepConditions? SkipConditions { get; init; }
|
||||
|
||||
public EStatus? RequiredStatusId { get; init; }
|
||||
public EStatus? CompletionStatusId { get; init; }
|
||||
|
||||
public List<QuestWorkValue?> CompletionQuestVariablesFlags { get; }
|
||||
|
||||
public bool HasCompletionQuestVariablesFlags { get; }
|
||||
|
||||
public Task(uint DataId, Quest? Quest, EInteractionType InteractionType, bool SkipMarkerCheck = false, uint? PickUpItemId = null, byte? TaxiStandId = null, SkipStepConditions? SkipConditions = null, List<QuestWorkValue?>? CompletionQuestVariablesFlags = null, EStatus? RequiredStatusId = null)
|
||||
public Task(uint DataId, Quest? Quest, EInteractionType InteractionType, bool SkipMarkerCheck = false, uint? PickUpItemId = null, byte? TaxiStandId = null, SkipStepConditions? SkipConditions = null, List<QuestWorkValue?>? CompletionQuestVariablesFlags = null, EStatus? CompletionStatusId = null)
|
||||
{
|
||||
this.DataId = DataId;
|
||||
this.Quest = Quest;
|
||||
|
|
@ -122,7 +122,7 @@ internal static class Interact
|
|||
this.PickUpItemId = PickUpItemId;
|
||||
this.TaxiStandId = TaxiStandId;
|
||||
this.SkipConditions = SkipConditions;
|
||||
this.RequiredStatusId = RequiredStatusId;
|
||||
this.CompletionStatusId = CompletionStatusId;
|
||||
this.CompletionQuestVariablesFlags = CompletionQuestVariablesFlags ?? new List<QuestWorkValue>();
|
||||
HasCompletionQuestVariablesFlags = Quest != null && CompletionQuestVariablesFlags != null && QuestWorkUtils.HasCompletionFlags(CompletionQuestVariablesFlags);
|
||||
base._002Ector();
|
||||
|
|
@ -139,7 +139,7 @@ internal static class Interact
|
|||
}
|
||||
|
||||
[CompilerGenerated]
|
||||
public void Deconstruct(out uint DataId, out Quest? Quest, out EInteractionType InteractionType, out bool SkipMarkerCheck, out uint? PickUpItemId, out byte? TaxiStandId, out SkipStepConditions? SkipConditions, out List<QuestWorkValue?>? CompletionQuestVariablesFlags, out EStatus? RequiredStatusId)
|
||||
public void Deconstruct(out uint DataId, out Quest? Quest, out EInteractionType InteractionType, out bool SkipMarkerCheck, out uint? PickUpItemId, out byte? TaxiStandId, out SkipStepConditions? SkipConditions, out List<QuestWorkValue?>? CompletionQuestVariablesFlags, out EStatus? CompletionStatusId)
|
||||
{
|
||||
DataId = this.DataId;
|
||||
Quest = this.Quest;
|
||||
|
|
@ -149,7 +149,7 @@ internal static class Interact
|
|||
TaxiStandId = this.TaxiStandId;
|
||||
SkipConditions = this.SkipConditions;
|
||||
CompletionQuestVariablesFlags = this.CompletionQuestVariablesFlags;
|
||||
RequiredStatusId = this.RequiredStatusId;
|
||||
CompletionStatusId = this.CompletionStatusId;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -228,10 +228,10 @@ internal static class Interact
|
|||
}
|
||||
_needsUnmount = false;
|
||||
}
|
||||
EStatus? requiredStatusId = base.Task.RequiredStatusId;
|
||||
if (requiredStatusId.HasValue)
|
||||
EStatus? completionStatusId = base.Task.CompletionStatusId;
|
||||
if (completionStatusId.HasValue)
|
||||
{
|
||||
EStatus valueOrDefault = requiredStatusId.GetValueOrDefault();
|
||||
EStatus valueOrDefault = completionStatusId.GetValueOrDefault();
|
||||
if (gameFunctions.HasStatus(valueOrDefault))
|
||||
{
|
||||
return ETaskResult.TaskComplete;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue