| 8 | { |
| 9 | public: |
| 10 | static void Render() |
| 11 | { |
| 12 | if (ImGui::BeginTabItem("Profile")) |
| 13 | { |
| 14 | static char statusText[1024 * 16]; |
| 15 | ImGui::Text("Status:"); |
| 16 | const ImVec2 label_size = ImGui::CalcTextSize("W", nullptr, true); |
| 17 | |
| 18 | ImGui::InputTextMultiline("##inputStatus", statusText, IM_ARRAYSIZE(statusText), ImVec2(S.Window.width - 230.f, |
| 19 | (label_size.y + ImGui::GetStyle().FramePadding.y) * 6.f), ImGuiInputTextFlags_AllowTabInput); |
| 20 | if (ImGui::Button("Submit status")) |
| 21 | { |
| 22 | std::string body = R"({"statusMessage":")" + std::string(statusText) + "\"}"; |
| 23 | |
| 24 | size_t nPos = 0; |
| 25 | while (nPos != std::string::npos) |
| 26 | { |
| 27 | nPos = body.find('\n', nPos); |
| 28 | if (nPos != std::string::npos) |
| 29 | { |
| 30 | body.erase(body.begin() + nPos); |
| 31 | body.insert(nPos, "\\n"); |
| 32 | } |
| 33 | } |
| 34 | std::string result = LCU::Request("PUT", "https://127.0.0.1/lol-chat/v1/me", body); |
| 35 | if (result.find("errorCode") != std::string::npos) |
| 36 | MessageBoxA(nullptr, result.c_str(), nullptr, 0); |
| 37 | } |
| 38 | |
| 39 | ImGui::SameLine(); |
| 40 | static int availability = 0; |
| 41 | static int lastAvailability = 0; |
| 42 | ImGui::RadioButton("Online", &availability, 0); |
| 43 | ImGui::SameLine(); |
| 44 | ImGui::RadioButton("Mobile", &availability, 1); |
| 45 | ImGui::SameLine(); |
| 46 | ImGui::RadioButton("Away", &availability, 2); |
| 47 | ImGui::SameLine(); |
| 48 | ImGui::RadioButton("Offline", &availability, 3); |
| 49 | |
| 50 | if (availability != lastAvailability) |
| 51 | { |
| 52 | lastAvailability = availability; |
| 53 | std::string body = R"({"availability":")"; |
| 54 | switch (availability) |
| 55 | { |
| 56 | case 0: |
| 57 | body += "online"; |
| 58 | break; |
| 59 | case 1: |
| 60 | body += "mobile"; |
| 61 | break; |
| 62 | case 2: |
| 63 | body += "away"; |
| 64 | break; |
| 65 | case 3: |
| 66 | body += "offline"; |
| 67 | break; |