@@ -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