Es EOBot - P Server Edition



 This download includes the source for Es Bot V2.2.


DOWNLOAD THE COMPILED EOBOT AND SOURCE CODE HERE











How to fix esbot to connect to p-servers

https://eoserv.net/forum/topic/23834







in packet.cpp under the includes add


unsigned short seqstart;
unsigned char seqval = 1;

unsigned short Sequence()
{
    unsigned short val = seqval;

    if (++seqval >= 10)
    {
        seqval = 0;//was 0
    }

    return seqstart + val;
}

void SetSeqStart(unsigned short val)
{
    seqstart = val;
}


and remove these variables and functions


PacketProcessor::seqstart

PacketProcessor::seqval

unsigned short PacketProcessor::Sequence()
{
    unsigned short val = seqval;

    if (++seqval >= 10)
    {
        seqval = 0;//was 0
    }

    return seqstart + val;
}

void PacketProcessor::SetSeqStart(unsigned short val)
{
    seqstart = val;
}


Replace your packet encode function with this


std::string PacketProcessor::Encode(const std::string &rawstr)
{

    std::string str = this->DickWinderE(rawstr);
    std::string newstr;
    int length = str.length();

    int i = 2;
    int ii = 2;

    newstr.resize(length);

    newstr[0] = str[0];
    newstr[1] = str[1];

    while (i < length)
    {
        newstr[i] = (unsigned char)str[ii++] ^ 0x80;
        i += 2;
    }

    i = length - 1;

    if (length % 2)
    {
        --i;
    }

    while (i >= 2)
    {
        newstr[i] = (unsigned char)str[ii++] ^ 0x80;
        i -= 2;
    }

    for (int i = 2; i < length; ++i)
    {
        if (static_cast<unsigned char>(newstr[i]) == 128)
        {
            newstr[i] = 0;
        }
        else if (newstr[i] == 0)
        {
            newstr[i] = 128;
        }
    }

    return newstr;
}


Near the bottom replace your PacketBulder::Get function with this


std::string PacketBuilder::Get()
{
    std::string retdata;
    util::pairchar id = PacketProcessor::EPID(this->id);

    int extra = (id[1] != 255);
    unsigned short sequence =  0;
    int bytes_ = 1;
    std::string seqdata = "";

    if(extra)
    {
        sequence = Sequence();

        if(sequence >= 253)
            bytes_ = 2;

        util::quadchar seq_ = PacketProcessor::ENumber(sequence);

        if(bytes_ == 1)
        {
             seqdata += seq_[0];
        }
        else
        {
            seqdata += seq_[0];
            seqdata += seq_[1];
        }
    }

    util::quadchar length = PacketProcessor::ENumber(this->length + 2 + (extra + bytes_ -1));

    retdata += length[0];
    retdata += length[1];
    retdata += id[0];
    retdata += id[1];
    retdata += seqdata;
    retdata += this->data;
    return retdata;
}

In packet.hpp under the includes place

extern unsigned short seqstart;
extern unsigned char seqval;

unsigned short Sequence();
void SetSeqStart(unsigned short val);

in the PacketProcessor class remove

seqstart;
seqval;
Sequence();
SetSeqStart(unsigned short val);

Comments

Popular posts from this blog

Another Graphic Patch For EoBot Client V29