• 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!

OTClient Custom protocol - protocollogin.lua and entergame.lua ?

Kuantikum

Member
Joined
Jul 3, 2015
Messages
219
Solutions
1
Reaction score
20
Hello guys,

I have a custom protocol "312" to be added in OTClient V8 and I have edited:

Lua:
""protocollogin.lua""

function ProtocolLogin:sendLoginPacket()
  local msg = OutputMessage.create()
  msg:addU8(ClientOpcodes.ClientEnterAccount)
  msg:addU16(g_game.getOs())
  if g_game.getCustomProtocolVersion() > 0 then
    msg:addU16(312)  -- msg:addU16(g_game.getCustomProtocolVersion())
  else
    msg:addU16(g_game.getProtocolVersion())
  end

Done this i can login into CHARACTER LIST.

charct.PNG

but when i selected to login with the character, i get the same error:

loginerror.jpg

Here is my "protocollogin.lua" and "entergame.lua"



Can you help me, please?

Thanks very much!
 
Last edited:
Set it in entergame.lua:
Code:
g_game.setCustomProtocolVersion(312)
There are few occurrences of setCustomProtocolVersion . Debug which is used in your case or just edit them all.
 
Set it in entergame.lua:
Code:
g_game.setCustomProtocolVersion(312)
There are few occurrences of setCustomProtocolVersion . Debug which is used in your case or just edit them all.


I edited it on entergame.lua, but i get the the same notification, I can login into character list, but no into the game:

error.PNG
Post automatically merged:

I have compiled the server source, changing:

Lua:
#define CLIENT_VERSION_MIN 312
#define CLIENT_VERSION_MAX 312
#define CLIENT_VERSION_STRING "Your client is outdated, please visit http://www.psoul.net and download the latest client."

Into:

Lua:
#define CLIENT_VERSION_MIN 854
#define CLIENT_VERSION_MAX 854
#define CLIENT_VERSION_STRING "Your client is outdated, please visit http://www.psoul.net and download the latest client."

in "resources.h" and it works, but when i join the server i get the client like this:

1624046109281.png

and the client crashes.

my .spr and .dat is:

1624046233083.png

Can you help me ?
 
Last edited:
Did you edit all g_game.setCustomProtocolVersion in that file or just one?
What is official client for that server? There can be custom client version (312) and other anti-bot features, like added one extra byte to game protocol that detects custom client (official server client). In this case, you cannot use OTCv8 (no sources - cannot add extra byte).
When I prepared custom client for Kasteria X years ago, I added 5 different client detection features, so hackers had to waste a lot of time to connect with other client. They fixed one problem, there appeared other.
 
Did you edit all g_game.setCustomProtocolVersion in that file or just one?
What is official client for that server? There can be custom client version (312) and other anti-bot features, like added one extra byte to game protocol that detects custom client (official server client). In this case, you cannot use OTCv8 (no sources - cannot add extra byte).
When I prepared custom client for Kasteria X years ago, I added 5 different client detection features, so hackers had to waste a lot of time to connect with other client. They fixed one problem, there appeared other.

I changed the version in the server sources and it works, now i can login into server, i get black screen and the client crash 3 secs later
Post automatically merged:

I got this erros on otclientv8.log:

