Skip to content

Commit

Permalink
12.6.24
Browse files Browse the repository at this point in the history
- Add delay for batchtrades so TrainerNotFound doesn't occur due to trade animation.
- Update latest Raid/Outbreak data (SV)
- Fix PerformTrade calling HandleAbortedBatchTrade for all batch trades.
  • Loading branch information
bdawg1989 committed Dec 6, 2024
1 parent 7215d9b commit 1ef9e55
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 25 deletions.
12 changes: 6 additions & 6 deletions SysBot.Pokemon/BDSP/BotTrade/PokeTradeBotBS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,7 @@ private async Task<PokeTradeResult> PerformBatchTrade(SAV8BS sav, PokeTradeDetai
poke.SendNotification(this, $"Trade {completedTrades} completed! Preparing your next Pokémon ({nextDetail.BatchTradeNumber}/{nextDetail.TotalBatchTrades}). Please wait in the trade screen!");
poke = nextDetail;

await Task.Delay(10_000, token).ConfigureAwait(false); // Add delay for trade animation/pokedex register
await Click(A, 1_000, token).ConfigureAwait(false);
if (poke.TradeData.Species != 0)
{
Expand Down Expand Up @@ -1228,13 +1229,12 @@ private async Task PerformTrade(SAV8BS sav, PokeTradeDetail<PB8> detail, PokeRou
else
result = await PerformLinkCodeTrade(sav, detail, token).ConfigureAwait(false);

if (detail.Type == PokeTradeType.Batch)
{
await HandleAbortedBatchTrade(detail, type, priority, result, token).ConfigureAwait(false);
}
else if (result != PokeTradeResult.Success)
if (result != PokeTradeResult.Success)
{
HandleAbortedTrade(detail, type, priority, result);
if (detail.Type == PokeTradeType.Batch)
await HandleAbortedBatchTrade(detail, type, priority, result, token).ConfigureAwait(false);
else
HandleAbortedTrade(detail, type, priority, result);
}
}
catch (SocketException socket)
Expand Down
2 changes: 1 addition & 1 deletion SysBot.Pokemon/Helpers/TradeBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public static class TradeBot

public const string ConfigPath = "config.json";

public const string Version = "v4.3";
public const string Version = "v4.4";
}
}
13 changes: 7 additions & 6 deletions SysBot.Pokemon/LA/BotTrade/PokeTradeBotLA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,12 @@ private async Task PerformTrade(SAV8LA sav, PokeTradeDetail<PA8> detail, PokeRou
else
result = await PerformLinkCodeTrade(sav, detail, token).ConfigureAwait(false);

if (detail.Type == PokeTradeType.Batch)
{
await HandleAbortedBatchTrade(detail, type, priority, result, token).ConfigureAwait(false);
}
else if (result != PokeTradeResult.Success)
if (result != PokeTradeResult.Success)
{
HandleAbortedTrade(detail, type, priority, result);
if (detail.Type == PokeTradeType.Batch)
await HandleAbortedBatchTrade(detail, type, priority, result, token).ConfigureAwait(false);
else
HandleAbortedTrade(detail, type, priority, result);
}
}
catch (SocketException socket)
Expand Down Expand Up @@ -590,6 +589,8 @@ private async Task<PokeTradeResult> PerformBatchTrade(SAV8LA sav, PokeTradeDetai
poke = nextDetail;
isFirstTrade = false;

await Task.Delay(10_000, token).ConfigureAwait(false); // Add delay for trade animation/pokedex register

if (poke.TradeData.Species != 0)
{
await SetBoxPokemonAbsolute(BoxStartOffset, poke.TradeData, token, sav).ConfigureAwait(false);
Expand Down
13 changes: 7 additions & 6 deletions SysBot.Pokemon/SV/BotTrade/PokeTradeBotSV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,8 @@ private async Task<PokeTradeResult> PerformBatchTrade(SAV9SV sav, PokeTradeDetai
{
Hub.Config.Stream.StartTrade(this, poke, Hub);
Hub.Queues.StartTrade(this, poke);

await Task.Delay(10_000, token).ConfigureAwait(false); // Add delay for trade animation/pokedex register
}

// Search for a trade partner for a Link Trade.
Expand Down Expand Up @@ -1337,13 +1339,12 @@ private async Task PerformTrade(SAV9SV sav, PokeTradeDetail<PK9> detail, PokeRou
else
result = await PerformLinkCodeTrade(sav, detail, token).ConfigureAwait(false);

if (detail.Type == PokeTradeType.Batch)
{
await HandleAbortedBatchTrade(detail, type, priority, result, token).ConfigureAwait(false);
}
else if (result != PokeTradeResult.Success)
if (result != PokeTradeResult.Success)
{
HandleAbortedTrade(detail, type, priority, result);
if (detail.Type == PokeTradeType.Batch)
await HandleAbortedBatchTrade(detail, type, priority, result, token).ConfigureAwait(false);
else
HandleAbortedTrade(detail, type, priority, result);
}
}
catch (SocketException socket)
Expand Down
13 changes: 7 additions & 6 deletions SysBot.Pokemon/SWSH/BotTrade/PokeTradeBotSWSH.cs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@ private async Task<PokeTradeResult> PerformBatchTrade(SAV8SWSH sav, PokeTradeDet
poke.SendNotification(this, $"Trade {completedTrades} completed! Preparing your next Pokémon ({nextDetail.BatchTradeNumber}/{nextDetail.TotalBatchTrades}). Please wait in the trade screen!");
poke = nextDetail;

await Task.Delay(10_000, token).ConfigureAwait(false); // Add delay for trade animation/pokedex register

await Click(A, 1_000, token).ConfigureAwait(false);
if (poke.TradeData.Species != 0)
{
Expand Down Expand Up @@ -513,13 +515,12 @@ private async Task PerformTrade(SAV8SWSH sav, PokeTradeDetail<PK8> detail, PokeR
else
result = await PerformLinkCodeTrade(sav, detail, token).ConfigureAwait(false);

if (detail.Type == PokeTradeType.Batch)
{
await HandleAbortedBatchTrade(detail, type, priority, result, token).ConfigureAwait(false);
}
else if (result != PokeTradeResult.Success)
if (result != PokeTradeResult.Success)
{
HandleAbortedTrade(detail, type, priority, result);
if (detail.Type == PokeTradeType.Batch)
await HandleAbortedBatchTrade(detail, type, priority, result, token).ConfigureAwait(false);
else
HandleAbortedTrade(detail, type, priority, result);
}
}
catch (SocketException socket)
Expand Down
Binary file modified SysBot.Pokemon/deps/PKHeX.Core.AutoMod.dll
Binary file not shown.
Binary file modified SysBot.Pokemon/deps/PKHeX.Core.dll
Binary file not shown.

0 comments on commit 1ef9e55

Please sign in to comment.