qstcompanion v1.0.6

This commit is contained in:
alydev 2025-12-07 10:54:53 +10:00
parent 5e1e1decc5
commit ada27cf05b
30 changed files with 3403 additions and 426 deletions

View file

@ -7,6 +7,13 @@ namespace QuestionableCompanion.Services;
public class CombatDutyDetectionService : IDisposable
{
private enum MultiClientRole
{
None,
Quester,
Helper
}
private readonly ICondition condition;
private readonly IPluginLog log;
@ -143,7 +150,7 @@ public class CombatDutyDetectionService : IDisposable
if (player != null)
{
float hpPercent = (float)player.CurrentHp / (float)player.MaxHp * 100f;
if (hpPercent <= (float)config.CombatHPThreshold)
if (hpPercent <= (float)config.CombatHPThreshold && CanExecuteCombatAutomation())
{
log.Warning($"[CombatDuty] HP at {hpPercent:F1}% (threshold: {config.CombatHPThreshold}%) - enabling combat commands");
EnableCombatCommands();
@ -231,6 +238,19 @@ public class CombatDutyDetectionService : IDisposable
{
return;
}
if (!CanExecuteCombatAutomation())
{
switch (GetCurrentMultiClientRole())
{
case MultiClientRole.None:
log.Debug("[CombatDuty] Combat blocked: Role is 'None' (Config not Helper/Quester)");
break;
case MultiClientRole.Quester:
log.Debug("[CombatDuty] Combat blocked: Quester outside Solo Duty (Let D.Automation handle invalid content)");
break;
}
return;
}
try
{
log.Information("[CombatDuty] ========================================");
@ -358,6 +378,67 @@ public class CombatDutyDetectionService : IDisposable
log.Information("[CombatDuty] State reset");
}
private MultiClientRole GetCurrentMultiClientRole()
{
if (config.IsHighLevelHelper)
{
return MultiClientRole.Helper;
}
if (config.IsQuester)
{
return MultiClientRole.Quester;
}
return MultiClientRole.None;
}
private bool IsInSoloDuty()
{
if (condition[ConditionFlag.BoundByDuty95])
{
return true;
}
if (IsInDuty && !isInAutoDutyDungeon)
{
return true;
}
return false;
}
private bool CanExecuteCombatAutomation()
{
switch (GetCurrentMultiClientRole())
{
case MultiClientRole.None:
if (!IsInDuty)
{
return true;
}
return false;
case MultiClientRole.Helper:
return true;
case MultiClientRole.Quester:
if (!IsInDuty)
{
return true;
}
if (IsInSoloDuty())
{
return true;
}
if (currentQuestId == 811)
{
return true;
}
if (currentQuestId == 4591)
{
return true;
}
return false;
default:
return false;
}
}
public void Dispose()
{
if (combatCommandsActive)