Jump to content

C++ to AutoIt


 Share

Recommended Posts

Hey, can anyone help me with translate something from C++ to AutoIt ?

void MakeLoginPacket(char* LoginPacket, unsigned long newXTeaKey[4], unsigned int ClientVersion, unsigned int ClientOS, string accname, string accchar, string accpassword, char connectionRequest[5])
{
    char PacketBuffer[MAXBUFFER];
    int accnameLen, acccharLen, accpasswordLen, tempChecksum;
    TibiaCrypt crypt;
        
    PacketBuffer[0] = 0x89;     //packet size
    PacketBuffer[1] = 0x00;

    PacketBuffer[2] = 0x0A;     //game server type

    memcpy(&PacketBuffer[3], &ClientOS, 2);     //OS, 1 = linux, 2 = windows

    memcpy(&PacketBuffer[5], &ClientVersion, 2);   //client version

    PacketBuffer[7] = 0x00;     //white byte, here starts the RSA encryption

    memcpy(&PacketBuffer[8],&newXTeaKey[0],4);    //and add it to the buffer
    memcpy(&PacketBuffer[12],&newXTeaKey[1],4);
    memcpy(&PacketBuffer[16],&newXTeaKey[2],4);
    memcpy(&PacketBuffer[20],&newXTeaKey[3],4);

    PacketBuffer[24] = 0x00;    //player = 0, 1 = GM

    accnameLen = accname.length();      //account name
    memcpy(&PacketBuffer[25], &accnameLen, 2);
    memcpy(&PacketBuffer[27], accname.c_str(), accnameLen);

    acccharLen = accchar.length();      //chracter name
    memcpy(&PacketBuffer[27+accnameLen], &acccharLen, 2);
    memcpy(&PacketBuffer[29+accnameLen], accchar.c_str(), acccharLen);

    accpasswordLen = accpassword.length();      //account password
    memcpy(&PacketBuffer[29+accnameLen+acccharLen], &accpasswordLen, 2);
    memcpy(&PacketBuffer[31+accnameLen+acccharLen], accpassword.c_str(), accpasswordLen);

    //fill the packet request info
    memcpy(&PacketBuffer[31+accnameLen+acccharLen+accpasswordLen], &connectionRequest[0], 5);

    crypt.SetRSAKey((char*)TibiaRSAKey);
    crypt.RSAEncrypt(&PacketBuffer[7], 128);        //crypt the packet with the RSA key

    memcpy(&LoginPacket[0],&PacketBuffer[0],2);     //add the checksum
    tempChecksum = crypt.adler((uint8_t*)&PacketBuffer[2],133);
    memcpy(&LoginPacket[2],&tempChecksum,4);
    memcpy(&LoginPacket[6],&PacketBuffer[2],200);
}
Link to comment
Share on other sites

  • Developers

Game client? Thought that was supposed to be a human and guess you are referring to a BOT?

Anyways ... have fun and come back when you have an Autoit3 question, not a "make a script for me because I do not understand the C++ code I found on the internet."

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...