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

Method MultiSearch

KBotExt/GameTab.h:1511–1630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1509 }
1510
1511 static std::string MultiSearch(const std::string& website)
1512 {
1513 std::string names;
1514 std::string champSelect = LCU::Request("GET", "https://127.0.0.1/lol-champ-select/v1/session");
1515 if (!champSelect.empty() && champSelect.find("RPC_ERROR") == std::string::npos)
1516 {
1517 Json::CharReaderBuilder builder;
1518 const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
1519 JSONCPP_STRING err;
1520 Json::Value rootRegion;
1521 Json::Value rootCSelect;
1522 Json::Value rootSummoner;
1523 Json::Value rootPartcipants;
1524
1525 std::wstring summNames;
1526 bool isRanked = false;
1527
1528 if (reader->parse(champSelect.c_str(), champSelect.c_str() + static_cast<int>(champSelect.length()), &rootCSelect, &err))
1529 {
1530 auto teamArr = rootCSelect["myTeam"];
1531 if (teamArr.isArray())
1532 {
1533 for (auto& i : teamArr)
1534 {
1535 if (i["nameVisibilityType"].asString() == "HIDDEN")
1536 {
1537 isRanked = true;
1538 break;
1539 }
1540
1541 std::string summId = i["summonerId"].asString();
1542 if (summId != "0")
1543 {
1544 std::string summoner = LCU::Request("GET", "https://127.0.0.1/lol-summoner/v1/summoners/" + summId);
1545 if (reader->parse(summoner.c_str(), summoner.c_str() + static_cast<int>(summoner.length()), &rootSummoner, &err))
1546 {
1547 summNames += Utils::StringToWstring(rootSummoner["gameName"].asString()) + L"%23" + Utils::StringToWstring(rootSummoner["tagLine"].asString()) + L",";
1548 }
1549 }
1550 }
1551
1552 // Ranked Lobby Reveal
1553 if (isRanked)
1554 {
1555 summNames = L"";
1556
1557 LCU::SetCurrentClientRiotInfo();
1558 std::string participants = cpr::Get(
1559 cpr::Url{ std::format("https://127.0.0.1:{}/chat/v5/participants", LCU::riot.port) },
1560 cpr::Header{ Utils::StringToHeader(LCU::riot.header) }, cpr::VerifySsl{ false }).text;
1561 if (reader->parse(participants.c_str(), participants.c_str() + static_cast<int>(participants.length()), &rootPartcipants,
1562 &err))
1563 {
1564 auto participantsArr = rootPartcipants["participants"];
1565 if (participantsArr.isArray())
1566 {
1567 for (auto& i : participantsArr)
1568 {

Callers

nothing calls this directly

Calls 3

c_strMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected