MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / onHttpRequestCompleted

Method onHttpRequestCompleted

Source/RewardsPage.cpp:219–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219void RewardsPage::onHttpRequestCompleted(ax::network::HttpClient* sender, ax::network::HttpResponse* response)
220{
221 if (auto str = GameToolbox::getResponse(response))
222 {
223 std::string_view strResp {*str};
224
225 auto decodedResponse = GameToolbox::xorCipher(base64_decode(fmt::format("{}", strResp.substr(5))), "59182");
226 auto data = GameToolbox::splitByDelim(decodedResponse, ':');
227
228 if (GameToolbox::stoi(data[5]) > 1)
229 {
230 _dailyChestTimer1->setString(formatSeconds(GameToolbox::stoi(data[5])));
231 }
232 else
233 {
234 _chestSprite1->setSpriteFrame("chest_01_02_001.png");
235 _dailyChestTimer1->setString("Open");
236 }
237
238 if (GameToolbox::stoi(data[8]) > 1)
239 {
240 _dailyChestTimer2->setString(formatSeconds(GameToolbox::stoi(data[8])));
241 }
242 else
243 {
244 _chestSprite2->setSpriteFrame("chest_02_02_001.png");
245 _dailyChestTimer2->setString("Open");
246 }
247
248 GameToolbox::log("RESPONSE: {}", strResp);
249 GameToolbox::log("RESPONSE: {}", decodedResponse);
250
251 _dailyChestTimer1->setVisible(true);
252 _dailyChestTimer2->setVisible(true);
253 }
254}
255
256void RewardsPage::sendHttpRequest()
257{

Callers

nothing calls this directly

Calls 5

base64_decodeFunction · 0.85
formatSecondsFunction · 0.85
logFunction · 0.85
setSpriteFrameMethod · 0.80
setStringMethod · 0.45

Tested by

no test coverage detected