private async Task <bool> LogPKMs(PK8 pk, bool legends, CancellationToken token) { encounterCount++; string text = ""; if (Hub.Config.StopConditions.StopOnSpecies != 0 && pk.Species == (int)Hub.Config.StopConditions.StopOnSpecies) { _ = $"Scan {encounterCount}:\n{ShowdownParsing.GetShowdownText(pk)}"; if (pk.IsShiny && pk.ShinyXor == 0) { _ = text.Replace("Shiny: Yes", "Shiny: Square"); } else if (pk.IsShiny) { _ = text.Replace("Shiny: Yes", "Shiny: Star"); } _ = $"{text}\n{GetRibbonsList(pk)}"; } else { _ = $"Scan {encounterCount}: {(pk.IsShiny ? "Shiny " : "")}{pk.Nickname}."; } Log($"Scan: {text}"); if (legends) { Counts.AddSWSHLegendaryScans(); } else { Counts.AddSWSHOverworldScans(); } if (DumpSetting.Dump && !string.IsNullOrEmpty(DumpSetting.DumpFolder)) { DumpPokemon(DumpSetting.DumpFolder, legends ? "OverworldLegends" : "OverworldEncounters", pk); } if (StopConditionSettings.EncounterFound(pk, DesiredMinIVs, DesiredMaxIVs, Hub.Config.StopConditions)) { if (!String.IsNullOrEmpty(Hub.Config.Discord.UserTag)) { Log($"<@{Hub.Config.Discord.UserTag}> result found! Stopping routine execution; restart the bot(s) to search again."); } else { Log("Result found! Stopping routine execution; restart the bot(s) to search again."); } if (Hub.Config.StopConditions.CaptureVideoClip) { await Task.Delay(Hub.Config.StopConditions.ExtraTimeWaitCaptureVideo, token).ConfigureAwait(false); await PressAndHold(CAPTURE, 2_000, 1_000, token).ConfigureAwait(false); } return(true); } return(false); }