10.96, 10.97, 10.98, 10.99 support

Adds basic support for the latest client version
This commit is contained in:
Joseph Bingham 2016-11-07 23:52:42 -05:00
parent a6a50fa162
commit 344146ba2d
6 changed files with 65 additions and 12 deletions

View File

@ -75,7 +75,8 @@ function g_game.getSupportedClients()
1063, 1064, 1070, 1071, 1072, 1063, 1064, 1070, 1071, 1072,
1073, 1074, 1075, 1076, 1080, 1073, 1074, 1075, 1076, 1080,
1081, 1082, 1090, 1091, 1092, 1081, 1082, 1090, 1091, 1092,
1093, 1094, 1095 1093, 1094, 1095, 1096, 1097,
1098, 1099
} }
end end

View File

@ -1492,7 +1492,7 @@ void Game::setProtocolVersion(int version)
if(isOnline()) if(isOnline())
stdext::throw_exception("Unable to change protocol version while online"); stdext::throw_exception("Unable to change protocol version while online");
if(version != 0 && (version < 740 || version > 1095)) if(version != 0 && (version < 740 || version > 1099))
stdext::throw_exception(stdext::format("Protocol version %d not supported", version)); stdext::throw_exception(stdext::format("Protocol version %d not supported", version));
m_protocolVersion = version; m_protocolVersion = version;
@ -1510,7 +1510,7 @@ void Game::setClientVersion(int version)
if(isOnline()) if(isOnline())
stdext::throw_exception("Unable to change client version while online"); stdext::throw_exception("Unable to change client version while online");
if(version != 0 && (version < 740 || version > 1095)) if(version != 0 && (version < 740 || version > 1099))
stdext::throw_exception(stdext::format("Client version %d not supported", version)); stdext::throw_exception(stdext::format("Client version %d not supported", version));
m_features.reset(); m_features.reset();

View File

@ -51,6 +51,7 @@ namespace Proto {
GameServerLoginWait = 22, GameServerLoginWait = 22,
GameServerLoginSuccess = 23, GameServerLoginSuccess = 23,
GameServerLoginToken = 24, GameServerLoginToken = 24,
GameServerStoreButtonIndicators = 25, // 1097
GameServerPingBack = 29, GameServerPingBack = 29,
GameServerPing = 30, GameServerPing = 30,
GameServerChallenge = 31, GameServerChallenge = 31,
@ -120,6 +121,7 @@ namespace Proto {
GameServerSpellDelay = 164, // 870 GameServerSpellDelay = 164, // 870
GameServerSpellGroupDelay = 165, // 870 GameServerSpellGroupDelay = 165, // 870
GameServerMultiUseDelay = 166, // 870 GameServerMultiUseDelay = 166, // 870
GameServerSetStoreDeepLink = 168, // 1097
GameServerTalk = 170, GameServerTalk = 170,
GameServerChannels = 171, GameServerChannels = 171,
GameServerOpenChannel = 172, GameServerOpenChannel = 172,

View File

@ -134,6 +134,8 @@ public:
void addPosition(const OutputMessagePtr& msg, const Position& position); void addPosition(const OutputMessagePtr& msg, const Position& position);
private: private:
void parseStoreButtonIndicators(const InputMessagePtr& msg);
void parseSetStoreDeepLink(const InputMessagePtr& msg);
void parseStore(const InputMessagePtr& msg); void parseStore(const InputMessagePtr& msg);
void parseStoreError(const InputMessagePtr& msg); void parseStoreError(const InputMessagePtr& msg);
void parseStoreTransactionHistory(const InputMessagePtr& msg); void parseStoreTransactionHistory(const InputMessagePtr& msg);

View File

@ -381,6 +381,11 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg)
case Proto::GameServerStore: case Proto::GameServerStore:
parseStore(msg); parseStore(msg);
break; break;
// PROTOCOL>=1097
case Proto::GameServerStoreButtonIndicators:
break;
case Proto::GameServerSetStoreDeepLink:
break;
// otclient ONLY // otclient ONLY
case Proto::GameServerExtendedOpcode: case Proto::GameServerExtendedOpcode:
parseExtendedOpcode(msg); parseExtendedOpcode(msg);
@ -454,6 +459,17 @@ void ProtocolGame::parseEnterGame(const InputMessagePtr& msg)
} }
} }
void ProtocolGame::parseStoreButtonIndicators(const InputMessagePtr& msg)
{
msg->getU8(); // unknown
msg->getU8(); // unknown
}
void ProtocolGame::parseSetStoreDeepLink(const InputMessagePtr& msg)
{
int currentlyFeaturedServiceType = msg->getU8();
}
void ProtocolGame::parseBlessings(const InputMessagePtr& msg) void ProtocolGame::parseBlessings(const InputMessagePtr& msg)
{ {
uint16 blessings = msg->getU16(); uint16 blessings = msg->getU16();
@ -462,7 +478,7 @@ void ProtocolGame::parseBlessings(const InputMessagePtr& msg)
void ProtocolGame::parsePreset(const InputMessagePtr& msg) void ProtocolGame::parsePreset(const InputMessagePtr& msg)
{ {
uint16 preset = msg->getU32(); uint32 preset = msg->getU32();
} }
void ProtocolGame::parseRequestPurchaseData(const InputMessagePtr& msg) void ProtocolGame::parseRequestPurchaseData(const InputMessagePtr& msg)
@ -534,8 +550,14 @@ void ProtocolGame::parseCompleteStorePurchase(const InputMessagePtr& msg)
void ProtocolGame::parseStoreTransactionHistory(const InputMessagePtr &msg) void ProtocolGame::parseStoreTransactionHistory(const InputMessagePtr &msg)
{ {
int currentPage = msg->getU16(); int currentPage;
if (g_game.getClientVersion() <= 1096) {
currentPage = msg->getU16();
bool hasNextPage = msg->getU8() == 1; bool hasNextPage = msg->getU8() == 1;
} else {
currentPage = msg->getU32();
int pageCount = msg->getU32();
}
int entries = msg->getU8(); int entries = msg->getU8();
for(int i = 0; i < entries; i++) { for(int i = 0; i < entries; i++) {
@ -559,6 +581,11 @@ void ProtocolGame::parseStoreOffers(const InputMessagePtr& msg)
int price = msg->getU32(); int price = msg->getU32();
int highlightState = msg->getU8(); int highlightState = msg->getU8();
if (highlightState == 2 && g_game.getFeature(Otc::GameIngameStoreHighlights) && g_game.getClientVersion() >= 1097) {
int saleValidUntilTimestamp = msg->getU32();
int basePrice = msg->getU32();
}
int disabledState = msg->getU8(); int disabledState = msg->getU8();
std::string disabledReason = ""; std::string disabledReason = "";
if(g_game.getFeature(Otc::GameIngameStoreHighlights) && disabledState == 1) { if(g_game.getFeature(Otc::GameIngameStoreHighlights) && disabledState == 1) {
@ -1267,8 +1294,11 @@ void ProtocolGame::parsePremiumTrigger(const InputMessagePtr& msg)
for(int i=0;i<triggerCount;++i) { for(int i=0;i<triggerCount;++i) {
triggers.push_back(msg->getU8()); triggers.push_back(msg->getU8());
} }
if (g_game.getClientVersion() <= 1096) {
bool something = msg->getU8() == 1; bool something = msg->getU8() == 1;
} }
}
void ProtocolGame::parsePlayerInfo(const InputMessagePtr& msg) void ProtocolGame::parsePlayerInfo(const InputMessagePtr& msg)
{ {
@ -1320,7 +1350,15 @@ void ProtocolGame::parsePlayerStats(const InputMessagePtr& msg)
double levelPercent = msg->getU8(); double levelPercent = msg->getU8();
if(g_game.getFeature(Otc::GameExperienceBonus)) if(g_game.getFeature(Otc::GameExperienceBonus))
if (g_game.getClientVersion() <= 1096) {
double experienceBonus = msg->getDouble(); double experienceBonus = msg->getDouble();
} else {
int baseXpGain = msg->getU16();
int voucherAddend = msg->getU16();
int grindingAddend = msg->getU16();
int storeBoostAddend = msg->getU16();
int huntingBoostFactor = msg->getU16();
}
double mana; double mana;
double maxMana; double maxMana;
@ -1356,8 +1394,13 @@ void ProtocolGame::parsePlayerStats(const InputMessagePtr& msg)
regeneration = msg->getU16(); regeneration = msg->getU16();
double training = 0; double training = 0;
if(g_game.getFeature(Otc::GameOfflineTrainingTime)) if (g_game.getFeature(Otc::GameOfflineTrainingTime)) {
training = msg->getU16(); training = msg->getU16();
if (g_game.getClientVersion() >= 1097) {
int remainingStoreXpBoostSeconds = msg->getU16();
bool canBuyMoreStoreXpBoosts = msg->getU8();
}
}
m_localPlayer->setHealth(health, maxHealth); m_localPlayer->setHealth(health, maxHealth);
m_localPlayer->setFreeCapacity(freeCapacity); m_localPlayer->setFreeCapacity(freeCapacity);

View File

@ -880,8 +880,13 @@ void ProtocolGame::sendRequestTransactionHistory(int page, int entriesPerPage)
{ {
OutputMessagePtr msg(new OutputMessage); OutputMessagePtr msg(new OutputMessage);
msg->addU8(Proto::ClientRequestTransactionHistory); msg->addU8(Proto::ClientRequestTransactionHistory);
if (g_game.getClientVersion() <= 1096) {
msg->addU16(page); msg->addU16(page);
msg->addU32(entriesPerPage); msg->addU32(entriesPerPage);
} else {
msg->addU32(page);
msg->addU8(entriesPerPage);
}
send(msg); send(msg);
} }