Protocol 10.93

This commit is contained in:
Sam 2016-05-23 02:48:32 +02:00
parent 0dfdb22509
commit 1c09c3770b
7 changed files with 44 additions and 15 deletions

View File

@ -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

View File

@ -406,6 +406,8 @@ namespace Otc
GameIdleAnimations = 71,
GameKeepUnawareTiles = 72,
GameIngameStore = 73,
GameIngameStoreHighlights = 74,
GameIngameStoreServiceType = 75,
LastGameFeature = 101
};

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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<std::string> 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++) {

View File

@ -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);
}