Characters near you packets.

04/17/2014 00:11 lewy1000#1
Hello i have problem with read packets.
i have packet like that:
Code:
[S -> C][3015]


74 07 00 00                                       t...............


23                                                #...............


00                                                ................


00                                                ................


01                                                ................


2D                                                -...............


05                                                ................


38 0E 00 00                                       8...............


14                                                ................


39 0E 00 00                                       9...............


14                                                ................


3A 0E 00 00                                       :...............


14                                                ................


30 0E 00 00                                       0...............


14                                                ................


86 2A 00 00                                       .*..............


14                                                ................


05                                                ................


00                                                ................


00                                                ................


90 17 0A 00                                       ................


A8 61                                             .a..............


00 60 88 44 21 EE B3 C0 00 C0 D6 44 56 37         .`.D!......DV7..


00                                                ................


01                                                ................


00                                                ................


56 37                                             V7..............


01                                                ................


00                                                ................


00                                                ................


00                                                ................


00 00 80 41                                       ...A............


00 00 48 42                                       ..HB............


00 00 C8 42                                       ...B............


00                                                ................


0C 00                                             ................


59 6F 75 4D 61 6B 65 4D 65 48 6F 72               YouMakeMeHor....


00                                                ................


01                                                ................


00                                                ................


00                                                ................


00                                                ................


00                                                ................


00                                                ................


00                                                ................


00 00                                             ................


00 00 00 00                                       ................


00 00                                             ................


00 00 00 00                                       ................


00 00 00 00                                       ................


00 00 00 00                                       ................


00                                                ................


00                                                ................


00                                                ................


FF                                                ................


01                                                ................
Now i want to read it in c# :
Code:
if ((current.Opcode == 0x3015))
                            {
                                    current.ReadUInt32();
                                    current.ReadUInt8();
                                    current.ReadUInt8();
                                    current.ReadUInt8();
                                    current.ReadUInt8();
                                    current.ReadUInt8();
                                    current.ReadUInt8();
                                    current.ReadUInt32();
                                    current.ReadUInt8();
                                    current.ReadUInt32();
                                    current.ReadUInt8();
                                    current.ReadUInt32();
                                    current.ReadUInt8();
                                    current.ReadUInt32();
                                    current.ReadUInt8();
                                    current.ReadUInt32();
                                    current.ReadUInt8();
                                    current.ReadUInt32();
                                    current.ReadUInt8();
                                    current.ReadUInt32();
                                    current.ReadUInt8();
                                    current.ReadUInt32();
                                    current.ReadUInt8();
                                    current.ReadUInt8();
                                    current.ReadUInt8();
                                    /* ID */
                                    Globals.MainWindow.comboBox4.Items.Add(current.ReadUInt32());
                                    /* end ID */
                                    current.ReadUInt16();
                                    Globals.MainWindow.comboBox3.Items.Add(current.ReadAscii());
                                current.ReadUInt8();
                                 current.ReadUInt8();
                            current.ReadUInt8();
                            current.ReadUInt16();
                            current.ReadUInt16();
                            current.ReadUInt16();
                            current.ReadUInt16();
                            current.ReadUInt8();
                            current.ReadUInt8();
                            current.ReadUInt8();
                            current.ReadUInt8();
                            current.ReadUInt32();
                            current.ReadUInt32();
                            current.ReadUInt32();
                            current.ReadUInt8();
                            current.ReadUInt32();
                            current.ReadUInt32();
                            current.ReadUInt16();
                            Globals.MainWindow.comboBox4.Items.Add(current.ReadAscii());
                            }
But after first ReadAscii i have error (can't read when packet ends).

What am i doing wrong?
04/17/2014 23:06 zeteris#2
Quote:
Originally Posted by lewy1000 View Post
Hello i have problem with read packets.
i have packet like that:
Code:
[S -> C][3015]
...
But after first ReadAscii i have error (can't read when packet ends).

What am i doing wrong?
Each character near you have different number of items, active buffs and so on. So first you need to parse that before you can get UniqueID.
04/18/2014 14:06 lewy1000#3
hmm. maybe is there other way to get player ID and Nick ?
04/18/2014 18:00 zeteris#4
Quote:
Originally Posted by lewy1000 View Post
hmm. maybe is there other way to get player ID and Nick ?
Nope.
04/19/2014 19:33 lewy1000#5
Maybe can you tell me how to do this?
04/19/2014 20:09 DaxterSoul#6
Search for source code from bot projects (zBot)
Maybe you'll get an idea how it works...
04/19/2014 20:21 lewy1000#7
Ohh thx! :)
04/19/2014 21:48 zeteris#8
Yeah you can check source codes I've released

[Only registered and activated users can see links. Click Here To Register...]

I don't know if links are still alive. These sources were very buggy ( I used wrong method for parsing everything, but it should help you).

GL on what you're doing :)
04/22/2014 22:44 lewy1000#9
i check your source code but still can't finde how to get players CharName from packet
o.O
Uhh... maybe sample or some help?
04/23/2014 11:04 DaxterSoul#10
Code:
//zBot_source_vsro_by_Zeteris\Silkroad\Logic\GameServer\Spawns\SpawnParsing.cs

public static void ParseChar(Packet packet, int index)
        {
            try
            {
                int s_index = 0;
                for (int i = 0; i < Spawns.characters.Length; i++)
                {
                    if (Spawns.characters[i].charname == null)
                    {
                        s_index = i;
                        break;
                    }
                }
                int trade = 0;
                int stall = 0;
                packet.data.ReadBYTE(); // Volume/Height
                packet.data.ReadBYTE(); // Rank
                packet.data.ReadBYTE(); // Icons
                packet.data.ReadBYTE(); // Unknown
                packet.data.ReadBYTE(); // Max Slots
                int items_count = packet.data.ReadBYTE();
                for (int a = 0; a < items_count; a++)
                {
                    uint itemid = packet.data.ReadDWORD();
                    int itemindex = Items_Info.itemsidlist.IndexOf(itemid);
                    if (Items_Info.itemstypelist[itemindex].StartsWith("ITEM_CH") || Items_Info.itemstypelist[itemindex].StartsWith("ITEM_EU") || Items_Info.itemstypelist[itemindex].StartsWith("ITEM_FORT") || Items_Info.itemstypelist[itemindex].StartsWith("ITEM_ROC_CH") || Items_Info.itemstypelist[itemindex].StartsWith("ITEM_ROC_EU"))
                    {
                        byte plus = packet.data.ReadBYTE(); // Item Plus
                    }
                    if (Items_Info.itemstypelist[itemindex].StartsWith("ITEM_EU_M_TRADE") || Items_Info.itemstypelist[itemindex].StartsWith("ITEM_EU_F_TRADE") || Items_Info.itemstypelist[itemindex].StartsWith("ITEM_CH_M_TRADE") || Items_Info.itemstypelist[itemindex].StartsWith("ITEM_CH_W_TRADE"))
                    {
                        trade = 1;
                    }
                }
                packet.data.ReadBYTE(); // Max Avatars Slot
                int avatar_count = packet.data.ReadBYTE();
                for (int a = 0; a < avatar_count; a++)
                {
                    uint avatarid = packet.data.ReadDWORD();
                    int avatarindex = Items_Info.itemsidlist.IndexOf(avatarid);
                    byte plus = packet.data.ReadBYTE(); // Avatar Plus
                    if (avatarindex == -1)
                    {
                        Globals.UpdateLogs("Error on avatars !!! Avatar ID: " + avatarid);
                    }
                }
                int mask = packet.data.ReadBYTE();
                if (mask == 1)
                {
                    uint id = packet.data.ReadDWORD();
                    string type = Mobs_Info.mobstypelist[Mobs_Info.mobsidlist.IndexOf(id)];
                    if (type.StartsWith("CHAR"))
                    {
                        packet.data.ReadBYTE();
                        byte count = packet.data.ReadBYTE();
                        for (int i = 0; i < count; i++)
                        {
                            packet.data.ReadDWORD();
                        }
                    }
                }
                Spawns.characters[s_index].id = packet.data.ReadDWORD();

                byte xsec = packet.data.ReadBYTE();
                byte ysec = packet.data.ReadBYTE();
                float xcoord = packet.data.ReadSINGLE();
                packet.data.ReadSINGLE();
                float ycoord = packet.data.ReadSINGLE();

                packet.data.ReadWORD(); // Position
                byte move = packet.data.ReadBYTE(); // Moving
                packet.data.ReadBYTE(); // Running

                if (move == 1)
                {
                    xsec = packet.data.ReadBYTE();
                    ysec = packet.data.ReadBYTE();
                    if (ysec == 0x80)
                    {
                        xcoord = packet.data.ReadWORD() - packet.data.ReadWORD();
                        packet.data.ReadWORD();
                        packet.data.ReadWORD();
                        ycoord = packet.data.ReadWORD() - packet.data.ReadWORD();
                    }
                    else
                    {
                        xcoord = packet.data.ReadWORD();
                        packet.data.ReadWORD();
                        ycoord = packet.data.ReadWORD();
                    }
                }
                else
                {
                    packet.data.ReadBYTE(); // No Destination
                    packet.data.ReadWORD(); // Angle
                }

                Spawns.characters[s_index].alive = packet.data.ReadBYTE(); // Alive
                packet.data.ReadBYTE(); // Unknown
                packet.data.ReadBYTE(); // Unknown
                packet.data.ReadBYTE(); // Unknown

                packet.data.ReadDWORD(); // Walking speed
                packet.data.ReadDWORD(); // Running speed
                packet.data.ReadDWORD(); // Berserk speed

                int active_skills = packet.data.ReadBYTE(); // Buffs count
                Spawns.characters[s_index].buffs = new Spawns.Characters_.Buffs_[100];
                for (int a = 0; a < active_skills; a++)
                {
                    uint skillid = packet.data.ReadDWORD();
                    int buffindex = Skills_Info.skillsidlist.IndexOf(skillid);
                    Spawns.characters[s_index].buffs[a].name = Skills_Info.skillsnamelist[Skills_Info.skillsidlist.IndexOf(skillid)];
                    string type = Skills_Info.skillstypelist[buffindex];
                    Spawns.characters[s_index].buffs[a].tempid = packet.data.ReadDWORD(); // Temp ID
                    if (type.StartsWith("SKILL_EU_CLERIC_RECOVERYA_GROUP") || type.StartsWith("SKILL_EU_BARD_BATTLAA_GUARD") || type.StartsWith("SKILL_EU_BARD_DANCEA") || type.StartsWith("SKILL_EU_BARD_SPEEDUPA_HITRATE"))
                    {
                        packet.data.ReadBYTE();
                    }
                }
                string name = packet.data.ReadSTRING(enumStringType.ASCII);
                Spawns.characters[s_index].charname = name;
                packet.data.ReadBYTE(); // Unknown
                packet.data.ReadBYTE(); // Job type
                packet.data.ReadBYTE(); // Job level
                int cnt = packet.data.ReadBYTE();
                packet.data.ReadBYTE();
                if (cnt == 1)
                {
                    packet.data.ReadDWORD();
                }
                packet.data.ReadBYTE(); // Unknown
                stall = packet.data.ReadBYTE(); // Stall flag
                packet.data.ReadBYTE(); // Unknown
                string guild = packet.data.ReadSTRING(enumStringType.ASCII); // Guild
                Spawns.characters[s_index].guildname = guild;
                if (trade == 1)
                {
                    packet.data.ReadWORD();
                }
                else
                {
                    packet.data.ReadDWORD(); // Guild ID
                    packet.data.ReadSTRING(enumStringType.ASCII); // Grant Name
                    packet.data.ReadDWORD();
                    packet.data.ReadDWORD();
                    packet.data.ReadDWORD();
                    packet.data.ReadWORD();
                    if (stall == 4)
                    {
                        packet.data.ReadSTRING(enumStringType.ASCII);
                        packet.data.ReadDWORD();
                        packet.data.ReadWORD();
                    }
                    else
                    {
                        packet.data.ReadWORD();
                    }
                }
            }
            catch (Exception ex)
            {
                Globals.Debug("Spawn", ex.Message + " Count: " + BotData.groupespawncount, packet);
            }
        }
zZZzzZ...
Code:
                string name = packet.data.ReadSTRING(enumStringType.ASCII);
                Spawns.characters[s_index].charname = name;
04/27/2014 10:59 Alkosh#11
Use this if it helps, most complete parsing of the player spawn packet around.

Code:
    [dword] pk2 (char)
     [byte] volume_height
     [byte] flag (quest_rank)
     [byte] flag (icon)
     [byte] flag (pvp)
     [byte] count (slot_max)
     [byte] count (item_equip_normal)

if(item) {
    [dword] pk2 (item)
     [byte] plus
}

     [byte] count (slot_avatar)
     [byte] count (item_equip_avatar)

if(avatar) {
    [dword] pk2 (item)
     [byte] plus
}

     [byte] flag (duplicate)

if(duplicate) {
    [dword] pk2 (char)
     [byte] volume_height
     [byte] count (item_equip_normal)

if(item) {
    [dword] pk2 (item)
}
}

    [dword] unique id (player)
     [word] zone
    [float] x
    [float] z
    [float] y
     [word] angle
     [byte] flag (destination)
     [byte] flag (movement)

if(destination) {
     [word] zone
     [word] x
     [word] z
     [word] y
}

else {
00
     [word] angle
}

     [byte] flag (alive_state)
     [byte] flag (stance)
     [byte] flag (berserk)
00
    [float] speed (walk)
    [float] speed (run)
    [float] speed (berserk)
     [byte] count (buff)

if(buff) {
    [dword] pk2 (skill/item)
    [dword] Duration (ms)
}

     [word] string (player_name)
     [byte] flag (job)
     [byte] flag (job_level)
     [byte] flag (pk_status)
     [byte] flag (transport)
00

if(transport) {
    [dword] unique id (cos)
}

00                                         
     [byte] flag (stall_state)
00 
     [word] string (guild_name)
    [dword] unique id (guild)           
     [word] string (player_grantname)
    [dword] emblem (guild)      
    [dword] unique id (union)             
    [dword] emblem (union)  
     [byte] flag (guild_war)
     [byte] flag (fortress_rank)

if(stall) {
     [word] string (stall_name)
    [dword] pk2 (item_model)
}

     [byte] (un)equip timer
     [byte] flag (pk)
04/28/2014 08:52 amra85#12
sry but thats not that i call "most complete"... =)
04/28/2014 13:00 Alkosh#13
Quote:
Originally Posted by amra85 View Post
sry but thats not that i call "most complete"... =)
How so? It's only missing 5 bytes (which I rarely saw ever change) and it takes into accounts other variables such as riding transport, stalls and un-equip timer. Find me a more complete one.
04/28/2014 13:39 Royalblade*#14
[Only registered and activated users can see links. Click Here To Register...]

Might help :)
04/28/2014 14:12 DaxterSoul#15
Code:
     [byte] flag (icon)
     [byte] flag (pvp)
     
--> Correction:
            1   byte    PVPCape(0=None, 1=Red, 2=Gray, 3=Blue, 4=White, 5=Orange)
            1   byte    AutoInverstExp(1 = BeginnerIcon ,2 = Helpful, 3 = BeginnerIcon & Helpful)
Code:
else {
00
     [word] angle
}

--> Add:
            else
            {
                1   byte    DirectionWalk (0 = SpinOnPoint, 1 = Sky-/ArrowKey-walking)
                2   ushort  Angle
            }
Code:
     [byte] flag (alive_state)
     [byte] flag (stance)
     [byte] flag (berserk)
00

--> Correction: 
            1   byte    StateFlag(1 = Alive, 2 = Dead)
            1   byte    *unk -> Check for != 0
            1   byte    Action (0 = None, 2 = Walking, 3 = Running, 4 = Sitting)
            1   byte    Status(0 = None, 1 = Berserk , 2 = ?, 3 = Invincible, 4 = Invisible)
Code:
     [byte] flag (transport)
00

--> Correction:
            1   byte    RideFlag
            1   byte    AttackFlag
Edit:
Code:
if(buff) {
    [dword] pk2 (skill/item)
    [dword] Duration (ms)
}

--> Add:
            foreach(ActiveBuff)
            {
                RefSkillID
                Duration
                if(RefSkill.Params.Contains: 1701213281  -> atfe -> "auto transfer effect" like Recovery Division)
                {
                    1   byte    Creator
                }
            }
I'm not trying to offend you, just corrections. I might have some mistakes as well :D
Thanks for guild_war and pk_status, i'll check them.
You are doing great job at least if you're parsing them yourself and not collecting them together :P