some protocol 870 support

This commit is contained in:
Eduardo Bart 2012-03-18 17:59:00 -03:00
parent c0611bfe2a
commit 4bac617fd9
5 changed files with 59 additions and 17 deletions

2
BUGS
View File

@ -5,3 +5,5 @@ some animated hits are displayed as 2 hits instead of one
skulls is rendering outside map bounds skulls is rendering outside map bounds
paste on x11 platform does not work correctly when doing ctrl+c in google chrome paste on x11 platform does not work correctly when doing ctrl+c in google chrome
party options does not work when relogging inside a party party options does not work when relogging inside a party
when the player gets disconnected it isn't removed from the map

View File

@ -55,13 +55,13 @@ end
function onGameLoginError(message) function onGameLoginError(message)
CharacterList.destroyLoadBox() CharacterList.destroyLoadBox()
local errorBox = displayErrorBox("Login Error", "Login error: " .. message) local errorBox = displayErrorBox("Login Error", "Login error: " .. message)
errorBox.onOk = CharacterList.show errorBox.onOk = CharacterList.showAgain
end end
function onGameConnectionError(message) function onGameConnectionError(message)
CharacterList.destroyLoadBox() CharacterList.destroyLoadBox()
local errorBox = displayErrorBox("Login Error", "Connection error: " .. message) local errorBox = displayErrorBox("Login Error", "Connection error: " .. message)
errorBox.onOk = CharacterList.show errorBox.onOk = CharacterList.showAgain
end end
-- public functions -- public functions
@ -73,14 +73,14 @@ function CharacterList.init()
connect(g_game, { onLoginError = onGameLoginError }) connect(g_game, { onLoginError = onGameLoginError })
connect(g_game, { onConnectionError = onGameConnectionError }) connect(g_game, { onConnectionError = onGameConnectionError })
connect(g_game, { onGameStart = CharacterList.destroyLoadBox }) connect(g_game, { onGameStart = CharacterList.destroyLoadBox })
connect(g_game, { onGameEnd = CharacterList.show }) connect(g_game, { onGameEnd = CharacterList.showAgain })
end end
function CharacterList.terminate() function CharacterList.terminate()
disconnect(g_game, { onLoginError = onGameLoginError }) disconnect(g_game, { onLoginError = onGameLoginError })
disconnect(g_game, { onConnectionError = onGameConnectionError }) disconnect(g_game, { onConnectionError = onGameConnectionError })
disconnect(g_game, { onGameStart = CharacterList.destroyLoadBox }) disconnect(g_game, { onGameStart = CharacterList.destroyLoadBox })
disconnect(g_game, { onGameEnd = CharacterList.show }) disconnect(g_game, { onGameEnd = CharacterList.showAgain })
characterList = nil characterList = nil
charactersWindow:destroy() charactersWindow:destroy()
charactersWindow = nil charactersWindow = nil
@ -144,6 +144,12 @@ function CharacterList.show()
end end
end end
function CharacterList.showAgain()
if characterList:hasChildren() then
CharacterList.show()
end
end
function CharacterList.isVisible() function CharacterList.isVisible()
if charactersWindow and charactersWindow:isVisible() then if charactersWindow and charactersWindow:isVisible() then
return true return true

View File

@ -142,7 +142,6 @@ void Game::processDeath(int penality)
void Game::processPing() void Game::processPing()
{ {
m_protocolGame->sendPingResponse();
g_lua.callGlobalField("g_game", "onPing"); g_lua.callGlobalField("g_game", "onPing");
} }
@ -315,6 +314,10 @@ void Game::processWalkCancel(Otc::Direction direction)
void Game::loginWorld(const std::string& account, const std::string& password, const std::string& worldHost, int worldPort, const std::string& characterName) void Game::loginWorld(const std::string& account, const std::string& password, const std::string& worldHost, int worldPort, const std::string& characterName)
{ {
if(m_protocolGame || isOnline()) {
logTraceError("unable to login into a world while already online or logging");
return;
}
m_protocolGame = ProtocolGamePtr(new ProtocolGame); m_protocolGame = ProtocolGamePtr(new ProtocolGame);
m_protocolGame->login(account, password, worldHost, (uint16)worldPort, characterName); m_protocolGame->login(account, password, worldHost, (uint16)worldPort, characterName);
} }
@ -333,7 +336,7 @@ void Game::forceLogout()
if(!isOnline()) if(!isOnline())
return; return;
m_protocolGame->sendLogout(); //m_protocolGame->sendLogout();
processDisconnect(); processDisconnect();
} }

View File

