Character List Packet

Results 1 to 3 of 3
  1. #1
    Enthusiast Nini is offline
    MemberRank
    Oct 2008 Join Date
    CanadaLocation
    38Posts

    Character List Packet

    Hello everyone.

    I need some help with my project, vbFlyFF. The problem I have been having is with the character list packet. I cannot seem to get it to work.

    Here is my code for the packet (you will probably need to know Visual Basic .NET to understand):

    Code:
    Dim pc As New PacketCreator(packethandler.handler)
            pc.addInt(&HF6)
            pc.addInt(0)
            Dim list As IList = MySQL.getCharacters(userid)
            pc.addInt(list.Count)
    
            Dim c As Character
            Dim lastSlot As Integer = 0
            Dim i As Integer = 0
    
            For Each obj As Object In list
                c = obj
                pc.addInt(c.slot)
                pc.addInt(1)
                pc.addInt(c.mapID)
                pc.addInt(&HC)
                pc.addString(c.name)
                pc.addFloat(c.x)
                pc.addFloat(c.y)
                pc.addFloat(c.z)
                pc.addInt(c.id)
                pc.addInt(0)
                pc.addInt(0)
                pc.addInt(0)
                pc.addInt(0)
                pc.addInt(c.hairstyle)
                pc.addInt(c.haircolor)
                pc.addInt(c.face)
                pc.addInt(c.gender)
                pc.addInt(c.job)
                pc.addInt(c.level)
                pc.addInt(0)
                pc.addInt(c.str)
                pc.addInt(c.sta)
                pc.addInt(c.dex)
                pc.addInt(c.intt)
                pc.addInt(0)
                Dim equips As IList = New Collections.ArrayList
                pc.addInt(MySQL.getEquips(c.id, equips))
                Dim id As Integer
                For Each myObj As Object In equips
                    id = myObj
                    pc.addInt(id)
                    id = Nothing
                Next
                lastSlot = c.slot
                c = Nothing
                i += 1
            Next
            pc.addInt(lastSlot)
            For t As Integer = 0 To i Step t + 1
                pc.addInt(t)
                pc.addInt(2)
            Next
            pc.send()
    And here is the packet itself:

    Code:
    f6 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00
    0c 00 00 00 04 00 00 00 4e 69 6e 69 00 00 f6 42 00 00 f6 42 00 00 f6 42 01 00 00
     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 01 0
    0 00 00 00 00 00 00 00 00 00 00 78 00 00 00 00 00 00 00 0f 00 00 00 0f 00 00 00
    0f 00 00 00 0f 00 00 00 00 00 00 00 01 00 00 00 4d e1 01 00 00 00 00 00 00 00 00
     00 02 00 00 00 01 00 00 00 02 00 00 00
    Thanks for any help


  2. #2
    Account Upgraded | Title Enabled! adidishen is offline
    MemberRank
    Jan 2007 Join Date
    EarthLocation
    516Posts

    Re: Character List Packet

    Code:
                Packet pak = new Packet();
                pak.Addint32(PAK_CHARACTER_LIST);
                pak.Addint32(dwTimeGetTime);
                if (characters.Count < 1)
                {
                    pak.Addint64(0);
                    pak.Send(c_socket);
                    return;
                }
                pak.Addint32(characters.Count);
                for (int i = 0; i < characters.Count; i++)
                {
                    Character c = (Character)characters[i];
                    pak.Addint32(c.slot);
                    pak.Addint32(1);
                    pak.Addint32(c.mapID);
                    pak.Addint32(0x0B + c.gender);
                    pak.Addstring(c.charactername);
                    pak.Addfloat(c.x);
                    pak.Addfloat(c.y);
                    pak.Addfloat(c.z);
                    pak.Addint32(c.id);
                    pak.Addint64(0);
                    pak.Addint64(0);
                    pak.Addint32(c.hairstyle);
                    pak.Addbytes(GetBytesFromHex(c.haircolor));
                    pak.Addint32(c.facemodel);
                    pak.Addbyte(c.gender);
                    pak.Addint32(c.jobid);
                    pak.Addint32(c.level);
                    pak.Addint32(0);
                    pak.Addint32(c.strength);
                    pak.Addint32(c.stamina);
                    pak.Addint32(c.dexterity);
                    pak.Addint32(c.intelligence);
                    pak.Addint32(0);
                    pak.Addint32(c.items.Count);
                    for (int l = 0; l < c.items.Count; l++)
                        pak.Addint32(c.items[l]);
                }
                pak.Addint32(characters.Count);
                for (int i = 0; i < characters.Count; i++)
                {
                    pak.Addint32(i);
                    pak.Addint32(2);
                }
                pak.Send(c_socket);
            }
    Yours:

    Code:
    Dim pc As New PacketCreator(packethandler.handler)
            pc.addInt(&HF6)
            pc.addInt(0) ' This one is some sort of synchronization form between client & server. you should get it off every cluster server packet and, when you send the character list, add it here. In 0xF3 incoming packet, you read it after reading the build date.
            Dim list As IList = MySQL.getCharacters(userid)
            pc.addInt(list.Count)
     
            Dim c As Character
            Dim lastSlot As Integer = 0
            Dim i As Integer = 0
     
            For Each obj As Object In list
                c = obj
                pc.addInt(c.slot)
                pc.addInt(1)
                pc.addInt(c.mapID)
                pc.addInt(&HC)
                pc.addString(c.name)
                pc.addFloat(c.x)
                pc.addFloat(c.y)
                pc.addFloat(c.z)
                pc.addInt(c.id)
                pc.addInt(0)
                pc.addInt(0)
                pc.addInt(0)
                pc.addInt(0)
                pc.addInt(c.hairstyle)
                pc.addInt(c.haircolor)
                pc.addInt(c.face)
                pc.addInt(c.gender) ' This should be added as a byte instead
                pc.addInt(c.job)
                pc.addInt(c.level)
                pc.addInt(0)
                pc.addInt(c.str)
                pc.addInt(c.sta)
                pc.addInt(c.dex)
                pc.addInt(c.intt)
                pc.addInt(0)
                Dim equips As IList = New Collections.ArrayList ' Don't use arraylists, they suck. use List<int> instead. just a side note.
                pc.addInt(MySQL.getEquips(c.id, equips)) 
                Dim id As Integer
                For Each myObj As Object In equips
                    id = myObj
                    pc.addInt(id)
                    id = Nothing
                Next
                lastSlot = c.slot
                c = Nothing
                i += 1
            Next
            pc.addInt(lastSlot)
            For t As Integer = 0 To i Step t + 1
                pc.addInt(t)
                pc.addInt(2)
            Next
            pc.send()

  3. #3
    Enthusiast Nini is offline
    MemberRank
    Oct 2008 Join Date
    CanadaLocation
    38Posts

    Re: Character List Packet

    Thanks for the quick reply adidishen. I have made some changes and I hope it works.



    EDIT: Yay! It worked! Thanks adidishen!



Advertisement