johnsamir
Advanced OT User
have added your cast system into my tfs i can see character list
GM Ratx has logged in.
finally logged in but cant enable cast i does not work when i type command !cast also if i try to log in to game with no password/account i get message invalidad account name
RPG Server Online!
GM Ratx has logged in.
finally logged in but cant enable cast i does not work when i type command !cast also if i try to log in to game with no password/account i get message invalidad account name
LUA:
Lua:
void ProtocolLogin::onRecvFirstMessage(NetworkMessage& msg)
{
if (g_game.getGameState() == GAME_STATE_SHUTDOWN) {
disconnect();
return;
}
msg.skipBytes(2); // client OS
uint16_t version = msg.get<uint16_t>();
msg.skipBytes(12);
/*
* Skipped bytes:
* 4 bytes: protocolVersion
* 12 bytes: dat, spr, pic signatures (4 bytes each)
* 1 byte: 0
*/
if (version <= 760) {
disconnectClient(fmt::format("Only clients with protocol {:s} allowed!", CLIENT_VERSION_STR));
return;
}
if (!Protocol::RSA_decrypt(msg)) {
disconnect();
return;
}
xtea::key key;
key[0] = msg.get<uint32_t>();
key[1] = msg.get<uint32_t>();
key[2] = msg.get<uint32_t>();
key[3] = msg.get<uint32_t>();
enableXTEAEncryption();
setXTEAKey(std::move(key));
if (version < CLIENT_VERSION_MIN || version > CLIENT_VERSION_MAX) {
disconnectClient(fmt::format("Only clients with protocol {:s} allowed!", CLIENT_VERSION_STR));
return;
}
if (g_game.getGameState() == GAME_STATE_STARTUP) {
disconnectClient("Gameworld is starting up. Please wait.");
return;
}
if (g_game.getGameState() == GAME_STATE_MAINTAIN) {
disconnectClient("Gameworld is under maintenance.\nPlease re-connect in a while.");
return;
}
BanInfo banInfo;
auto connection = getConnection();
if (!connection) {
return;
}
if (IOBan::isIpBanned(connection->getIP(), banInfo)) {
if (banInfo.reason.empty()) {
banInfo.reason = "(none)";
}
disconnectClient(fmt::format("Your IP has been banned until {:s} by {:s}.\n\nReason specified:\n{:s}", formatDateShort(banInfo.expiresAt), banInfo.bannedBy, banInfo.reason));
return;
}
std::string accountName = msg.getString();
if (accountName.empty()) {
disconnectClient("Invalid account name.");
return;
}
std::string password = msg.getString();
if (password.empty()) {
disconnectClient("Invalid password.");
return;
}
// OTCv8 version detection
uint16_t otclientV8 = 0;
uint16_t otcV8StringLength = msg.get<uint16_t>();
if (otcV8StringLength == 5 && msg.getString(5) == "OTCv8") {
otclientV8 = msg.get<uint16_t>(); // 253, 260, 261, ...
}
auto thisPtr = std::static_pointer_cast<ProtocolLogin>(shared_from_this());
if (password.empty())
{
if (!g_config.getBoolean(ConfigManager::ENABLE_LIVE_CASTING))
disconnectClient("Cast System is disabled.");
else
g_dispatcher.addTask([thisPtr]() { thisPtr->getCastingStreamsList(); });
return;
}
g_dispatcher.addTask(createTask(std::bind(&ProtocolLogin::getCharacterList, thisPtr, accountName, password)));
}