Skip to content

Commit

Permalink
SWSH partnerFound logic change for Batch Trades.
Browse files Browse the repository at this point in the history
Increase trade ID limit from 3000 to 50,000
  • Loading branch information
bdawg1989 committed Dec 26, 2024
1 parent ad13895 commit ed2b419
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions SysBot.Pokemon/SWSH/BotTrade/PokeTradeBotSWSH.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,16 +358,18 @@ private async Task<PokeTradeResult> PerformBatchTrade(SAV8SWSH sav, PokeTradeDet

// Rest of the trading logic remains the same
poke.TradeSearching(this);
var partnerFound = await WaitForTradePartnerOffer(token).ConfigureAwait(false);

if (!partnerFound)
if (completedTrades == 0)
{
if (completedTrades > 0)
poke.SendNotification(this, $"No trainer found after trade {completedTrades + 1}/{startingDetail.TotalBatchTrades}. Canceling the remaining trades.");
await ExitTrade(false, token).ConfigureAwait(false);
return PokeTradeResult.NoTrainerFound;
var partnerFound = await WaitForTradePartnerOffer(token).ConfigureAwait(false);
if (!partnerFound)
{
poke.IsProcessing = false;
if (startingDetail.TotalBatchTrades > 1)
poke.SendNotification(this, $"No trainer found after trade {completedTrades + 1}/{startingDetail.TotalBatchTrades}. Canceling the remaining trades.");
await ResetTradePosition(token).ConfigureAwait(false);
return PokeTradeResult.NoTrainerFound;
}
}

await Task.Delay(5_500 + hub.Config.Timings.MiscellaneousSettings.ExtraTimeOpenBox, token).ConfigureAwait(false);

var trainerName = await GetTradePartnerName(TradeMethod.LinkTrade, token).ConfigureAwait(false);
Expand Down
2 changes: 1 addition & 1 deletion SysBot.Pokemon/TradeHub/PokeTradeDetail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace SysBot.Pokemon
public PokeTradeDetail(TPoke pkm, PokeTradeTrainerInfo info, IPokeTradeNotifier<TPoke> notifier, PokeTradeType type, int code, bool favored = false, List<Pictocodes>? lgcode = null, int batchTradeNumber = 0, int totalBatchTrades = 0, bool isMysteryMon = false, bool isMysteryEgg = false, int uniqueTradeID = 0, bool ignoreAutoOT = false, bool setEdited = false)
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
{
ID = Interlocked.Increment(ref CreatedCount) % 3000;
ID = Interlocked.Increment(ref CreatedCount) % 50000;
Code = code;
TradeData = pkm;
Trainer = info;
Expand Down

0 comments on commit ed2b419

Please sign in to comment.