MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / Render

Method Render

KBotExt/GameTab.h:15–1138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14public:
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;

Callers

nothing calls this directly

Calls 9

HelpMarkerFunction · 0.85
ComboAutoSelectFunction · 0.85
eraseFunction · 0.85
ImVec2Function · 0.85
c_strMethod · 0.80
reserveMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected