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

Method GetInstalockChamps

KBotExt/GameTab.h:1140–1170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1138 }
1139
1140 static std::vector<std::pair<int, std::string>> GetInstalockChamps()
1141 {
1142 std::vector<std::pair<int, std::string>> temp;
1143
1144 std::string result = LCU::Request("GET", "https://127.0.0.1/lol-champions/v1/owned-champions-minimal");
1145 Json::CharReaderBuilder builder;
1146 const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
1147 JSONCPP_STRING err;
1148 Json::Value root;
1149 if (reader->parse(result.c_str(), result.c_str() + static_cast<int>(result.length()), &root, &err))
1150 {
1151 if (root.isArray())
1152 {
1153 for (auto& i : root)
1154 {
1155 if (i["freeToPlay"].asBool() == true || i["ownership"]["owned"].asBool() == true ||
1156 (i["ownership"].isMember("xboxGPReward") && i["ownership"]["xboxGPReward"].asBool() == true))
1157 {
1158 std::string loadScreenPath = i["baseLoadScreenPath"].asString();
1159 size_t nameStart = loadScreenPath.find("ASSETS/Characters/") + strlen("ASSETS/Characters/");
1160 std::string champName = loadScreenPath.substr(nameStart, loadScreenPath.find('/', nameStart) - nameStart);
1161
1162 std::pair champ = { i["id"].asInt(), champName };
1163 temp.emplace_back(champ);
1164 }
1165 }
1166 }
1167 }
1168 std::ranges::sort(temp, [](std::pair<int, std::string> a, std::pair<int, std::string> b) { return a.second < b.second; });
1169 return temp;
1170 }
1171
1172 static void InstantMessage(const bool instantMute = false, const bool sideNotification = false)
1173 {

Callers

nothing calls this directly

Calls 1

c_strMethod · 0.80

Tested by

no test coverage detected