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

Trying to change Protocol Login from lua into C++ file

darkshin

New old member
Joined
Dec 14, 2010
Messages
231
Reaction score
21
DEVELOPMENT SO FAR:
https://gist.github.com/DarkShinz/5ffbc9e72519366f5537 (without compiler errors)

BUGS SO FAR:
Something related to the removal of the protocolLogin.lua file of the modules affected some

other structures. I think it's related to a connection sutff or something, because some

modules cannot call functions that aren't removed and are related with the other protocols.

A print:



erro2.jpg



Hello Guys!!!

I'm trying to change the protocollogin.lua, located at the modules lib, into a C++ file, within the sourcers. For me, I prefer this way because I sucks at lua.
So far I've found some differences, like some functions that aren't within the sourcers and I can't find them at module libs. Like: " onOpcode "; " onMotd "; " onSessionKey ";
Someone knows where I can find those functions?

Also, I have no idea if it will workout after is done.
Does someone tried it before? And most important, why it was made in lua instead of C++, like it's in the server's file?

Are you ppl interested in this ?
 
Last edited:
Those "functions" are just callbacks which are called when a specific event happens, just like ProtocolGame has ProtocolGame:: onConnect, ProtocolGame:: onError.
There is no reason not to do it in lua.
 
Those "functions" are just callbacks which are called when a specific event happens, just like ProtocolGame has ProtocolGame:: onConnect, ProtocolGame:: onError.
There is no reason not to do it in lua.

Yes, but these callbacks are used at lua to call a C++ function, example:

Code:
signalcall(self.onLoginError, self, errorMessage)

This event refers to the:

Code:
void Game::processLoginError(const std::string& error)
{  g_lua.callGlobalField("g_game", "onLoginError", error); }

Thing is...

I can't find anything that the " onOpcode "; " onMotd "; " onSessionKey "; are refering to. Do they do anything or are just empty callbacks?
 
Which function is
Code:
signalcall(self.onLoginError, self, errorMessage)
calling?
 
Which function is
Code:
signalcall(self.onLoginError, self, errorMessage)
calling?

This one (I believe):
Code:
void Game::processLoginError(const std::string& error)
{ 

g_lua.callGlobalField("g_game", "onLoginError", error);

}
 
@Summ Do you know if "std::to_string" at the following code, could replace "iptostring"?

Code:
character.worldIp = std::to_string(msg->getU32()); //iptostring

Also, do you know if I have to create a function or there's something already set up to replace "getTable()" from the following code:

Code:
int8_t characters = msg->getTable();
 
Last edited:
I think I've worked the sources out... now need to fix modules errors :p
 
Last edited:
Back
Top