Skip to content

Commit 3efe1e3

Browse files
committed
Ldn mitm is no longer required for sword of justice
1 parent 7c1ce77 commit 3efe1e3

File tree

3 files changed

+42
-13
lines changed

3 files changed

+42
-13
lines changed

SysBot.Pokemon/Actions/PokeRoutineExecutor.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,13 @@ public async Task StartGame(PokeTradeHubConfig config, CancellationToken token)
318318
for (int i = 0; i < 5; i++)
319319
await Click(A, 1_000, token).ConfigureAwait(false);
320320

321-
while (!await IsOnOverworld(config, token).ConfigureAwait(false) && !await IsInBattle(token).ConfigureAwait(false))
322-
await Task.Delay(0_500, token).ConfigureAwait(false);
321+
while (!await IsOnOverworld(config, token).ConfigureAwait(false))
322+
await Task.Delay(2_000, token).ConfigureAwait(false);
323323

324324
Log("Back in the overworld!");
325325
}
326326

327+
327328
public async Task<bool> CheckIfSearchingForLinkTradePartner(CancellationToken token)
328329
{
329330
var data = await Connection.ReadBytesAsync(LinkTradeSearchingOffset, 1, token).ConfigureAwait(false);
@@ -447,5 +448,16 @@ public static uint GetOverworldOffset(ConsoleLanguageParameter value)
447448
_ => OverworldOffset,
448449
};
449450
}
451+
452+
public async Task PokeCamp(CancellationToken token)
453+
{
454+
// Open Poke Camp and return to the overworld
455+
Log("Opening Camp...");
456+
await Click(X, 1_000, token).ConfigureAwait(false);
457+
await Click(A, 0_600, token).ConfigureAwait(false);
458+
await Click(B, 6_600, token).ConfigureAwait(false);
459+
await Click(B, 1_000, token).ConfigureAwait(false);
460+
await Click(A, 1_600, token).ConfigureAwait(false);
461+
}
450462
}
451463
}

SysBot.Pokemon/BotEncounter/EncounterBot.cs

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ protected override async Task MainLoop(CancellationToken token)
4646
EncounterMode.Regis => DoRegiEncounter(token),
4747
EncounterMode.LegendaryDogs => DoDogEncounter(token),
4848
EncounterMode.SwordsJustice => DoJusticeEncounter(token),
49+
EncounterMode.LGPE => DoLGPEEncounter(token),
4950
_ => WalkInLine(token),
5051
};
5152
await task.ConfigureAwait(false);
@@ -162,7 +163,7 @@ private async Task DoRegiEncounter(CancellationToken token)
162163
}
163164

164165
// Offsets are flickery so make sure we see it 3 times.
165-
for (int i = 0; i < 3; i++)
166+
for (int i = 0; i < 3; i++)
166167
await ReadUntilChanged(BattleMenuOffset, BattleMenuReady, 5_000, 0_100, true, token).ConfigureAwait(false);
167168

168169
if (await HandleEncounter(pk, true, token).ConfigureAwait(false))
@@ -226,20 +227,21 @@ private async Task DoDogEncounter(CancellationToken token)
226227

227228
private async Task DoJusticeEncounter(CancellationToken token)
228229
{
229-
Log("Reminder: LDN-MITM SYSMODULE IS REQUIRED IN ORDER FOR THIS BOT TO WORK!");
230-
bool log;
231230
while (!token.IsCancellationRequested)
232231
{
233-
Log("Position saved. Rebooting game...");
234-
await CloseGame(Hub.Config, token).ConfigureAwait(false);
235-
await StartGame(Hub.Config, token).ConfigureAwait(false);
232+
while (!await IsOnOverworld(Hub.Config, token).ConfigureAwait(false))
233+
await Task.Delay(2_000, token).ConfigureAwait(false);
236234

237-
log = true;
235+
// Enter and exit Pokecamp in order to respawn the Pokemon
236+
await PokeCamp(token);
238237

238+
//Check position
239+
int i = 0;
239240
while (!await IsInBattle(token).ConfigureAwait(false))
240241
{
241-
if (log) Log("Position could be wrong. Try to move a bit and save again.");
242-
log = false;
242+
await Task.Delay(1_000, token).ConfigureAwait(false);
243+
if (i==5) Log("Position could be wrong or Pokécamp option is not the first available in the menu.\n");
244+
i++;
243245
}
244246

245247
Log("Encounter started! Checking details...");
@@ -254,12 +256,25 @@ private async Task DoJusticeEncounter(CancellationToken token)
254256
continue;
255257
}
256258

257-
// Offsets are flickery so make sure we see it 3 times.
258-
for (int i = 0; i < 3; i++)
259+
// Offsets are flickery so make sure we see it 3 times.
260+
for (i = 0; i < 3; i++)
259261
await ReadUntilChanged(BattleMenuOffset, BattleMenuReady, 5_000, 0_100, true, token).ConfigureAwait(false);
260262

261263
if (await HandleEncounter(pk, true, token).ConfigureAwait(false))
262264
return;
265+
266+
// Flee
267+
while (await IsInBattle(token).ConfigureAwait(false))
268+
await FleeToOverworld(token).ConfigureAwait(false);
269+
}
270+
}
271+
272+
private async Task DoLGPEEncounter(CancellationToken token)
273+
{
274+
Log("Inside the LGPE bot");
275+
while (!token.IsCancellationRequested)
276+
{
277+
Log("");
263278
}
264279
}
265280

SysBot.Pokemon/BotEncounter/EncounterModes.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,7 @@ public enum EncounterMode
3636
/// Bot will soft reset the Swords of Justice Trio
3737
/// </summary>
3838
SwordsJustice,
39+
40+
LGPE,
3941
}
4042
}

0 commit comments

Comments
 (0)