@@ -133,10 +133,6 @@ public override async Task<PB7> ReadBoxPokemon(int box, int slot, CancellationTo
133
133
134
134
public async Task EditLureCounter ( uint counter , CancellationToken token ) => await Connection . WriteBytesAsync ( BitConverter . GetBytes ( counter ) , LureCounter , token ) . ConfigureAwait ( false ) ;
135
135
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
-
140
136
public async Task < uint > ReadSpeciesCombo ( CancellationToken token ) => BitConverter . ToUInt16 ( await Connection . ReadBytesAsync ( SpeciesCombo , 2 , token ) . ConfigureAwait ( false ) , 0 ) ;
141
137
142
138
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
151
147
152
148
public async Task < uint > ReadSpawnFlags ( CancellationToken token ) => BitConverter . ToUInt16 ( await Connection . ReadBytesAsync ( LastSpawnFlags , 2 , token ) . ConfigureAwait ( false ) , 0 ) ;
153
149
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
+
154
163
public async Task FleeToOverworld ( CancellationToken token )
155
164
{
156
165
while ( ! await IsInConfirmDialog ( token ) . ConfigureAwait ( false ) && ! token . IsCancellationRequested )
0 commit comments