Skip to content

Commit a50766a

Browse files
committed
* Fixed a bug that made the LGPE Game Language to be Italian after
alterating the Text Speed Option * Removed unused offsets
1 parent c11b00f commit a50766a

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

SysBot.Pokemon/BDSP/BotRNG/BotRNG.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,8 @@ async Task<int> CalculateTarget(Xorshift xoro, SAV8BS sav, RNGType type, WildMod
564564
}
565565
advances++;
566566
} while (!HandleTarget(pk, false, false) && (advances - Hub.Config.BDSP_RNG.AutoRNGSettings.RebootValue < Hub.Config.BDSP_RNG.AutoRNGSettings.RebootValue && Hub.Config.BDSP_RNG.AutoRNGSettings.RebootValue > 0));
567+
if (Hub.Config.BDSP_RNG.RNGType is RNGType.MysteryGift && Hub.Config.BDSP_RNG.Event is PokeEvents.KorRegigigas)
568+
advances--;
567569
return advances;
568570
}
569571

SysBot.Pokemon/LGPE/Data/Enums.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ public enum Lure
5353
}
5454
public enum TextSpeed
5555
{
56-
Slow = 64,
57-
Normal = 65,
58-
Fast = 66,
56+
Slow,
57+
Normal,
58+
Fast,
5959
}
6060

6161
public enum LGPESpecies : ushort

SysBot.Pokemon/LGPE/Data/PokeDataOffsets7B.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ public static class PokeDataOffsets7B
1818
public const uint MainPokeData = 0x163EDC0; //main
1919
public const uint LastSpawn = 0x5E12B148; //heap
2020
public const uint LastSpawnFlags = 0x419BB184; //heap - Thanks Anubis!
21-
public const uint EShinyValue = 0x7398C4; //main
22-
public const uint PShinyValue = 0x739864; //main
23-
public const uint PGeneratingFunction = 0x7398D0; //main
24-
public const uint EGeneratingFunction = 0x739930; //main
2521
public const uint TrainerData = 0x53582030; //heap
2622
public const uint BoxSlot1 = 0x533675B0; //heap
2723
public const uint Money = 0x53324108; //heap

SysBot.Pokemon/LGPE/PokeRoutineExecutor7B.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,6 @@ public override async Task<PB7> ReadBoxPokemon(int box, int slot, CancellationTo
133133

134134
public async Task EditLureCounter(uint counter, CancellationToken token) => await Connection.WriteBytesAsync(BitConverter.GetBytes(counter), LureCounter, token).ConfigureAwait(false);
135135

136-
public async Task<TextSpeed> ReadTextSpeed(CancellationToken token) => (TextSpeed)(await Connection.ReadBytesAsync(TextSpeedOffset, 1, token).ConfigureAwait(false))[0];
137-
138-
public async Task EditTextSpeed(TextSpeed speed, CancellationToken token) => await Connection.WriteBytesAsync(new byte[] {(byte)speed}, TextSpeedOffset, token).ConfigureAwait(false);
139-
140136
public async Task<uint> ReadSpeciesCombo(CancellationToken token) => BitConverter.ToUInt16(await Connection.ReadBytesAsync(SpeciesCombo, 2, token).ConfigureAwait(false), 0);
141137

142138
public async Task<uint> ReadComboCount(CancellationToken token) => BitConverter.ToUInt16(await Connection.ReadBytesAsync(CatchCombo, 2, token).ConfigureAwait(false), 0);
@@ -151,6 +147,19 @@ public override async Task<PB7> ReadBoxPokemon(int box, int slot, CancellationTo
151147

152148
public async Task<uint> ReadSpawnFlags(CancellationToken token) => BitConverter.ToUInt16(await Connection.ReadBytesAsync(LastSpawnFlags, 2, token).ConfigureAwait(false), 0);
153149

150+
public async Task<TextSpeed> ReadTextSpeed(CancellationToken token)
151+
{
152+
var data = await Connection.ReadBytesAsync(TextSpeedOffset, 1, token).ConfigureAwait(false);
153+
return (TextSpeed)(data[0] & 3);
154+
}
155+
156+
public async Task EditTextSpeed(TextSpeed speed, CancellationToken token)
157+
{
158+
var textSpeedByte = await Connection.ReadBytesAsync(TextSpeedOffset, 1, token).ConfigureAwait(false);
159+
var data = new[] { (byte)((textSpeedByte[0] & 0xFC) | (int)speed) };
160+
await Connection.WriteBytesAsync(data, TextSpeedOffset, token).ConfigureAwait(false);
161+
}
162+
154163
public async Task FleeToOverworld(CancellationToken token)
155164
{
156165
while (!await IsInConfirmDialog(token).ConfigureAwait(false) && !token.IsCancellationRequested)

0 commit comments

Comments
 (0)