muffin v7.4.6

This commit is contained in:
alydev 2025-12-24 05:01:16 +10:00
parent bb09805213
commit 1cc65e495d
13 changed files with 1291 additions and 949 deletions

View file

@ -361,6 +361,13 @@ internal sealed class QuestController : MiniTaskController<QuestController>
if (_configuration.Stop.Enabled && _startedQuest != null)
{
string text = _startedQuest.Quest.Id.ToString();
if (_configuration.Stop.LevelToStopAfter && IsRunning && _objectTable[0] is IPlayerCharacter playerCharacter && playerCharacter.Level >= _configuration.Stop.TargetLevel)
{
_logger.LogInformation("Reached level stop condition (current: {CurrentLevel}, target: {TargetLevel})", playerCharacter.Level, _configuration.Stop.TargetLevel);
_chatGui.Print($"Character level {playerCharacter.Level} reached target level {_configuration.Stop.TargetLevel}.", "Questionable", 576);
Stop($"Level stop condition reached [{playerCharacter.Level}]");
return;
}
if (_configuration.Stop.QuestSequences.TryGetValue(text, out var value) && value.HasValue)
{
int sequence = _startedQuest.Sequence;
@ -395,17 +402,17 @@ internal sealed class QuestController : MiniTaskController<QuestController>
if (step == 0 || step == 255)
{
flag2 = true;
goto IL_054c;
goto IL_0691;
}
}
flag2 = false;
goto IL_054c;
goto IL_0691;
}
goto IL_0550;
IL_054c:
goto IL_0695;
IL_0691:
flag = flag2;
goto IL_0550;
IL_0550:
goto IL_0695;
IL_0695:
if (flag && DateTime.Now >= CurrentQuest.StepProgress.StartedAt.AddSeconds(15.0))
{
lock (_progressLock)
@ -958,8 +965,11 @@ internal sealed class QuestController : MiniTaskController<QuestController>
{
using (_logger.BeginScope("Q/" + label))
{
AutomationType = EAutomationType.Automatic;
ExecuteNextStep();
if (!CheckAndBlockForStopConditions())
{
AutomationType = EAutomationType.Automatic;
ExecuteNextStep();
}
}
}
@ -967,8 +977,11 @@ internal sealed class QuestController : MiniTaskController<QuestController>
{
using (_logger.BeginScope("GQ/" + label))
{
AutomationType = EAutomationType.GatheringOnly;
ExecuteNextStep();
if (!CheckAndBlockForStopConditions())
{
AutomationType = EAutomationType.GatheringOnly;
ExecuteNextStep();
}
}
}
@ -976,8 +989,11 @@ internal sealed class QuestController : MiniTaskController<QuestController>
{
using (_logger.BeginScope("SQ/" + label))
{
AutomationType = EAutomationType.SingleQuestA;
ExecuteNextStep();
if (!CheckAndBlockForStopConditions())
{
AutomationType = EAutomationType.SingleQuestA;
ExecuteNextStep();
}
}
}
@ -990,6 +1006,65 @@ internal sealed class QuestController : MiniTaskController<QuestController>
}
}
private bool CheckAndBlockForStopConditions()
{
if (!_configuration.Stop.Enabled)
{
return false;
}
if (_configuration.Stop.LevelToStopAfter && _objectTable[0] is IPlayerCharacter playerCharacter && playerCharacter.Level >= _configuration.Stop.TargetLevel)
{
_logger.LogInformation("Blocking start: Level stop condition already met (current: {CurrentLevel}, target: {TargetLevel})", playerCharacter.Level, _configuration.Stop.TargetLevel);
_chatGui.Print($"Cannot start: Character level {playerCharacter.Level} has reached target level {_configuration.Stop.TargetLevel}.", "Questionable", 576);
return true;
}
foreach (ElementId item in _configuration.Stop.QuestsToStopAfter)
{
string key = item.ToString();
if (_configuration.Stop.QuestSequences.TryGetValue(key, out var value) && value.HasValue)
{
if (!_questFunctions.IsQuestAccepted(item))
{
continue;
}
QuestProgressInfo questProgressInfo = _questFunctions.GetQuestProgressInfo(item);
if (questProgressInfo != null && questProgressInfo.Sequence >= value.Value)
{
if (_questRegistry.TryGetQuest(item, out Quest quest))
{
_logger.LogInformation("Blocking start: Quest '{QuestName}' is at sequence {CurrentSequence}, stop sequence is {StopSequence}", quest.Info.Name, questProgressInfo.Sequence, value.Value);
_chatGui.Print($"Cannot start: Quest '{quest.Info.Name}' is at sequence {questProgressInfo.Sequence}, configured stop sequence is {value.Value}.", "Questionable", 576);
}
return true;
}
}
else if (_questFunctions.IsQuestComplete(item))
{
if (_questRegistry.TryGetQuest(item, out Quest quest2))
{
_logger.LogInformation("Blocking start: Quest '{QuestName}' is already complete and configured as a stop condition", quest2.Info.Name);
_chatGui.Print("Cannot start: Quest '" + quest2.Info.Name + "' is complete and configured as a stopping point.", "Questionable", 576);
}
return true;
}
}
if (_configuration.Stop.SequenceToStopAfter && _startedQuest != null)
{
string key2 = _startedQuest.Quest.Id.ToString();
if (!_configuration.Stop.QuestSequences.ContainsKey(key2))
{
int sequence = _startedQuest.Sequence;
if (sequence >= _configuration.Stop.TargetSequence)
{
_logger.LogInformation("Blocking start: Global sequence stop condition already met (current: {CurrentSequence}, target: {TargetSequence})", sequence, _configuration.Stop.TargetSequence);
_chatGui.Print($"Cannot start: Quest sequence {sequence} has reached target sequence {_configuration.Stop.TargetSequence}.", "Questionable", 576);
return true;
}
}
}
return false;
}
private void ExecuteNextStep()
{
ClearTasksInternal();