| 13 | |
| 14 | public: |
| 15 | static void Render() |
| 16 | { |
| 17 | if (ImGui::BeginTabItem("Game")) |
| 18 | { |
| 19 | static std::string result; |
| 20 | static std::string custom; |
| 21 | |
| 22 | static std::vector<std::pair<long, std::string>> gamemodes; |
| 23 | |
| 24 | if (onOpen) |
| 25 | { |
| 26 | if (gamemodes.empty()) |
| 27 | { |
| 28 | std::string getQueues = LCU::Request("GET", "/lol-game-queues/v1/queues"); |
| 29 | Json::CharReaderBuilder builder; |
| 30 | const std::unique_ptr<Json::CharReader> reader(builder.newCharReader()); |
| 31 | JSONCPP_STRING err; |
| 32 | Json::Value root; |
| 33 | if (reader->parse(getQueues.c_str(), getQueues.c_str() + static_cast<int>(getQueues.length()), &root, &err)) |
| 34 | { |
| 35 | if (root.isArray()) |
| 36 | { |
| 37 | for (Json::Value::ArrayIndex i = 0; i < root.size(); i++) |
| 38 | { |
| 39 | if (root[i]["queueAvailability"].asString() != "Available") |
| 40 | continue; |
| 41 | |
| 42 | int64_t id = root[i]["id"].asInt64(); |
| 43 | std::string name = root[i]["name"].asString(); |
| 44 | name += " " + std::to_string(id); |
| 45 | //std::cout << id << " " << name << std::endl; |
| 46 | std::pair<long, std::string> temp = { id, name }; |
| 47 | gamemodes.emplace_back(temp); |
| 48 | } |
| 49 | |
| 50 | std::ranges::sort(gamemodes, [](auto& left, auto& right) { |
| 51 | return left.first < right.first; |
| 52 | }); |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | static std::vector<std::string> firstPosition = { "UNSELECTED", "TOP", "JUNGLE", "MIDDLE", "BOTTOM", "UTILITY", "FILL" }; |
| 59 | static std::vector<std::string> secondPosition = { "UNSELECTED", "TOP", "JUNGLE", "MIDDLE", "BOTTOM", "UTILITY", "FILL" }; |
| 60 | |
| 61 | static int gameID = 0; |
| 62 | |
| 63 | ImGui::Columns(4, nullptr, false); |
| 64 | |
| 65 | if (ImGui::Button("Quickplay")) |
| 66 | gameID = Quickplay; |
| 67 | |
| 68 | if (ImGui::Button("Draft pick")) |
| 69 | gameID = DraftPick; |
| 70 | |
| 71 | if (ImGui::Button("Solo/Duo")) |
| 72 | gameID = SoloDuo; |
nothing calls this directly
no test coverage detected