mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 13:03:27 +02:00
Make otclient login into cipsoft servers again
This commit is contained in:
@@ -313,7 +313,7 @@ namespace Otc
|
||||
// 1-50 defined in c++
|
||||
GameProtocolChecksum = 1,
|
||||
GameAccountNames = 2,
|
||||
GameChallangeOnLogin = 3,
|
||||
GameChallengeOnLogin = 3,
|
||||
GamePenalityOnDeath = 4,
|
||||
GameNameOnNpcTrade = 5,
|
||||
GameDoubleFreeCapacity = 6,
|
||||
|
@@ -145,17 +145,21 @@ void Game::processLoginWait(const std::string& message, int time)
|
||||
g_lua.callGlobalField("g_game", "onLoginWait", message, time);
|
||||
}
|
||||
|
||||
void Game::processLogin()
|
||||
{
|
||||
g_lua.callGlobalField("g_game", "onLogin");
|
||||
}
|
||||
|
||||
void Game::processPendingGame()
|
||||
{
|
||||
m_localPlayer->setPendingGame(true);
|
||||
g_lua.callGlobalField("g_game", "onPendingGame");
|
||||
m_protocolGame->sendEnterGame();
|
||||
}
|
||||
|
||||
void Game::processEnterGame()
|
||||
{
|
||||
m_localPlayer->setPendingGame(false);
|
||||
m_protocolGame->sendEnterGame();
|
||||
|
||||
g_lua.callGlobalField("g_game", "onEnterGame");
|
||||
}
|
||||
|
||||
@@ -1277,7 +1281,7 @@ void Game::setProtocolVersion(int version)
|
||||
if(version >= 854) {
|
||||
enableFeature(Otc::GameProtocolChecksum);
|
||||
enableFeature(Otc::GameAccountNames);
|
||||
enableFeature(Otc::GameChallangeOnLogin);
|
||||
enableFeature(Otc::GameChallengeOnLogin);
|
||||
enableFeature(Otc::GameDoubleFreeCapacity);
|
||||
enableFeature(Otc::GameCreatureEmblems);
|
||||
}
|
||||
@@ -1399,6 +1403,6 @@ int Game::getOs()
|
||||
return 10;
|
||||
else if(g_app.getOs() == "mac")
|
||||
return 12;
|
||||
else
|
||||
return 10;
|
||||
else // linux
|
||||
return 11;
|
||||
}
|
||||
|
@@ -60,7 +60,7 @@ protected:
|
||||
void processLoginError(const std::string& error);
|
||||
void processLoginAdvice(const std::string& message);
|
||||
void processLoginWait(const std::string& message, int time);
|
||||
|
||||
void processLogin();
|
||||
void processPendingGame();
|
||||
void processEnterGame();
|
||||
|
||||
|
@@ -42,17 +42,17 @@ namespace Proto {
|
||||
|
||||
enum GameServerOpcodes : uint8
|
||||
{
|
||||
GameServerInitGame = 10,
|
||||
GameServerLoginOrPendingState = 10,
|
||||
GameServerGMActions = 11,
|
||||
GameServerEnterGame = 15,
|
||||
GameServerEnterGame = 15,
|
||||
GameServerUpdateNeeded = 17,
|
||||
GameServerLoginError = 20,
|
||||
GameServerLoginAdvice = 21,
|
||||
GameServerLoginWait = 22,
|
||||
GameServerAddCreature = 23,
|
||||
GameServerLoginSuccess = 23,
|
||||
GameServerPingBack = 29,
|
||||
GameServerPing = 30,
|
||||
GameServerChallange = 31,
|
||||
GameServerChallenge = 31,
|
||||
GameServerDeath = 40,
|
||||
|
||||
// all in game opcodes must be greater than 50
|
||||
|
@@ -46,7 +46,7 @@ void ProtocolGame::onConnect()
|
||||
if(g_game.getFeature(Otc::GameProtocolChecksum))
|
||||
enableChecksum();
|
||||
|
||||
if(!g_game.getFeature(Otc::GameChallangeOnLogin))
|
||||
if(!g_game.getFeature(Otc::GameChallengeOnLogin))
|
||||
sendLoginPacket(0, 0);
|
||||
|
||||
recv();
|
||||
|
@@ -35,7 +35,7 @@ public:
|
||||
void send(const OutputMessagePtr& outputMessage);
|
||||
|
||||
void sendExtendedOpcode(uint8 opcode, const std::string& buffer);
|
||||
void sendLoginPacket(uint challangeTimestamp, uint8 challangeRandom);
|
||||
void sendLoginPacket(uint challengeTimestamp, uint8 challengeRandom);
|
||||
void sendEnterGame();
|
||||
void sendLogout();
|
||||
void sendPing();
|
||||
@@ -123,7 +123,7 @@ private:
|
||||
void parseMessage(const InputMessagePtr& msg);
|
||||
void parsePendingGame(const InputMessagePtr& msg);
|
||||
void parseEnterGame(const InputMessagePtr& msg);
|
||||
void parseInitGame(const InputMessagePtr& msg);
|
||||
void parseLogin(const InputMessagePtr& msg);
|
||||
void parseGMActions(const InputMessagePtr& msg);
|
||||
void parseUpdateNeeded(const InputMessagePtr& msg);
|
||||
void parseLoginError(const InputMessagePtr& msg);
|
||||
@@ -131,7 +131,7 @@ private:
|
||||
void parseLoginWait(const InputMessagePtr& msg);
|
||||
void parsePing(const InputMessagePtr& msg);
|
||||
void parsePingBack(const InputMessagePtr& msg);
|
||||
void parseChallange(const InputMessagePtr& msg);
|
||||
void parseChallenge(const InputMessagePtr& msg);
|
||||
void parseDeath(const InputMessagePtr& msg);
|
||||
void parseMapDescription(const InputMessagePtr& msg);
|
||||
void parseMapMoveNorth(const InputMessagePtr& msg);
|
||||
|
@@ -58,16 +58,11 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg)
|
||||
msg->setReadPos(readPos); // restore read pos
|
||||
|
||||
switch(opcode) {
|
||||
case Proto::GameServerInitGame:
|
||||
case Proto::GameServerAddCreature:
|
||||
if(opcode == Proto::GameServerInitGame && g_game.getFeature(Otc::GameLoginPending))
|
||||
case Proto::GameServerLoginOrPendingState:
|
||||
if(g_game.getFeature(Otc::GameLoginPending))
|
||||
parsePendingGame(msg);
|
||||
else
|
||||
parseInitGame(msg);
|
||||
break;
|
||||
case Proto::GameServerEnterGame:
|
||||
if(g_game.getFeature(Otc::GameLoginPending))
|
||||
parseEnterGame(msg);
|
||||
parseLogin(msg);
|
||||
break;
|
||||
case Proto::GameServerGMActions:
|
||||
parseGMActions(msg);
|
||||
@@ -92,8 +87,8 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg)
|
||||
else
|
||||
parsePing(msg);
|
||||
break;
|
||||
case Proto::GameServerChallange:
|
||||
parseChallange(msg);
|
||||
case Proto::GameServerChallenge:
|
||||
parseChallenge(msg);
|
||||
break;
|
||||
case Proto::GameServerDeath:
|
||||
parseDeath(msg);
|
||||
@@ -321,6 +316,13 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg)
|
||||
case Proto::GameServerShowModalDialog:
|
||||
parseShowModalDialog(msg);
|
||||
break;
|
||||
// PROTOCOL>=980
|
||||
case Proto::GameServerLoginSuccess:
|
||||
parseLogin(msg);
|
||||
break;
|
||||
case Proto::GameServerEnterGame:
|
||||
parseEnterGame(msg);
|
||||
break;
|
||||
// otclient ONLY
|
||||
case Proto::GameServerExtendedOpcode:
|
||||
parseExtendedOpcode(msg);
|
||||
@@ -340,13 +342,12 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg)
|
||||
}
|
||||
}
|
||||
|
||||
void ProtocolGame::parseInitGame(const InputMessagePtr& msg)
|
||||
void ProtocolGame::parseLogin(const InputMessagePtr& msg)
|
||||
{
|
||||
uint playerId = msg->getU32();
|
||||
int serverBeat = msg->getU16();
|
||||
|
||||
if(g_game.getFeature(Otc::GameNewSpeedLaw))
|
||||
{
|
||||
if(g_game.getFeature(Otc::GameNewSpeedLaw)) {
|
||||
double speedA = msg->getDouble();
|
||||
double speedB = msg->getDouble();
|
||||
double speedC = msg->getDouble();
|
||||
@@ -357,6 +358,8 @@ void ProtocolGame::parseInitGame(const InputMessagePtr& msg)
|
||||
m_localPlayer->setId(playerId);
|
||||
g_game.setServerBeat(serverBeat);
|
||||
g_game.setCanReportBugs(canReportBugs);
|
||||
|
||||
g_game.processLogin();
|
||||
}
|
||||
|
||||
void ProtocolGame::parsePendingGame(const InputMessagePtr& msg)
|
||||
@@ -430,7 +433,7 @@ void ProtocolGame::parsePingBack(const InputMessagePtr& msg)
|
||||
g_game.processPingBack(m_pingTimer.elapsed_millis());
|
||||
}
|
||||
|
||||
void ProtocolGame::parseChallange(const InputMessagePtr& msg)
|
||||
void ProtocolGame::parseChallenge(const InputMessagePtr& msg)
|
||||
{
|
||||
uint timestamp = msg->getU32();
|
||||
uint8 random = msg->getU8();
|
||||
|
@@ -46,7 +46,7 @@ void ProtocolGame::sendExtendedOpcode(uint8 opcode, const std::string& buffer)
|
||||
}
|
||||
}
|
||||
|
||||
void ProtocolGame::sendLoginPacket(uint challangeTimestamp, uint8 challangeRandom)
|
||||
void ProtocolGame::sendLoginPacket(uint challengeTimestamp, uint8 challengeRandom)
|
||||
{
|
||||
OutputMessagePtr msg(new OutputMessage);
|
||||
|
||||
@@ -64,7 +64,7 @@ void ProtocolGame::sendLoginPacket(uint challangeTimestamp, uint8 challangeRando
|
||||
|
||||
msg->addU16(g_game.getProtocolVersion());
|
||||
|
||||
if(g_game.getProtocolVersion() >= 971) {
|
||||
if(g_game.getProtocolVersion() >= 970) {
|
||||
msg->addU32(g_game.getClientVersion());
|
||||
msg->addU8(0); // clientType
|
||||
}
|
||||
@@ -97,9 +97,9 @@ void ProtocolGame::sendLoginPacket(uint challangeTimestamp, uint8 challangeRando
|
||||
paddingBytes -= 8 + m_characterName.length() + m_accountPassword.length();
|
||||
}
|
||||
|
||||
if(g_game.getFeature(Otc::GameChallangeOnLogin)) {
|
||||
msg->addU32(challangeTimestamp);
|
||||
msg->addU8(challangeRandom);
|
||||
if(g_game.getFeature(Otc::GameChallengeOnLogin)) {
|
||||
msg->addU32(challengeTimestamp);
|
||||
msg->addU8(challengeRandom);
|
||||
paddingBytes -= 5;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user