Pas encore released et pas forcément à vendre non plus (c'est pas l'idée du forum). Mais si je pouvais t'aider à dev le tien ce serait avec plaisir.
Si ça peut t'aider voilà ce que j'utilise pour émuler le launcher directement au niveau de mon client:
std::optional<std::string> GetToken()
{
CURL* curl;
CURLcode res;
curl = curl_easy_init();
std::string token;
try
{
const auto data = std::format("login={}&password={}&game_id=101", globals::login, globals::password);
struct curl_slist* headers = nullptr;
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://haapi.ankama.com/json/Ankama/v5/Api/CreateApiKey");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
curl_easy_setopt(curl, CURLOPT_USERAGENT, "Zaap 3.7.4");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data.data());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, onResponseWrite);
res = curl_easy_perform(curl);
auto json = nlohmann::json::parse(buffer);
const auto apiKey = json["key"].get<std::string>();
buffer.clear();
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(curl, CURLOPT_URL, "https://haapi.ankama.com/json/Ankama/v5/Account/CreateToken?game=101");
headers = curl_slist_append(headers, std::format("apiKey: {}", apiKey.data()).data());
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
json = nlohmann::json::parse(buffer);
token = json["token"].get<std::string>();
buffer.clear();
}
catch (...)
{
MessageBoxA(0, "Failed to get game token!", "error", 0);
}
curl_easy_cleanup(curl);
return token;
}
DWORD WINAPI StartLauncherEmulator(LPVOID lpData)
{
SOCKET s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
std::array<char, 4086> buffer{ 0 };
SOCKADDR_IN name;
name.sin_addr.s_addr = inet_addr("127.0.0.1");
name.sin_port = htons(globals::launcherPort);
name.sin_family = AF_INET;
bind(s, (SOCKADDR*)&name, sizeof(name));
listen(s, 1);
SOCKET client = accept(s, nullptr, nullptr);
int bytesRead = recv(client, buffer.data(), std::size(buffer), 0);
auto token = GetToken();
auto response = std::format("auth_getGameToken {}", token->data()) + '\0';
WSABUF buf;
buf.buf = response.data();
buf.len = response.size();
DWORD bytesSent = 0;
WSASend(client, &buf, 1, &bytesSent, 0, nullptr, nullptr);
closesocket(s);
closesocket(client);
return 0u;
}