| 217 | } |
| 218 | |
| 219 | void 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 | |
| 256 | void RewardsPage::sendHttpRequest() |
| 257 | { |
nothing calls this directly
no test coverage detected