Skip to content

Commit 83f2d83

Browse files
committed
Use pointer as fallback for LGPE gifts
1 parent 6138aad commit 83f2d83

File tree

3 files changed

+37
-59
lines changed

3 files changed

+37
-59
lines changed

SysBot.Pokemon.WinForms/Main.Designer.cs

Lines changed: 30 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SysBot.Pokemon/LGPE/BotEncounter/EncounterBot7B.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ private async Task SpamUntilEncounter(CancellationToken token)
190190
var pk = mode switch
191191
{
192192
LetsGoMode.Stationary => await ReadStationary(token).ConfigureAwait(false),
193-
LetsGoMode.Fossils => await ReadFossil(token).ConfigureAwait(false),
194-
LetsGoMode.Gifts => await ReadGift(token).ConfigureAwait(false),
193+
LetsGoMode.Fossils => await ReadGiftOrFossil(token).ConfigureAwait(false),
194+
LetsGoMode.Gifts => await ReadGiftOrFossil(token).ConfigureAwait(false),
195195
LetsGoMode.Trades => await ReadTrade(token).ConfigureAwait(false),
196196
LetsGoMode.GoPark => await ReadGoEntity(token).ConfigureAwait(false),
197197
_ => throw new NotImplementedException(),

SysBot.Pokemon/LGPE/PokeRoutineExecutor7B.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,27 +79,19 @@ public override async Task<PB7> ReadBoxPokemon(int box, int slot, CancellationTo
7979
public async Task<PB7?> ReadWild(CancellationToken token) => await ReadUntilPresent(WildPokeData, 2_000, 0_200, token).ConfigureAwait(false);
8080
public async Task<PB7?> ReadGoEntity(CancellationToken token) => await ReadUntilPresent(GoPokeData, 2_000, 0_200, token).ConfigureAwait(false);
8181
public async Task<PB7?> ReadStationary(CancellationToken token) => await ReadUntilPresent(StationaryPokeData, 2_000, 0_200, token).ConfigureAwait(false);
82-
public async Task<PB7?> ReadFossil(CancellationToken token)
83-
{
84-
var pk = await ReadUntilPresentPointer(PokeDataPointers7B.FossilPokeData, 1_000, 0_200, BoxFormatSlotSize, token).ConfigureAwait(false);
85-
//if (pk is null || (pk.Species != 138 && pk.Species != 140 && pk.Species != 142))
86-
//pk = await ReadUntilPresent(FossilPokeData2, 1_000, 0_200, token).ConfigureAwait(false);
87-
if (pk is not null && pk.Species != 138 && pk.Species != 140 && pk.Species != 142)
88-
pk = null;
89-
return pk;
90-
}
82+
public async Task<PB7?> ReadFossil(CancellationToken token) => await ReadUntilPresentPointer(PokeDataPointers7B.FossilPokeData, 1_000, 0_200, BoxFormatSlotSize, token).ConfigureAwait(false);
83+
9184
public async Task<PB7?> ReadGiftOrFossil(CancellationToken token)
9285
{
9386
var pk = await ReadGift(token).ConfigureAwait(false);
94-
if (pk is null)
95-
pk = await ReadFossil(token).ConfigureAwait(false);
87+
pk ??= await ReadFossil(token).ConfigureAwait(false);
9688
return pk;
9789
}
90+
9891
public async Task<PB7?> ReadWildOrGo(CancellationToken token)
9992
{
10093
var pk = await ReadWild(token).ConfigureAwait(false);
101-
if (pk is null)
102-
pk = await ReadGoEntity(token).ConfigureAwait(false);
94+
pk ??= await ReadGoEntity(token).ConfigureAwait(false);
10395
return pk;
10496
}
10597

0 commit comments

Comments
 (0)