@ -25,7 +25,7 @@
#include <otclient/global.h> #include <otclient/global.h>
#if PROTOCOL < 860 || PROTOCOL > 862 #if PROTOCOL != 860 && PROTOCOL != 870 && PROTOCOL != 862 && PROTOCOL != 870
#error "the supplied protocol version is not supported" #error "the supplied protocol version is not supported"
#endif #endif
@ -47,10 +47,10 @@ namespace Proto {
constexpr int ClientVersion = PROTOCOL; constexpr int ClientVersion = PROTOCOL;
constexpr int PicSignature = 0x4E119CBF; constexpr int PicSignature = 0x4E119CBF;
#if PROTOCOL==860 #if PROTOCOL>=861
constexpr int NumViolationReasons = 20;
#elif PROTOCOL==861 || PROTOCOL==862
constexpr int NumViolationReasons = 19; constexpr int NumViolationReasons = 19;
#elif PROTOCOL==860
constexpr int NumViolationReasons = 20;
#endif #endif
enum OsTypes { enum OsTypes {
@ -118,8 +118,10 @@ namespace Proto {
GameServerPlayerSkills = 161, GameServerPlayerSkills = 161,
GameServerPlayerState = 162, GameServerPlayerState = 162,
GameServerClearTarget = 163, GameServerClearTarget = 163,
#if PROTOCOL>=870
GameServerSpellDelay = 164, GameServerSpellDelay = 164,
GameServerSpellGroupDelay = 165, GameServerSpellGroupDelay = 165,
#endif
GameServerTalk = 170, GameServerTalk = 170,
GameServerChannels = 171, GameServerChannels = 171,
GameServerOpenChannel = 172, GameServerOpenChannel = 172,
@ -209,7 +211,9 @@ namespace Proto {
ClientRefreshContainer = 202, ClientRefreshContainer = 202,
ClientRequestOutfit = 210, ClientRequestOutfit = 210,
ClientChangeOutfit = 211, ClientChangeOutfit = 211,
//ClientMount = 212, #if PROTOCOL>=870
ClientMount = 212,
#endif
ClientAddVip = 220, ClientAddVip = 220,
ClientRemoveVip = 221, ClientRemoveVip = 221,
//ClientBugReport = 230, //ClientBugReport = 230,
@ -221,7 +225,7 @@ namespace Proto {
}; };
enum ServerSpeakType { enum ServerSpeakType {
#if PROTOCOL==861 || PROTOCOL==862 #if PROTOCOL>=861
ServerSpeakSay = 1, ServerSpeakSay = 1,
ServerSpeakWhisper, ServerSpeakWhisper,
ServerSpeakYell, ServerSpeakYell,
@ -265,7 +269,7 @@ namespace Proto {
}; };
enum MessageTypes { enum MessageTypes {
#if PROTOCOL==862 || PROTOCOL==861 #if PROTOCOL>=862
MessageConsoleOrange = 13, MessageConsoleOrange = 13,
MessageConsoleOrange2, MessageConsoleOrange2,
MessageWarning, MessageWarning,

View File

@ -165,7 +165,12 @@ void ProtocolGame::parseMessage(InputMessage& msg)
case Proto::GameServerCreatureParty: case Proto::GameServerCreatureParty:
parseCreatureShields(msg); parseCreatureShields(msg);
break; break;
// case Proto::GameServerCreatureUnpass #if PROTOCOL>=870
case Proto::GameServerCreatureUnpass:
msg.getU32(); // creature id
msg.getU8(); // unpassable boolean
break;
#endif
case Proto::GameServerEditText: case Proto::GameServerEditText:
parseEditText(msg); parseEditText(msg);
break; break;
@ -184,8 +189,14 @@ void ProtocolGame::parseMessage(InputMessage& msg)
case Proto::GameServerClearTarget: case Proto::GameServerClearTarget:
parsePlayerCancelAttack(msg); parsePlayerCancelAttack(msg);
break; break;
//case Proto::GameServerSpellDelay: #if PROTOCOL>=870
//case Proto::GameServerSpellGroupDelay: case Proto::GameServerSpellDelay:
case Proto::GameServerSpellGroupDelay:
msg.getU16(); // spell id
msg.getU16(); // cooldown
msg.getU8(); // unknown
break;
#endif
case Proto::GameServerTalk: case Proto::GameServerTalk:
parseCreatureSpeak(msg); parseCreatureSpeak(msg);
break; break;
@ -309,12 +320,13 @@ void ProtocolGame::parseLoginWait(InputMessage& msg)
void ProtocolGame::parsePing(InputMessage&) void ProtocolGame::parsePing(InputMessage&)
{ {
g_game.processPing(); g_game.processPing();
sendPingResponse();
} }
void ProtocolGame::parseDeath(InputMessage& msg) void ProtocolGame::parseDeath(InputMessage& msg)
{ {
int penality = 100; int penality = 100;
#if PROTOCOL==862 #if PROTOCOL>=862
penality = msg.getU8(); penality = msg.getU8();
#endif #endif
g_game.processDeath(penality); g_game.processDeath(penality);
@ -721,7 +733,11 @@ void ProtocolGame::parsePlayerStats(InputMessage& msg)
double health = msg.getU16(); double health = msg.getU16();
double maxHealth = msg.getU16(); double maxHealth = msg.getU16();
double freeCapacity = msg.getU32() / 100.0; double freeCapacity = msg.getU32() / 100.0;
#if PROTOCOL >= 870
double experience = msg.getU64();
#else
double experience = msg.getU32(); double experience = msg.getU32();
#endif
double level = msg.getU16(); double level = msg.getU16();
double levelPercent = msg.getU8(); double levelPercent = msg.getU8();
double mana = msg.getU16(); double mana = msg.getU16();
@ -917,6 +933,14 @@ void ProtocolGame::parseOpenOutfitWindow(InputMessage& msg)
outfitList.push_back(std::make_tuple(outfitId, outfitName, outfitAddons)); outfitList.push_back(std::make_tuple(outfitId, outfitName, outfitAddons));
} }
#if PROTOCOL>=870
int mountCount = msg.getU8();
for(int i=0;i<mountCount;++i) {
msg.getU16(); // mount type
msg.getString(); // mount name
}
#endif
g_game.processOpenOutfitWindow(currentOutfit, outfitList); g_game.processOpenOutfitWindow(currentOutfit, outfitList);
} }
@ -1062,6 +1086,9 @@ Outfit ProtocolGame::internalGetOutfit(InputMessage& msg)
int legs = msg.getU8(); int legs = msg.getU8();
int feet = msg.getU8(); int feet = msg.getU8();
int addons = msg.getU8(); int addons = msg.getU8();
#if PROTOCOL>=870
msg.getU16(); // mount
#endif
outfit.setId(id); outfit.setId(id);
outfit.setHead(head); outfit.setHead(head);