Jump to content

Recommended Posts

Posted

The problem is that I cant get the bits from 0x38-0x3B Might you help me please :smile:

1456839_548620328557611_1695183664_n.jpg?oh=fc7d8f05bcd45f32dcce2837e14a5517&oe=52A00876&__gda__=1386233634_99e74a1a9912ae37ae070640cddd4b05

Im using this code for pokémon ID

UInt16 pkmID = BitConverter.ToUInt16(pkm, 8); This code works fine :smile:

for stats im using this code;

UInt32 Stats = BitConverter.ToUInt32(pkm, (0x38 << 0)); This code dont work :frown:

then i try this

UInt32 Stats = BitConverter.ToUInt32(pkm, 0x38 ( [0-31] << 0 )); But noting same problem

help me please

Posted

for stats im using this code;

UInt32 Stats = BitConverter.ToUInt32(pkm, (0x38 << 0)); This code dont work :frown:

So pkm is the byte array containing the PKM data and 0x38 is the offset for the IVs, right? This is the syntax for BitConverter.ToUInt32:

'Declaration
<CLSCompliantAttribute(False)> _
Public Shared Function ToUInt16 ( _
[b]value[/b] As Byte(), _
[b]startIndex[/b] As Integer _
) As UShort

This is what you are doing:

UInt32 Stats = BitConverter.ToUInt32([b]ARRAY[/b], ([b]startIndex[/b] << 0));

See the problem yet? You're shifting the index, not the value at that index. You need to fix your parentheses, I think:

UInt32 Stats = BitConverter.ToUInt32(pkm, 0x38) << 0);

then i try this

UInt32 Stats = BitConverter.ToUInt32(pkm, 0x38 ( [0-31] << 0 )); But noting same problem

You do realize [0-31] is the range of values, right? That doesn't go in your code.

Posted
So pkm is the byte array containing the PKM data and 0x38 is the offset for the IVs, right? This is the syntax for BitConverter.ToUInt32:

'Declaration
<CLSCompliantAttribute(False)> _
Public Shared Function ToUInt16 ( _
[b]value[/b] As Byte(), _
[b]startIndex[/b] As Integer _
) As UShort

This is what you are doing:

UInt32 Stats = BitConverter.ToUInt32([b]ARRAY[/b], ([b]startIndex[/b] << 0));

See the problem yet? You're shifting the index, not the value at that index. You need to fix your parentheses, I think:

UInt32 Stats = BitConverter.ToUInt32(pkm, 0x38) << 0);

You do realize [0-31] is the range of values, right? That doesn't go in your code.

Thanks a lot , I get the values by doing this:

UInt32 Stats = BitConverter.ToUInt32(pkm, 0x38);

byte PsIV = Convert.ToByte((Stats >> 0) & 31);

byte AtaIV = Convert.ToByte((Stats >> 5) & 31);

byte DefIV = Convert.ToByte((Stats >> 10) & 31);

byte VelIV = Convert.ToByte((Stats >> 15) & 31);

byte AtaSIV = Convert.ToByte((Stats >> 20) & 31);

byte DefSIV = Convert.ToByte((Stats >> 25) & 31);

byte EggF = Convert.ToByte((Stats >> 30) & 1);

byte NickF = Convert.ToByte((Stats >> 31) & 1);

texbox1.Text = (Convert.ToString(PsIV)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...