• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ What controls the protocols?

Status
Not open for further replies.

Digital

Learning C++
Joined
Jul 15, 2018
Messages
57
Solutions
1
Reaction score
12
TFS 1.3

Where would I start if I wanted to modify the protocols. I don't understand the addByte functions in ProtocolGame. How would I know what byte to add in? Is there a list of bytes in some order?

Is there a tutorial on modifying the bytes? Any assistance would be a great help.
Thanks.
 
You can look into opcode managment >thats the big switch there, that calls the appropriate functions to received bytes from client. For certain command (opcode) and its data (for example> opcode 10 = talk to chat , data = message) the server might execute the action (or not if the player is exhausted or smth other). Its all written in hexadecimals since both machines needs to talk between each other as smooth and fast as possible.

Also if you want to make changes there, keep in mind that part is responsible for connection between serv and client so you will need to do the changes in both, and as long you don't operate on OTC it might be pretty harder.
 
You can look into opcode managment >thats the big switch there, that calls the appropriate functions to received bytes from client. For certain command (opcode) and its data (for example> opcode 10 = talk to chat , data = message) the server might execute the action (or not if the player is exhausted or smth other). Its all written in hexadecimals since both machines needs to talk between each other as smooth and fast as possible.

Also if you want to make changes there, keep in mind that part is responsible for connection between serv and client so you will need to do the changes in both, and as long you don't operate on OTC it might be pretty harder.
But how do you know which values to send? All you are telling me is to look at the switch statement that has the opcodes associated with it but you aren't explaining how the opcodes, bytes, strings and any other values are sent from the client to the server & vice versa.

For example in this function disconnectClient where do you get the information of 0x14 aside from the switch statement and how does the client know to expect a string? more importantly how would you break it apart?
C++:
void ProtocolGame::disconnectClient(const std::string& message) const
{
    auto output = OutputMessagePool::getOutputMessage();
    output->addByte(0x14);
    output->addString(message);
    send(output);
    disconnect();
}
Thanks for the responding to this question but it seems like people are misinterpreting my question. Yes I want to make changes but you still have not answered my question. How do you read & generate the packets for the protocol?
 
But how do you know which values to send?
Its defined by cipsoft client, TFS is made to be able to work with it. Only you can do is adapt to it, or use open-source client (OTC)

All you are telling me is to look at the switch statement that has the opcodes associated with it but you aren't explaining how the opcodes, bytes, strings and any other values are sent from the client to the server & vice versa.

theyre sent via tcp sockets

For example in this function disconnectClient where do you get the information of 0x14 aside from the switch statement and how does the client know to expect a string? more importantly how would you break it apart?
C++:
void ProtocolGame::disconnectClient(const std::string& message) const
{
    auto output = OutputMessagePool::getOutputMessage();
    output->addByte(0x14);
    output->addString(message);
    send(output);
    disconnect();
}

Seems like 0x14 is code for request to dc client. The value, data, data type is defined by cipsoft so as long we use their client closed-source client we (TFS) need to play on their rules.
 
But how do you know which values to send?
There are several ways to get the client opcodes that cipsoft make in their client, for ex. you can check otclient sources or decompiled flash client sources(since cipsoft removed flash client there aren't any sources for 11+ protocol). If you want to know how otserver devs know the opcodes before cipsoft made the flash client the answer is reverse engineering which isn't easy until you decide to learn assembly language(for versions before 7.7(xtea encryption etc) there was possibility to use simple packet sniffer and guess how the protocol works).
 
Status
Not open for further replies.
Back
Top