92 lines
1.9 KiB
C#
92 lines
1.9 KiB
C#
using Questionable.Functions;
|
|
using Questionable.Model.Questing;
|
|
|
|
namespace Questionable.Controller;
|
|
|
|
internal readonly record struct QuestResolution
|
|
{
|
|
public required EQuestResolutionType Type { get; init; }
|
|
|
|
public ElementId? QuestId { get; init; }
|
|
|
|
public byte Sequence { get; init; }
|
|
|
|
public MainScenarioQuestState MsqState { get; init; }
|
|
|
|
public required string DebugReason { get; init; }
|
|
|
|
public int LevelingTargetLevel { get; init; }
|
|
|
|
public string? LevelingQuestName { get; init; }
|
|
|
|
public bool HasQuest
|
|
{
|
|
get
|
|
{
|
|
if (QuestId != null)
|
|
{
|
|
return QuestId.Value != 0;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public bool IsSlotBased
|
|
{
|
|
get
|
|
{
|
|
EQuestResolutionType type = Type;
|
|
if ((uint)type <= 1u)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static QuestResolution Slot(EQuestResolutionType type, QuestController.QuestProgress progress, string reason)
|
|
{
|
|
return new QuestResolution
|
|
{
|
|
Type = type,
|
|
QuestId = progress.Quest.Id,
|
|
Sequence = progress.Sequence,
|
|
MsqState = MainScenarioQuestState.Available,
|
|
DebugReason = reason
|
|
};
|
|
}
|
|
|
|
public static QuestResolution ForQuest(EQuestResolutionType type, ElementId questId, byte sequence, MainScenarioQuestState msqState, string reason)
|
|
{
|
|
return new QuestResolution
|
|
{
|
|
Type = type,
|
|
QuestId = questId,
|
|
Sequence = sequence,
|
|
MsqState = msqState,
|
|
DebugReason = reason
|
|
};
|
|
}
|
|
|
|
public static QuestResolution Leveling(int targetLevel, string? questName, MainScenarioQuestState msqState)
|
|
{
|
|
return new QuestResolution
|
|
{
|
|
Type = EQuestResolutionType.LevelingMode,
|
|
MsqState = msqState,
|
|
DebugReason = $"Leveling to {targetLevel} for {questName}",
|
|
LevelingTargetLevel = targetLevel,
|
|
LevelingQuestName = questName
|
|
};
|
|
}
|
|
|
|
public static QuestResolution None(MainScenarioQuestState msqState, string reason)
|
|
{
|
|
return new QuestResolution
|
|
{
|
|
Type = EQuestResolutionType.NoQuest,
|
|
MsqState = msqState,
|
|
DebugReason = reason
|
|
};
|
|
}
|
|
}
|