Skip to content

Commit

Permalink
Handle video capture in lair bot differently
Browse files Browse the repository at this point in the history
  • Loading branch information
Manu098vm committed Nov 1, 2022
1 parent b737da2 commit eb3b40f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
4 changes: 2 additions & 2 deletions SysBot.Pokemon/SWSH/BotEncounter/EncounterBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public override async Task HardStop()
protected abstract Task EncounterLoop(SAV8SWSH sav, CancellationToken token);

// return true if breaking loop
protected async Task<bool> HandleEncounter(PK8? pk, CancellationToken token)
protected async Task<bool> HandleEncounter(PK8? pk, CancellationToken token, bool isLair = false)
{
if (pk == null)
return false;
Expand All @@ -89,7 +89,7 @@ protected async Task<bool> HandleEncounter(PK8? pk, CancellationToken token)
if (!StopConditionSettings.EncounterFound(pk, DesiredMinIVs, DesiredMaxIVs, Hub.Config.StopConditions, WantedNatures, UnwantedMarks))
return false;

if (Hub.Config.StopConditions.CaptureVideoClip)
if (Hub.Config.StopConditions.CaptureVideoClip && !isLair)
{
await Task.Delay(Hub.Config.StopConditions.ExtraTimeWaitCaptureVideo, token).ConfigureAwait(false);
await PressAndHold(CAPTURE, 2_000, 0, token).ConfigureAwait(false);
Expand Down
12 changes: 2 additions & 10 deletions SysBot.Pokemon/SWSH/BotEncounter/EncounterBotLair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ protected override async Task EncounterLoop(SAV8SWSH sav, CancellationToken toke
private async Task InnerLoop(CancellationToken token)
{
var target = Settings.MaxLairSettings.EditLairPath;
var wasVideoClipActive = Hub.Config.StopConditions.CaptureVideoClip;
Stopwatch stopwatch = new();
bool caneditspecies = true;
uint pathoffset = LairSpeciesSelector;
Expand Down Expand Up @@ -89,10 +88,6 @@ private async Task InnerLoop(CancellationToken token)

while (!token.IsCancellationRequested)
{
//Capture video clip is menaged internally
if (wasVideoClipActive)
Hub.Config.StopConditions.CaptureVideoClip = false;

//Talk to the Lady
while (!await IsInLairWait(token).ConfigureAwait(false))
await Click(A, 0_500, token).ConfigureAwait(false);
Expand Down Expand Up @@ -183,11 +178,8 @@ private async Task InnerLoop(CancellationToken token)
await Click(A, 0_900, token).ConfigureAwait(false);
await Click(DDOWN, 0_800, token).ConfigureAwait(false);
await Click(A, 2_300, token).ConfigureAwait(false);
if (wasVideoClipActive == true)
{
if (Hub.Config.StopConditions.CaptureVideoClip == true)
await PressAndHold(CAPTURE, 2_000, 10_000, token).ConfigureAwait(false);
Hub.Config.StopConditions.CaptureVideoClip = true;
}

if (pk != null && found[2] == 1)
{
Expand Down Expand Up @@ -243,7 +235,7 @@ private async Task<int[]> IsAdventureHuntFound(CancellationToken token)
found[1] = 1;
}

if(await HandleEncounter(pkm, token).ConfigureAwait(false))
if(await HandleEncounter(pkm, token, true).ConfigureAwait(false))
{
found[0] = i + 1;
enc_conditions = true;
Expand Down

0 comments on commit eb3b40f

Please sign in to comment.