Make otclient login into cipsoft servers again
This commit is contained in:
parent
ada2c9efe9
commit
7e52c4e449
|
@ -3,7 +3,7 @@ Module
|
||||||
description: Manage game shaders
|
description: Manage game shaders
|
||||||
author: edubart
|
author: edubart
|
||||||
website: www.otclient.info
|
website: www.otclient.info
|
||||||
scripts: [ shaders.lua ]
|
|
||||||
sandboxed: true
|
sandboxed: true
|
||||||
|
scripts: [ shaders.lua ]
|
||||||
@onLoad: init()
|
@onLoad: init()
|
||||||
@onUnload: terminate()
|
@onUnload: terminate()
|
||||||
|
|
|
@ -4,11 +4,8 @@ Module
|
||||||
author: baxnie, edubart
|
author: baxnie, edubart
|
||||||
website: www.otclient.info
|
website: www.otclient.info
|
||||||
sandboxed: true
|
sandboxed: true
|
||||||
scripts:
|
scripts: [ skills.lua ]
|
||||||
- skills.lua
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
- game_interface
|
|
||||||
|
|
||||||
@onLoad: init()
|
@onLoad: init()
|
||||||
@onUnload: terminate()
|
@onUnload: terminate()
|
||||||
|
dependencies:
|
||||||
|
- game_interface
|
||||||
|
|
|
@ -151,6 +151,7 @@ function onVipListLabelMousePress(widget, mousePos, mouseButton)
|
||||||
local vipList = vipWindow:getChildById('contentsPanel')
|
local vipList = vipWindow:getChildById('contentsPanel')
|
||||||
|
|
||||||
local menu = g_ui.createWidget('PopupMenu')
|
local menu = g_ui.createWidget('PopupMenu')
|
||||||
|
menu:addOption(tr('Send Message'), function() g_game.openPrivateChannel(widget:getText()) end)
|
||||||
menu:addOption(tr('Add new VIP'), function() createAddWindow() end)
|
menu:addOption(tr('Add new VIP'), function() createAddWindow() end)
|
||||||
menu:addOption(tr('Remove %s', widget:getText()), function() if widget then g_game.removeVip(widget:getId():sub(4)) vipList:removeChild(widget) end end)
|
menu:addOption(tr('Remove %s', widget:getText()), function() if widget then g_game.removeVip(widget:getId():sub(4)) vipList:removeChild(widget) end end)
|
||||||
menu:addSeparator()
|
menu:addSeparator()
|
||||||
|
|
|
@ -43,7 +43,7 @@ ChaseOpponent = 1
|
||||||
|
|
||||||
GameProtocolChecksum = 1
|
GameProtocolChecksum = 1
|
||||||
GameAccountNames = 2
|
GameAccountNames = 2
|
||||||
GameChallangeOnLogin = 3
|
GameChallengeOnLogin = 3
|
||||||
GamePenalityOnDeath = 4
|
GamePenalityOnDeath = 4
|
||||||
GameNameOnNpcTrade = 5
|
GameNameOnNpcTrade = 5
|
||||||
GameDoubleFreeCapacity = 6
|
GameDoubleFreeCapacity = 6
|
||||||
|
@ -65,8 +65,18 @@ GamePurseSlot = 21
|
||||||
GameFormatCreatureName = 22
|
GameFormatCreatureName = 22
|
||||||
GameSpellList = 23
|
GameSpellList = 23
|
||||||
GameClientPing = 24
|
GameClientPing = 24
|
||||||
GameLoginPending = 25
|
GameExtendedClientPing = 25
|
||||||
GameNewSpeedLaw = 26
|
GameUpdater = 26
|
||||||
|
GameLoginLocale = 27
|
||||||
|
GameDoubleHealth = 28
|
||||||
|
GameDoubleSkills = 29
|
||||||
|
GameChangeMapAwareRange = 30
|
||||||
|
GameMapMovePosition = 31
|
||||||
|
GameAttackSeq = 32
|
||||||
|
GameBlueNpcNameColor = 33
|
||||||
|
GameDiagonalAnimatedText = 34
|
||||||
|
GameLoginPending = 35
|
||||||
|
GameNewSpeedLaw = 36
|
||||||
|
|
||||||
TextColors = {
|
TextColors = {
|
||||||
red = '#f55e5e', --'#c83200'
|
red = '#f55e5e', --'#c83200'
|
||||||
|
|
|
@ -1,19 +1,21 @@
|
||||||
local currentRsa
|
local currentRsa
|
||||||
local enableCreatureNameFormat = true
|
|
||||||
|
|
||||||
function g_game.getRsa()
|
function g_game.getRsa()
|
||||||
return currentRsa
|
return currentRsa
|
||||||
end
|
end
|
||||||
|
|
||||||
function g_game.isCreatureNameFormatEnabled()
|
|
||||||
return enableCreatureNameFormat
|
|
||||||
end
|
|
||||||
|
|
||||||
function g_game.chooseRsa(host)
|
function g_game.chooseRsa(host)
|
||||||
if string.ends(host, '.tibia.com') or string.ends(host, '.cipsoft.com') then
|
if string.ends(host, '.tibia.com') or string.ends(host, '.cipsoft.com') then
|
||||||
g_game.setRsa(CIPSOFT_RSA)
|
g_game.setRsa(CIPSOFT_RSA)
|
||||||
|
|
||||||
|
if g_app.getOs() == 'windows' then
|
||||||
|
g_game.setCustomOs(OsTypes.Windows)
|
||||||
|
else
|
||||||
|
g_game.setCustomOs(OsTypes.Linux)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
g_game.setRsa(OTSERV_RSA)
|
g_game.setRsa(OTSERV_RSA)
|
||||||
|
g_game.setCustomOs(-1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -28,24 +30,6 @@ function g_game.isOfficialTibia()
|
||||||
return currentRsa == CIPSOFT_RSA
|
return currentRsa == CIPSOFT_RSA
|
||||||
end
|
end
|
||||||
|
|
||||||
function g_game.getOsType()
|
|
||||||
if g_game.isOfficialTibia() then
|
|
||||||
if g_app.getOs() == 'windows' then
|
|
||||||
return OsTypes.Windows
|
|
||||||
else
|
|
||||||
return OsTypes.Linux
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if g_app.getOs() == 'windows' then
|
|
||||||
return OsTypes.OtclientWindows
|
|
||||||
elseif g_app.getOs() == 'mac' then
|
|
||||||
return OsTypes.OtclientMac
|
|
||||||
else
|
|
||||||
return OsTypes.OtclientLinux
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function g_game.getSupportedProtocols()
|
function g_game.getSupportedProtocols()
|
||||||
return {
|
return {
|
||||||
810, 853, 854, 860, 861, 862, 870,
|
810, 853, 854, 860, 861, 862, 870,
|
||||||
|
|
|
@ -8,7 +8,7 @@ GameServerOpcodes = {
|
||||||
GameServerAddCreature = 23,
|
GameServerAddCreature = 23,
|
||||||
GameServerPingBack = 29,
|
GameServerPingBack = 29,
|
||||||
GameServerPing = 30,
|
GameServerPing = 30,
|
||||||
GameServerChallange = 31,
|
GameServerChallenge = 31,
|
||||||
GameServerDeath = 40,
|
GameServerDeath = 40,
|
||||||
|
|
||||||
-- all in game opcodes must be greater than 50
|
-- all in game opcodes must be greater than 50
|
||||||
|
|
|
@ -27,7 +27,7 @@ end
|
||||||
function ProtocolLogin:sendLoginPacket()
|
function ProtocolLogin:sendLoginPacket()
|
||||||
local msg = OutputMessage.create()
|
local msg = OutputMessage.create()
|
||||||
msg:addU8(ClientOpcodes.ClientEnterAccount)
|
msg:addU8(ClientOpcodes.ClientEnterAccount)
|
||||||
msg:addU16(g_game.getOsType())
|
msg:addU16(g_game.getOs())
|
||||||
msg:addU16(g_game.getProtocolVersion())
|
msg:addU16(g_game.getProtocolVersion())
|
||||||
|
|
||||||
if g_game.getProtocolVersion() >= 971 then
|
if g_game.getProtocolVersion() >= 971 then
|
||||||
|
|
|
@ -313,7 +313,7 @@ namespace Otc
|
||||||
// 1-50 defined in c++
|
// 1-50 defined in c++
|
||||||
GameProtocolChecksum = 1,
|
GameProtocolChecksum = 1,
|
||||||
GameAccountNames = 2,
|
GameAccountNames = 2,
|
||||||
GameChallangeOnLogin = 3,
|
GameChallengeOnLogin = 3,
|
||||||
GamePenalityOnDeath = 4,
|
GamePenalityOnDeath = 4,
|
||||||
GameNameOnNpcTrade = 5,
|
GameNameOnNpcTrade = 5,
|
||||||
GameDoubleFreeCapacity = 6,
|
GameDoubleFreeCapacity = 6,
|
||||||
|
|
|
@ -145,17 +145,21 @@ void Game::processLoginWait(const std::string& message, int time)
|
||||||
g_lua.callGlobalField("g_game", "onLoginWait", message, time);
|
g_lua.callGlobalField("g_game", "onLoginWait", message, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::processLogin()
|
||||||
|
{
|
||||||
|
g_lua.callGlobalField("g_game", "onLogin");
|
||||||
|
}
|
||||||
|
|
||||||
void Game::processPendingGame()
|
void Game::processPendingGame()
|
||||||
{
|
{
|
||||||
m_localPlayer->setPendingGame(true);
|
m_localPlayer->setPendingGame(true);
|
||||||
g_lua.callGlobalField("g_game", "onPendingGame");
|
g_lua.callGlobalField("g_game", "onPendingGame");
|
||||||
|
m_protocolGame->sendEnterGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::processEnterGame()
|
void Game::processEnterGame()
|
||||||
{
|
{
|
||||||
m_localPlayer->setPendingGame(false);
|
m_localPlayer->setPendingGame(false);
|
||||||
m_protocolGame->sendEnterGame();
|
|
||||||
|
|
||||||
g_lua.callGlobalField("g_game", "onEnterGame");
|
g_lua.callGlobalField("g_game", "onEnterGame");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1277,7 +1281,7 @@ void Game::setProtocolVersion(int version)
|
||||||
if(version >= 854) {
|
if(version >= 854) {
|
||||||
enableFeature(Otc::GameProtocolChecksum);
|
enableFeature(Otc::GameProtocolChecksum);
|
||||||
enableFeature(Otc::GameAccountNames);
|
enableFeature(Otc::GameAccountNames);
|
||||||
enableFeature(Otc::GameChallangeOnLogin);
|
enableFeature(Otc::GameChallengeOnLogin);
|
||||||
enableFeature(Otc::GameDoubleFreeCapacity);
|
enableFeature(Otc::GameDoubleFreeCapacity);
|
||||||
enableFeature(Otc::GameCreatureEmblems);
|
enableFeature(Otc::GameCreatureEmblems);
|
||||||
}
|
}
|
||||||
|
@ -1399,6 +1403,6 @@ int Game::getOs()
|
||||||
return 10;
|
return 10;
|
||||||
else if(g_app.getOs() == "mac")
|
else if(g_app.getOs() == "mac")
|
||||||
return 12;
|
return 12;
|
||||||
else
|
else // linux
|
||||||
return 10;
|
return 11;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ protected:
|
||||||
void processLoginError(const std::string& error);
|
void processLoginError(const std::string& error);
|
||||||
void processLoginAdvice(const std::string& message);
|
void processLoginAdvice(const std::string& message);
|
||||||
void processLoginWait(const std::string& message, int time);
|
void processLoginWait(const std::string& message, int time);
|
||||||
|
void processLogin();
|
||||||
void processPendingGame();
|
void processPendingGame();
|
||||||
void processEnterGame();
|
void processEnterGame();
|
||||||
|
|
||||||
|
|
|
@ -42,17 +42,17 @@ namespace Proto {
|
||||||
|
|
||||||
enum GameServerOpcodes : uint8
|
enum GameServerOpcodes : uint8
|
||||||
{
|
{
|
||||||
GameServerInitGame = 10,
|
GameServerLoginOrPendingState = 10,
|
||||||
GameServerGMActions = 11,
|
GameServerGMActions = 11,
|
||||||
GameServerEnterGame = 15,
|
GameServerEnterGame = 15,
|
||||||
GameServerUpdateNeeded = 17,
|
GameServerUpdateNeeded = 17,
|
||||||
GameServerLoginError = 20,
|
GameServerLoginError = 20,
|
||||||
GameServerLoginAdvice = 21,
|
GameServerLoginAdvice = 21,
|
||||||
GameServerLoginWait = 22,
|
GameServerLoginWait = 22,
|
||||||
GameServerAddCreature = 23,
|
GameServerLoginSuccess = 23,
|
||||||
GameServerPingBack = 29,
|
GameServerPingBack = 29,
|
||||||
GameServerPing = 30,
|
GameServerPing = 30,
|
||||||
GameServerChallange = 31,
|
GameServerChallenge = 31,
|
||||||
GameServerDeath = 40,
|
GameServerDeath = 40,
|
||||||
|
|
||||||
// all in game opcodes must be greater than 50
|
// all in game opcodes must be greater than 50
|
||||||
|
|
|
@ -46,7 +46,7 @@ void ProtocolGame::onConnect()
|
||||||
if(g_game.getFeature(Otc::GameProtocolChecksum))
|
if(g_game.getFeature(Otc::GameProtocolChecksum))
|
||||||
enableChecksum();
|
enableChecksum();
|
||||||
|
|
||||||
if(!g_game.getFeature(Otc::GameChallangeOnLogin))
|
if(!g_game.getFeature(Otc::GameChallengeOnLogin))
|
||||||
sendLoginPacket(0, 0);
|
sendLoginPacket(0, 0);
|
||||||
|
|
||||||
recv();
|
recv();
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
void send(const OutputMessagePtr& outputMessage);
|
void send(const OutputMessagePtr& outputMessage);
|
||||||
|
|
||||||
void sendExtendedOpcode(uint8 opcode, const std::string& buffer);
|
void sendExtendedOpcode(uint8 opcode, const std::string& buffer);
|
||||||
void sendLoginPacket(uint challangeTimestamp, uint8 challangeRandom);
|
void sendLoginPacket(uint challengeTimestamp, uint8 challengeRandom);
|
||||||
void sendEnterGame();
|
void sendEnterGame();
|
||||||
void sendLogout();
|
void sendLogout();
|
||||||
void sendPing();
|
void sendPing();
|
||||||
|
@ -123,7 +123,7 @@ private:
|
||||||
void parseMessage(const InputMessagePtr& msg);
|
void parseMessage(const InputMessagePtr& msg);
|
||||||
void parsePendingGame(const InputMessagePtr& msg);
|
void parsePendingGame(const InputMessagePtr& msg);
|
||||||
void parseEnterGame(const InputMessagePtr& msg);
|
void parseEnterGame(const InputMessagePtr& msg);
|
||||||
void parseInitGame(const InputMessagePtr& msg);
|
void parseLogin(const InputMessagePtr& msg);
|
||||||
void parseGMActions(const InputMessagePtr& msg);
|
void parseGMActions(const InputMessagePtr& msg);
|
||||||
void parseUpdateNeeded(const InputMessagePtr& msg);
|
void parseUpdateNeeded(const InputMessagePtr& msg);
|
||||||
void parseLoginError(const InputMessagePtr& msg);
|
void parseLoginError(const InputMessagePtr& msg);
|
||||||
|
@ -131,7 +131,7 @@ private:
|
||||||
void parseLoginWait(const InputMessagePtr& msg);
|
void parseLoginWait(const InputMessagePtr& msg);
|
||||||
void parsePing(const InputMessagePtr& msg);
|
void parsePing(const InputMessagePtr& msg);
|
||||||
void parsePingBack(const InputMessagePtr& msg);
|
void parsePingBack(const InputMessagePtr& msg);
|
||||||
void parseChallange(const InputMessagePtr& msg);
|
void parseChallenge(const InputMessagePtr& msg);
|
||||||
void parseDeath(const InputMessagePtr& msg);
|
void parseDeath(const InputMessagePtr& msg);
|
||||||
void parseMapDescription(const InputMessagePtr& msg);
|
void parseMapDescription(const InputMessagePtr& msg);
|
||||||
void parseMapMoveNorth(const InputMessagePtr& msg);
|
void parseMapMoveNorth(const InputMessagePtr& msg);
|
||||||
|
|
|
@ -58,16 +58,11 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg)
|
||||||
msg->setReadPos(readPos); // restore read pos
|
msg->setReadPos(readPos); // restore read pos
|
||||||
|
|
||||||
switch(opcode) {
|
switch(opcode) {
|
||||||
case Proto::GameServerInitGame:
|
case Proto::GameServerLoginOrPendingState:
|
||||||
case Proto::GameServerAddCreature:
|
if(g_game.getFeature(Otc::GameLoginPending))
|
||||||
if(opcode == Proto::GameServerInitGame && g_game.getFeature(Otc::GameLoginPending))
|
|
||||||
parsePendingGame(msg);
|
parsePendingGame(msg);
|
||||||
else
|
else
|
||||||
parseInitGame(msg);
|
parseLogin(msg);
|
||||||
break;
|
|
||||||
case Proto::GameServerEnterGame:
|
|
||||||
if(g_game.getFeature(Otc::GameLoginPending))
|
|
||||||
parseEnterGame(msg);
|
|
||||||
break;
|
break;
|
||||||
case Proto::GameServerGMActions:
|
case Proto::GameServerGMActions:
|
||||||
parseGMActions(msg);
|
parseGMActions(msg);
|
||||||
|
@ -92,8 +87,8 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg)
|
||||||
else
|
else
|
||||||
parsePing(msg);
|
parsePing(msg);
|
||||||
break;
|
break;
|
||||||
case Proto::GameServerChallange:
|
case Proto::GameServerChallenge:
|
||||||
parseChallange(msg);
|
parseChallenge(msg);
|
||||||
break;
|
break;
|
||||||
case Proto::GameServerDeath:
|
case Proto::GameServerDeath:
|
||||||
parseDeath(msg);
|
parseDeath(msg);
|
||||||
|
@ -321,6 +316,13 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg)
|
||||||
case Proto::GameServerShowModalDialog:
|
case Proto::GameServerShowModalDialog:
|
||||||
parseShowModalDialog(msg);
|
parseShowModalDialog(msg);
|
||||||
break;
|
break;
|
||||||
|
// PROTOCOL>=980
|
||||||
|
case Proto::GameServerLoginSuccess:
|
||||||
|
parseLogin(msg);
|
||||||
|
break;
|
||||||
|
case Proto::GameServerEnterGame:
|
||||||
|
parseEnterGame(msg);
|
||||||
|
break;
|
||||||
// otclient ONLY
|
// otclient ONLY
|
||||||
case Proto::GameServerExtendedOpcode:
|
case Proto::GameServerExtendedOpcode:
|
||||||
parseExtendedOpcode(msg);
|
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();
|
uint playerId = msg->getU32();
|
||||||
int serverBeat = msg->getU16();
|
int serverBeat = msg->getU16();
|
||||||
|
|
||||||
if(g_game.getFeature(Otc::GameNewSpeedLaw))
|
if(g_game.getFeature(Otc::GameNewSpeedLaw)) {
|
||||||
{
|
|
||||||
double speedA = msg->getDouble();
|
double speedA = msg->getDouble();
|
||||||
double speedB = msg->getDouble();
|
double speedB = msg->getDouble();
|
||||||
double speedC = msg->getDouble();
|
double speedC = msg->getDouble();
|
||||||
|
@ -357,6 +358,8 @@ void ProtocolGame::parseInitGame(const InputMessagePtr& msg)
|
||||||
m_localPlayer->setId(playerId);
|
m_localPlayer->setId(playerId);
|
||||||
g_game.setServerBeat(serverBeat);
|
g_game.setServerBeat(serverBeat);
|
||||||
g_game.setCanReportBugs(canReportBugs);
|
g_game.setCanReportBugs(canReportBugs);
|
||||||
|
|
||||||
|
g_game.processLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parsePendingGame(const InputMessagePtr& msg)
|
void ProtocolGame::parsePendingGame(const InputMessagePtr& msg)
|
||||||
|
@ -430,7 +433,7 @@ void ProtocolGame::parsePingBack(const InputMessagePtr& msg)
|
||||||
g_game.processPingBack(m_pingTimer.elapsed_millis());
|
g_game.processPingBack(m_pingTimer.elapsed_millis());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parseChallange(const InputMessagePtr& msg)
|
void ProtocolGame::parseChallenge(const InputMessagePtr& msg)
|
||||||
{
|
{
|
||||||
uint timestamp = msg->getU32();
|
uint timestamp = msg->getU32();
|
||||||
uint8 random = msg->getU8();
|
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);
|
OutputMessagePtr msg(new OutputMessage);
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ void ProtocolGame::sendLoginPacket(uint challangeTimestamp, uint8 challangeRando
|
||||||
|
|
||||||
msg->addU16(g_game.getProtocolVersion());
|
msg->addU16(g_game.getProtocolVersion());
|
||||||
|
|
||||||
if(g_game.getProtocolVersion() >= 971) {
|
if(g_game.getProtocolVersion() >= 970) {
|
||||||
msg->addU32(g_game.getClientVersion());
|
msg->addU32(g_game.getClientVersion());
|
||||||
msg->addU8(0); // clientType
|
msg->addU8(0); // clientType
|
||||||
}
|
}
|
||||||
|
@ -97,9 +97,9 @@ void ProtocolGame::sendLoginPacket(uint challangeTimestamp, uint8 challangeRando
|
||||||
paddingBytes -= 8 + m_characterName.length() + m_accountPassword.length();
|
paddingBytes -= 8 + m_characterName.length() + m_accountPassword.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(g_game.getFeature(Otc::GameChallangeOnLogin)) {
|
if(g_game.getFeature(Otc::GameChallengeOnLogin)) {
|
||||||
msg->addU32(challangeTimestamp);
|
msg->addU32(challengeTimestamp);
|
||||||
msg->addU8(challangeRandom);
|
msg->addU8(challengeRandom);
|
||||||
paddingBytes -= 5;
|
paddingBytes -= 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue