diff --git a/modules/gamelib/game.lua b/modules/gamelib/game.lua index ccce4b33..09d0cee9 100644 --- a/modules/gamelib/game.lua +++ b/modules/gamelib/game.lua @@ -74,7 +74,8 @@ function g_game.getSupportedClients() 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1080, - 1081, 1082, 1090, 1091 + 1081, 1082, 1090, 1091, 1092, + 1093 } end diff --git a/src/client/const.h b/src/client/const.h index 775a8e4b..adcc67ba 100644 --- a/src/client/const.h +++ b/src/client/const.h @@ -406,6 +406,8 @@ namespace Otc GameIdleAnimations = 71, GameKeepUnawareTiles = 72, GameIngameStore = 73, + GameIngameStoreHighlights = 74, + GameIngameStoreServiceType = 75, LastGameFeature = 101 }; diff --git a/src/client/game.cpp b/src/client/game.cpp index 201d4dcf..2f8755f2 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1409,18 +1409,18 @@ void Game::requestTransactionHistory(int page, int entriesPerPage) m_protocolGame->sendRequestTransactionHistory(page, entriesPerPage); } -void Game::requestStoreOffers(const std::string& categoryName) +void Game::requestStoreOffers(const std::string& categoryName, int serviceType) { if(!canPerformGameAction()) return; - m_protocolGame->sendRequestStoreOffers(categoryName); + m_protocolGame->sendRequestStoreOffers(categoryName, serviceType); } -void Game::openStore() +void Game::openStore(int serviceType, const std::string& category) { if(!canPerformGameAction()) return; - m_protocolGame->sendOpenStore(); + m_protocolGame->sendOpenStore(serviceType, category); } void Game::transferCoins(const std::string& recipient, int amount) @@ -1492,7 +1492,7 @@ void Game::setProtocolVersion(int version) if(isOnline()) stdext::throw_exception("Unable to change protocol version while online"); - if(version != 0 && (version < 740 || version > 1091)) + if(version != 0 && (version < 740 || version > 1093)) stdext::throw_exception(stdext::format("Protocol version %d not supported", version)); m_protocolVersion = version; @@ -1510,7 +1510,7 @@ void Game::setClientVersion(int version) if(isOnline()) stdext::throw_exception("Unable to change client version while online"); - if(version != 0 && (version < 740 || version > 1091)) + if(version != 0 && (version < 740 || version > 1093)) stdext::throw_exception(stdext::format("Client version %d not supported", version)); m_features.reset(); @@ -1666,6 +1666,15 @@ void Game::setClientVersion(int version) enableFeature(Otc::GameIngameStore); } + if(version >= 1092) { + enableFeature(Otc::GameIngameStoreServiceType); + } + + if(version >= 1093) { + enableFeature(Otc::GameIngameStoreHighlights); + } + + m_clientVersion = version; g_lua.callGlobalField("g_game", "onClientVersionChange", version); diff --git a/src/client/game.h b/src/client/game.h index ec10317f..a34edecc 100644 --- a/src/client/game.h +++ b/src/client/game.h @@ -291,8 +291,8 @@ public: // >= 1080 ingame store void buyStoreOffer(int offerId, int productType, const std::string& name = ""); void requestTransactionHistory(int page, int entriesPerPage); - void requestStoreOffers(const std::string& categoryName); - void openStore(); + void requestStoreOffers(const std::string& categoryName, int serviceType = 0); + void openStore(int serviceType = 0, const std::string& category = ""); void transferCoins(const std::string& recipient, int amount); void openTransactionHistory(int entriesPerPage); diff --git a/src/client/protocolgame.h b/src/client/protocolgame.h index da34caee..80089361 100644 --- a/src/client/protocolgame.h +++ b/src/client/protocolgame.h @@ -115,8 +115,8 @@ public: void sendSeekInContainer(int cid, int index); void sendBuyStoreOffer(int offerId, int productType, const std::string& name); void sendRequestTransactionHistory(int page, int entriesPerPage); - void sendRequestStoreOffers(const std::string& categoryName); - void sendOpenStore(); + void sendRequestStoreOffers(const std::string& categoryName, int serviceType); + void sendOpenStore(int serviceType, const std::string &category); void sendTransferCoins(const std::string& recipient, int amount); void sendOpenTransactionHistory(int entiresPerPage); diff --git a/src/client/protocolgameparse.cpp b/src/client/protocolgameparse.cpp index 1dfb775a..6f1cade0 100644 --- a/src/client/protocolgameparse.cpp +++ b/src/client/protocolgameparse.cpp @@ -481,6 +481,10 @@ void ProtocolGame::parseStore(const InputMessagePtr& msg) std::string category = msg->getString(); std::string description = msg->getString(); + int highlightState = 0; + if(g_game.getFeature(Otc::GameIngameStoreHighlights)) + highlightState = msg->getU8(); + std::vector icons; int iconCount = msg->getU8(); for(int i = 0; i < iconCount; i++) { @@ -554,8 +558,12 @@ void ProtocolGame::parseStoreOffers(const InputMessagePtr& msg) std::string offerDescription = msg->getString(); int price = msg->getU32(); - int state = msg->getU8(); - int disabled = msg->getU8() == 1; + int highlightState = msg->getU8(); + int disabledState = msg->getU8(); + std::string disabledReason = ""; + if(g_game.getFeature(Otc::GameIngameStoreHighlights) && disabledState == 1) { + disabledReason = msg->getString(); + } int icons = msg->getU8(); for(int j = 0; j < icons; j++) { diff --git a/src/client/protocolgamesend.cpp b/src/client/protocolgamesend.cpp index 8ec1e4e3..f43efdf6 100644 --- a/src/client/protocolgamesend.cpp +++ b/src/client/protocolgamesend.cpp @@ -886,20 +886,29 @@ void ProtocolGame::sendRequestTransactionHistory(int page, int entriesPerPage) send(msg); } -void ProtocolGame::sendRequestStoreOffers(const std::string& categoryName) +void ProtocolGame::sendRequestStoreOffers(const std::string& categoryName, int serviceType) { OutputMessagePtr msg(new OutputMessage); msg->addU8(Proto::ClientRequestStoreOffers); + + if(g_game.getFeature(Otc::GameIngameStoreServiceType)) { + msg->addU8(serviceType); + } msg->addString(categoryName); send(msg); } -void ProtocolGame::sendOpenStore() +void ProtocolGame::sendOpenStore(int serviceType, const std::string& category) { OutputMessagePtr msg(new OutputMessage); msg->addU8(Proto::ClientOpenStore); + if(g_game.getFeature(Otc::GameIngameStoreServiceType)) { + msg->addU8(serviceType); + msg->addString(category); + } + send(msg); }