punish v6.8.18.0
This commit is contained in:
commit
060278c1b7
317 changed files with 554155 additions and 0 deletions
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using Dalamud.Game.ClientState.Objects.Enums;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Questionable.Functions;
|
||||
using Questionable.Model;
|
||||
using Questionable.Model.Common;
|
||||
using Questionable.Model.Questing;
|
||||
|
||||
namespace Questionable.Controller.Steps.Interactions;
|
||||
|
||||
internal static class AetheryteFreeOrFavored
|
||||
{
|
||||
internal sealed class Factory : SimpleTaskFactory
|
||||
{
|
||||
public override ITask? CreateTask(Quest quest, QuestSequence sequence, QuestStep step)
|
||||
{
|
||||
if (step.InteractionType != EInteractionType.RegisterFreeOrFavoredAetheryte)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(step.Aetheryte, "step.Aetheryte");
|
||||
return new Register(step.Aetheryte.Value);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed record Register(EAetheryteLocation AetheryteLocation) : ITask
|
||||
{
|
||||
public bool ShouldRedoOnInterrupt()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"RegisterFreeOrFavoredAetheryte({AetheryteLocation})";
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class DoRegister(AetheryteFunctions aetheryteFunctions, GameFunctions gameFunctions, ILogger<DoRegister> logger) : TaskExecutor<Register>()
|
||||
{
|
||||
protected override bool Start()
|
||||
{
|
||||
if (!aetheryteFunctions.IsAetheryteUnlocked(base.Task.AetheryteLocation))
|
||||
{
|
||||
throw new TaskException($"Aetheryte {base.Task.AetheryteLocation} is not attuned");
|
||||
}
|
||||
if (aetheryteFunctions.CanRegisterFreeOrFavoriteAetheryte(base.Task.AetheryteLocation) == AetheryteRegistrationResult.NotPossible)
|
||||
{
|
||||
logger.LogInformation("Could not register aetheryte {AetheryteLocation} as free or favored", base.Task.AetheryteLocation);
|
||||
return false;
|
||||
}
|
||||
base.ProgressContext = InteractionProgressContext.FromActionUseOrDefault(() => gameFunctions.InteractWith((uint)base.Task.AetheryteLocation, ObjectKind.Aetheryte));
|
||||
return true;
|
||||
}
|
||||
|
||||
public override ETaskResult Update()
|
||||
{
|
||||
if (aetheryteFunctions.CanRegisterFreeOrFavoriteAetheryte(base.Task.AetheryteLocation) != AetheryteRegistrationResult.NotPossible)
|
||||
{
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
return ETaskResult.TaskComplete;
|
||||
}
|
||||
|
||||
public override bool ShouldInterruptOnDamage()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue