[Need Help]Parsing solo spawn packet[3015]

10/17/2011 20:29 silencer61#1
Code:
 public static void ParseSoloSpawn(Packet p)
        {
            Packet copy1 = p;
            copy1.Skip(copy1.GetBytes().Length - 1);
            int type = copy1.Readbyte();
            if (type == 1)
            {
                int charid = p.ReadInt32();
                p.ReadInt32();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.ReadInt16();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                int chars = p.ReadInt16();
                char[] charName = p.ReadChars(chars);
                string charname = new string(charName);
            }
            if (type == 4)
            {
                int model = p.ReadInt32();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.ReadInt32();
                p.Readbyte();
                p.ReadInt32();
                p.Readbyte();
                p.ReadInt32();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.ReadInt16();
                p.Readbyte();
                int walking = p.Readbyte();
                if (walking == 1)
                {
                    p.ReadInt16();
                    p.ReadInt16();
                    p.ReadInt16();
                }
                else
                {
                    p.Readbyte();
                    p.ReadInt16();
                }
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                for (byte b = 0; b < p.Readbyte(); b++)
                {
                    p.ReadInt32();
                    p.ReadInt32();
                }
                int chars = p.ReadInt16();          
                char[] charName = p.ReadChars(chars);
                string charname = new string(charName);
            }
        }
im trying to parse solo spawn packet but it doesnt work.what is wrong
10/18/2011 14:43 bootdisk#2
First off, you're guessing most of the values.
Like this:

Code:
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.ReadInt32();
Which is quite messy, not a single comment of what that integer of 32 bits should be.
Parsing is not about the parser itself; it's about the packets, so I suggest you to post packets instead of non-commented code.
If you're going to maintain a bot or any other tool it's better to put comments when you do those nested calls as:

Code:
p.ReadInt32(); // chartype
There are also lots of flags, counts and fors that should be take into account.
Also, it might be really helpful for everybody to know the SRO version.
10/18/2011 15:43 theonly112#3
int chars = p.ReadInt16();
WOW....
10/18/2011 16:29 kevin_owner#4
like bootdisk already said you're missing a lot of checks for the flags and extra loops to get to the end of the packet.

A nice reference is the last byte or the second last byte that one is always 255 it was a pvp flag if i'm correct but this value was always 255 for me even if people wore a pvp cape.

and ofcourse the comments are missing. I also advice you to search trough the forums there are a few parsed groupspawn packets and single spawn packets which are the same the opcode for the grouspawn was 3018 if i'm correct.

@theonly112 what is wow about that?? the name is not the one I would have chosen but still it stands for chars.
10/18/2011 21:07 silencer61#5
Quote:
Originally Posted by bootdisk View Post
First off, you're guessing most of the values.
Like this:

Code:
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.Readbyte();
                p.ReadInt32();
Which is quite messy, not a single comment of what that integer of 32 bits should be.
Parsing is not about the parser itself; it's about the packets, so I suggest you to post packets instead of non-commented code.
If you're going to maintain a bot or any other tool it's better to put comments when you do those nested calls as:

Code:
p.ReadInt32(); // chartype
There are also lots of flags, counts and fors that should be take into account.
Also, it might be really helpful for everybody to know the SRO version.
Quote:
Originally Posted by kevin_owner View Post
like bootdisk already said you're missing a lot of checks for the flags and extra loops to get to the end of the packet.

A nice reference is the last byte or the second last byte that one is always 255 it was a pvp flag if i'm correct but this value was always 255 for me even if people wore a pvp cape.

and ofcourse the comments are missing. I also advice you to search trough the forums there are a few parsed groupspawn packets and single spawn packets which are the same the opcode for the grouspawn was 3018 if i'm correct.

@theonly112 what is wow about that?? the name is not the one I would have chosen but still it stands for chars.
Thx for replying , i made a little mistake, i fixed my problem.I wanna release my party buffer coming soon :)
10/20/2011 16:56 bootdisk#6
Sweet, remember: when seeking for help post packets, the part of your parser that is giving you crashes/wrong data + the SRO version you're working on.