Lua:
GPU ANGLE (NVIDIA GeForce RTX 2070 Direct3D11 vs_5_0 ps_5_0) (Google Inc.)
OpenGL OpenGL ES 3.0.0 (ANGLE 2.1.0.54a3d7cbcadb)
[Atlas] Texture size is: 4096x4096 (max: 16384x16384)
Found work dir at 'C:/AURORA PROJETO/SERVERS/CLIENTS/otclientv8-master/'
== application started at Jun 18 2021 23:27:33
OTCv8 3.0 rev 83 (dev) made by otclient.net built on May 26 2021 for arch x86
ERROR: Failed to read dat '/things/854/Tibia.dat': corrupt data (id: 637, category: 0, count: 255, lastAttr: 24)'
Connecting to: 127.0.0.1:7171
Login to 127.0.0.1:7171
ERROR: Unable to send extended opcode 201, extended opcodes are not enabled on this server.
ERROR: ProtocolGame parse message exception (21 bytes, 12 unread, last opcode is 0xff (255), prev opcode is 0xffffffff (-1)): unhandled opcode 255
Packet has been saved to packet.log, you can use it to find what was wrong. (Protocol: 854)
ERROR: ProtocolGame parse message exception (10 bytes, 1 unread, last opcode is 0xff (255), prev opcode is 0xffffffff (-1)): unhandled opcode 255
Packet has been saved to packet.log, you can use it to find what was wrong. (Protocol: 854)
ERROR: lua function callback failed: C++ call failed: LUA ERROR: attempt to cast a 'nil' lua value to 'class Position'
stack traceback:
    [builtin#146]: at 0x01156570
    [C]: in function 'getSpectatorsInRangeEx'
    /modules/game_battle/battle.lua:238: in function 'checkCreatures'
    /modules/game_battle/battle.lua:224: in function </modules/game_battle/battle.lua:221>
stack traceback:
    [builtin#146]: at 0x01156570
    [C]: in function 'getSpectatorsInRangeEx'
    /modules/game_battle/battle.lua:238: in function 'checkCreatures'
    /modules/game_battle/battle.lua:224: in function </modules/game_battle/battle.lua:221>
ERROR: ProtocolGame parse message exception (2336 bytes, 2317 unread, last opcode is 0xaf (175), prev opcode is 0x0a (10)): InputMessage eof reached
Packet has been saved to packet.log, you can use it to find what was wrong. (Protocol: 854)
Post automatically merged:

I also updated this:

1624052261559.png

on OTCv8/otclientv8 (https://github.com/OTCv8/otclientv8/blob/master/modules/game_features/features.lua)
 
Last edited:
I changed the version in the server sources and it works, now i can login into server, i get black screen and the client crash 3 secs later
That's common 'anti bot trick' with extra bytes.
like added one extra byte to game protocol that detects custom client
Server send packets with extra bytes, it's not compatible with any tibia protocol (like 8.1, 8.6 etc.). So now you need to check what changes are in server protocol (a loooot of work) and implement same changes in client :(
 
That's common 'anti bot trick' with extra bytes.

Server send packets with extra bytes, it's not compatible with any tibia protocol (like 8.1, 8.6 etc.). So now you need to check what changes are in server protocol (a loooot of work) and implement same changes in client :(

You mean check all the server sources files with tag "protocol" ?
 
You mean check all the server sources files with tag "protocol" ?
I mean you need to know every byte of X.XX protocol and find what is changed in server sources. It can take hoooours. Someone implemented antibot system - allow only official client - and you need to use his client. Trying to use other client may take hooours.
 
I mean you need to know every byte of X.XX protocol and find what is changed in server sources. It can take hoooours. Someone implemented antibot system - allow only official client - and you need to use his client. Trying to use other client may take hooours.

Got you, no problem about the time, maybe are you talking about this one (packet):

Lua:
ProtocolGame parse message exception (21 bytes, 12 unread, last opcode is 0xff (255), prev opcode is 0xffffffff (-1), proto: 854): unhandled opcode 255
14 00 24 08 e6 3f 0d 00
ff 01 90 29 04 fa 2e eb 2d c2 2d ef 2d

ProtocolGame parse message exception (10 bytes, 1 unread, last opcode is 0xff (255), prev opcode is 0xffffffff (-1), proto: 854): unhandled opcode 255
0c 00 76 05 df 1a 02 00
ff 07

ProtocolGame parse message exception (2350 bytes, 2333 unread, last opcode is 0x2b (43), prev opcode is 0x0a (10), proto: 854): unhandled opcode 43
2c 09 d5 76 e8 71 26 09
0a f1 60 00 10 32 00 01
2b 03 0b aa aa aa aa d5 d5 d5 d5 d5 d5 d5 d5 d5 d5 d5 d5 d5 d5 d5 d5 64 ee 0c 37 02 07 a3 11 5d 58 00 ff a3 11 d0 58 00 ff a3 11 cf 58 00 ff a3 11 cf 58 00 ff a6 11 ce 58 00 ff a5 11 4f 04 5d 58 00 ff a3 11 50 04 60 58 61 2e 00 ff ad 01 bb 11 4a 18 00 ff ad 01 b7 11 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 b9 11 00 ff a3 11 23 0e 47 0e 00 ff a3 11 29 0e 48 18 00 ff a3 11 25 0e 49 18 00 ff a3 11 21 0e 49 18 00 ff a3 11 1e 0e 64 07 48 18 00 ff a3 11 23 0e 4a 18 00 ff a3 11 49 0e 00 ff ad 01 b3 11 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff a3 11 49 18 00 ff ae 11 22 0e 00 ff ad 01 bb 11 00 ff ad 01 b6 11 00 ff ad 01 bd 11 48 18 00 ff a3 11 70 41 47 18 00 ff ad 01 bb 11 71 41 00 ff ad 01 b7 11 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff a3 11 1e 0e 00 ff a3 11 42 07 48 18 00 ff ad 01 b3 11 00 ff ad 01 00 ff ad 01 b9 11 00 ff ad 01 b6 11 00 ff ad 01 b7 11 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff a3 11 26 0e 49 18 00 ff ad 01 bb 11 00 ff ad 01 b7 11 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 b6 11 00 ff ad 01 b7 11 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 61 00 00 00 00 00 f1 60 00 10 03 00 47 4f 44 64 02 20 02 4e 44 3a 4c 00 ff 00 dc 05 00 00 00 00 01 00 00 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 ba 11 00 ff ad 01 b4 11 00 ff ad 01 b8 11 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 ba 11 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 b5 11 00 ff a3 11 61 0e 00 ff ad 01 bc 11 35 0f 00 ff ad 01 b4 11 00 ff ad 01 b4 11 49 18 00 ff ad 01 b4 11 4a 18 00 ff ad 01 be 11 5a 11 00 ff ad 01 b8 11 4b 07 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 00 ff ad 01 ba 11 00 ff ad 01 b4 11 00 ff ad 01 be 11 3c 08 00 ff a3 11 25 0e 00 ff a3 11 61 0e 00 ff a3 11 00 ff a8 11 43 07 00 ff a3 11 49 18 00 ff a3 11 5b 11 00 ff ad 01 bc 11 47 18 00 ff ad 01 b4 11 00 ff ad 01 b8 11 00 ff ad 01 00 ff ad 01 ba 11 00 ff ad 01 be 11 00 ff a3 11 70 1b 00 ff a9 11 4e 05 00 ff a3 11 4c 05 00 ff a3 11 4c 05 00 ff ab 11 b7 14 00 ff a3 11 4c 05 00 ff a3 11 4c 05 00 ff a3 11 4c 05 00 ff a3 11 b7 14 00 ff a3 11 4c 05 00 ff ad 01 bc 11 b7 14 00 ff ad 01 b4 11 84 06 00 ff ad 01 be 11 4c 05 00 ff a3 11 4c 05 00 ff a3 11 4b 07 4a 18 00 ff a3 11 4d 05 00 ff cf 01 bd 09 00 ff cf 01 00 ff cf 01 00 ff cf 01 4d 05 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 b6 14 00 ff a3 11 49 18 00 ff a3 11 b6 14 00 ff cf 01 be 09 00 ff cf 01 00 ff cf 01 00 ff cf 01 4d 05 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 4d 05 00 ff a3 11 4a 18 00 ff a3 11 4d 05 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 4d 05 00 ff cf 01 9b 07 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 4d 05 00 ff a3 11 67 07 48 18 00 ff a3 11 b6 14 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 87 06 00 ff cf 01 00 ff cf 01 00 ff cf 01 4c 05 00 ff cf 01 4c 05 00 ff cf 01 4c 05 00 ff cf 01 4c 05 00 ff cf 01 4c 05 00 ff cf 01 50 05 00 ff a3 11 00 ff a3 11 4d 05 00 ff cf 01 4c 05 00 ff cf 01 4c 05 00 ff cf 01 4c 05 00 ff cf 01 50 05 00 ff cf 01 00 ff cf 01 a0 ff 8a 04 00 ff 85 04 00 ff 85 04 00 ff 85 04 00 ff 85 04 00 ff 85 04 00 ff 85 04 00 ff 85 04 00 ff b7 08 00 ff b7 08 00 ff b7 08 00 ff b7 08 00 ff b7 08 01 ff 8b 04 00 ff 86 04 b8 08 00 ff 86 04 b7 08 00 ff 86 04 b7 08 00 ff 86 04 b7 08 00 ff 86 04 b7 08 00 ff 86 04 b7 08 00 ff 86 04 b7 08 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 b6 08 01 ff 8b 04 00 ff 86 04 b6 08 00 ff cf 01 00 ff cf 01 00 ff cf 01 96 4d 00 ff cf 01 90 4d 00 ff cf 01 99 4d 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 b6 08 01 ff 8b 04 00 ff 86 04 b6 08 00 ff cf 01 00 ff cf 01 96 4d 00 ff cf 01 92 4d 00 ff d5 01 90 4d 00 ff cf 01 95 4d 00 ff cf 01 99 4d 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 00 ff cf 01 b6 08 01 ff 8a 04 8b 04 00 ff 86 04 b6 08 00 ff cf 01 00 ff cf 01 8e 4d 00 ff 67 00 00 ff 67 00 00 ff 67 00 00 ff cf 01 8f 4d 00 ff cf 01 90 4d 00 ff cf 01 90 4d 00 ff cf 01 90 4d 00 ff cf 01 90 4d 00 ff cf 01 99 4d b6 08 01 ff 8e 04 8d 04 00 ff 89 04 b6 08 00 ff cf 01 00 ff cf 01 8e 4d 00 ff 67 00 00 ff 67 00 00 ff 67 00 00 ff cf 01 8f 4d 00 ff 81 27 00 ff 81 27 00 ff 81 27 00 ff 81 27 00 ff cf 01 8f 4d b6 08 01 ff 8a 04 8e 04 00 ff 89 04 b6 08 00 ff cf 01 00 ff cf 01 8e 4d 00 ff 67 00 00 ff 67 00 00 ff 67 00 00 ff cf 01 8f 4d ff ff ff ff ff ff ff ff ff ff e8 ff 78 01 85 02 79 02 78 03 9c 2c 78 04 33 2e 78 05 e9 2b 78 06 ea 2b 78 07 90 29 78 08 70 2b 79 09 78 0a 60 2e a0 b9 00 b9 00 40 42 0f 00 30 11 00 00 08 00 09 00 00 00 00 12 00 64 d8 09 a1 0a 00 0a 00 0a 00 0a 00 0a 00 0a 00 0a 00 82 ff d7 8d f1 60 00 10 ff 00 a2 00 00 a0 b9 00 b9 00 40 42 0f 00 30 11 00 00 08 00 09 00 00 00 00 12 00 64 d8 09 a0 b9 00 b9 00 40 42 0f 00 30 11 00 00 08 00 09 00 00 00 00 12 00 64 d8 09 79 07 a0 b9 00 b9 00 40 42 0f 00 30 11 00 00 08 00 09 00 00 00 00 12 00 64 d8 09 78 07 90 29 a0 b9 00 b9 00 40 42 0f 00 30 11 00 00 08 00 09 00 00 00 00 12 00 64 d8 09 b4 18 81 00 42 65 6d 2d 76 69 6e 64 6f 20 61 6f 20 47 65 6e 65 73 69 73 20 57 6f 72 6c 64 2c 20 74 6f 72 6e 65 2d 73 65 20 75 6d 20 6d 65 73 74 72 65 20 70 6f 6b e9 6d 6f 6e 2e 20 50 61 73 73 65 20 70 6f 72 20 74 6f 64 61 73 20 61 73 20 6d 69 73 73 f5 65 73 2c 20 63 6f 6e 63 6c 75 61 20 61 73 20 71 75 65 73 74 27 73 20 65 20 65 78 70 6c 6f 72 65 20 6e 6f 73 73 61 73 20 63 69 64 61 64 65 73 2e 20 b4 18 3e 00 49 66 20 79 6f 75 20 6e 65 65 64 20 73 6f 6d 65 20 68 65 6c 70 20 75 73 65 20 74 68 65 20 48 65 6c 70 20 61 6e 64 20 74 68 65 20 57 69 6b 69 20 43 68 61 74 20 63 68 61 6e 6e 65 6c 73 2e b4 18 4e 00 59 6f 75 72 20 6c 61 73 74 20 76 69 73 69 74 20 77 61 73 20 39 20 6d 69 6e 75 74 65 73 20 61 6e 64 20 31 32 20 73 65 63 6f 6e 64 73 20 61 67 6f 2c 20 6f 6e 20 46 72 69 20 4a 75 6e 20 31 38 20 31 38 3a 31 34 3a 35 36 20 32 30 32 31 2e a0 b9 00 b9 00 40 42 0f 00 30 11 00 00 08 00 09 00 00 00 00 12 00 64 d8 09 b4 16 2b 00 47 65 74 20 70 72 65 6d 69 75 6d 20 73 74 61 74 75 73 20 74 6f 20 72 65 63 69 76 63 65 20 31 30 25 20 6d 6f 72 65 20 65 78 70 21 a2 00 00 a2 00 00 83 ee 0c 37 02 07 0b 00

Maybe you can teach me an exemple, how can i find "byte of X.XX protocol (Im sry, but i dont get this term X.XX)" in source files.
 
Got you, no problem about the time, maybe are you talking about this one (packet):

Lua:
ProtocolGame parse message exception (21 bytes, 12 unread, last opcode is 0xff (255), prev opcode is 0xffffffff (-1), proto: 854): unhandled opcode 255
14 00 24 08 e6 3f 0d 00
ff 01 90 29 04 fa 2e eb 2d c2 2d ef 2d
1. Only first error "parse message exception" after login matters. Rest can be result of not reading first invalid packet.
2. Errors like that may occure because of 2 reasons:
  • extra bytes added to protocol by server author (to block custom clients = bots)
  • not compatible .otb (server) <-> .dat (client)

Maybe you can teach me an exemple, how can i find "byte of X.XX protocol (Im sry, but i dont get this term X.XX)" in source files.
I mean 8.10 or 8.60. Client expects some official tibia protocol. Server uses some tibia protocol with changes. To find changes, you need some other engine with X.XX protocol (ex. 8.60) to compare what bytes should be there and what bytes you get from server.
 
I edited it on entergame.lua, but i get the the same notification, I can login into character list, but no into the game:

View attachment 59696
Post automatically merged:

I have compiled the server source, changing:

Lua:
#define CLIENT_VERSION_MIN 312
#define CLIENT_VERSION_MAX 312
#define CLIENT_VERSION_STRING "Your client is outdated, please visit http://www.psoul.net and download the latest client."

Into:

Lua:
#define CLIENT_VERSION_MIN 854
#define CLIENT_VERSION_MAX 854
#define CLIENT_VERSION_STRING "Your client is outdated, please visit http://www.psoul.net and download the latest client."

in "resources.h" and it works, but when i join the server i get the client like this:

View attachment 59705

and the client crashes.

my .spr and .dat is:

View attachment 59706

Can you help me ?
off topic but where did you place he otcv8 libs i wanted to compile itoo
 
1. Only first error "parse message exception" after login matters. Rest can be result of not reading first invalid packet.
2. Errors like that may occure because of 2 reasons:
  • extra bytes added to protocol by server author (to block custom clients = bots)
  • not compatible .otb (server) <-> .dat (client)


I mean 8.10 or 8.60. Client expects some official tibia protocol. Server uses some tibia protocol with changes. To find changes, you need some other engine with X.XX protocol (ex. 8.60) to compare what bytes should be there and what bytes you get from server.

Thx, now i understand.

Do you have information (tutorial) on how can i learn to do these comparisons so that I can modify the client?
Post automatically merged:

off topic but where did you place he otcv8 libs i wanted to compile itoo
You can not compile it, cuz it do not have open sources as you can see here: OTCv8/otclientv8 (https://github.com/OTCv8/otclientv8)
 
Back
Top