Skip to content

Commit ee9a65e

Browse files
committed
fixed login, added riot id changer
1 parent 1829366 commit ee9a65e

4 files changed

Lines changed: 79 additions & 48 deletions

File tree

KBotExt/KBotExt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ int WINAPI wWinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPWSTR
181181
closedNow = true;
182182
if (!LCU::leagueProcesses.empty())
183183
LCU::leagueProcesses.clear();
184-
if (FindWindowA("RCLIENT", "Riot Client"))
184+
if (FindWindowA(NULL, "Riot Client"))
185185
{
186186
if (LCU::riot.port == 0)
187187
{

KBotExt/LCU.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,15 @@ bool LCU::SetRiotClientInfo(const ClientInfo& info)
7878

7979
bool LCU::SetRiotClientInfo()
8080
{
81-
return SetRiotClientInfo(Auth::GetClientInfo(Auth::GetProcessId(L"RiotClientUx.exe")));
81+
const auto riotClients = Auth::GetAllProcessIds(L"Riot Client.exe");
82+
for (const DWORD& clientPid : riotClients)
83+
{
84+
const auto info = Auth::GetClientInfo(clientPid);
85+
if (info.port == 0)
86+
continue;
87+
return SetRiotClientInfo(info);
88+
}
89+
return false;
8290
}
8391

8492
bool LCU::SetLeagueClientInfo(const ClientInfo& info)

KBotExt/LoginTab.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class LoginTab
1515
{
1616
while (true)
1717
{
18-
if (FindWindowA("RCLIENT", "Riot Client") && LCU::riot.port != 0)
18+
if (FindWindowA(NULL, "Riot Client") && LCU::riot.port != 0)
1919
{
2020
// waits to be sure that client is fully loaded
2121
std::this_thread::sleep_for(std::chrono::milliseconds(2000));

KBotExt/MiscTab.h

Lines changed: 68 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -481,57 +481,80 @@ class MiscTab
481481

482482
ImGui::Separator();
483483

484-
if (ImGui::Button("Tournament of Souls - unlock all"))
485-
{
486-
LCU::Request("POST", "/lol-marketing-preferences/v1/partition/sfm2023", R"({
487-
"SmallConspiracyFan" : "True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True",
488-
"SmallGwenPykeFan" : "True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True",
489-
"SmallJhinFan" : "True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True",
490-
"SmallSettFans" : "True,True,True,True,True,True,True,True,True,True,True,True,True,True,True",
491-
"SmallShaco" : "True,True",
492-
"hasNewAbility" : "False",
493-
"hasNewFanLine" : "False",
494-
"hasPlayedTutorial" : "True",
495-
"hasSeenCelebration_Story" : "True",
496-
"hasSeenLoadoutTutorial" : "True",
497-
"hasSeenMapTutorial" : "True",
498-
"loadout_active_e" : "2",
499-
"loadout_active_q" : "1",
500-
"loadout_active_r" : "2",
501-
"loadout_active_w" : "2",
502-
"numNodesUnlocked" : "20",
503-
"progress" : "20"
504-
})");
484+
ImGui::Text("Change your Riot ID:");
485+
static char bufGameName[50];
486+
ImGui::SetNextItemWidth(static_cast<float>(S.Window.width / 4));
487+
ImGui::InputText("##inputGameName", bufGameName, IM_ARRAYSIZE(bufGameName));
505488

506-
Json::Value root;
507-
Json::CharReaderBuilder builder;
508-
const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
509-
JSONCPP_STRING err;
510-
std::string getGrants = LCU::Request("GET", "/lol-rewards/v1/grants");
489+
ImGui::SameLine();
490+
ImGui::Text("#");
491+
ImGui::SameLine();
492+
static char bufTagLine[50];
493+
ImGui::SetNextItemWidth(static_cast<float>(S.Window.width / 5));
494+
ImGui::InputText("##inputTagLine", bufTagLine, IM_ARRAYSIZE(bufTagLine));
511495

512-
if (reader->parse(getGrants.c_str(), getGrants.c_str() + static_cast<int>(getGrants.length()), &root, &err))
496+
ImGui::SameLine();
497+
if (ImGui::Button("Change##buttonRiotID"))
498+
{
499+
std::string newRiotId = std::string(bufGameName) + "#" + std::string(bufTagLine);
500+
if (MessageBoxA(nullptr, std::string("Your new Riot ID will be: " + newRiotId).c_str(), "Are you sure?", MB_OKCANCEL) == IDOK)
513501
{
514-
if (root.isArray())
515-
{
516-
for (auto grant : root)
517-
{
518-
for (Json::Value& reward : grant["rewardGroup"]["rewards"])
519-
{
520-
Json::Value body;
521-
body["rewardGroupId"] = grant["info"]["rewardGroupId"].asString();
522-
body["selections"] = {};
523-
body["selections"].append(reward["id"].asString());
524-
525-
result += LCU::Request("POST", std::format("/lol-rewards/v1/grants/{}/select", grant["info"]["id"].asString()),
526-
body.toStyledString());
527-
}
528-
}
529-
}
502+
result = LCU::Request("POST", "https://127.0.0.1/lol-summoner/v1/save-alias",
503+
"{\"gameName\": \"" + std::string(bufGameName) + "\", \"tagLine\": \"" + std::string(bufTagLine) + "\"}");
530504
}
531505
}
532506

533-
ImGui::SameLine();
534-
ImGui::HelpMarker("You need reputation for this to work");
507+
// if (ImGui::Button("Tournament of Souls - unlock all"))
508+
// {
509+
// LCU::Request("POST", "/lol-marketing-preferences/v1/partition/sfm2023", R"({
510+
// "SmallConspiracyFan" : "True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True",
511+
// "SmallGwenPykeFan" : "True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True",
512+
// "SmallJhinFan" : "True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True,True",
513+
// "SmallSettFans" : "True,True,True,True,True,True,True,True,True,True,True,True,True,True,True",
514+
// "SmallShaco" : "True,True",
515+
// "hasNewAbility" : "False",
516+
// "hasNewFanLine" : "False",
517+
// "hasPlayedTutorial" : "True",
518+
// "hasSeenCelebration_Story" : "True",
519+
// "hasSeenLoadoutTutorial" : "True",
520+
// "hasSeenMapTutorial" : "True",
521+
// "loadout_active_e" : "2",
522+
// "loadout_active_q" : "1",
523+
// "loadout_active_r" : "2",
524+
// "loadout_active_w" : "2",
525+
// "numNodesUnlocked" : "20",
526+
// "progress" : "20"
527+
//})");
528+
//
529+
// Json::Value root;
530+
// Json::CharReaderBuilder builder;
531+
// const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
532+
// JSONCPP_STRING err;
533+
// std::string getGrants = LCU::Request("GET", "/lol-rewards/v1/grants");
534+
//
535+
// if (reader->parse(getGrants.c_str(), getGrants.c_str() + static_cast<int>(getGrants.length()), &root, &err))
536+
// {
537+
// if (root.isArray())
538+
// {
539+
// for (auto grant : root)
540+
// {
541+
// for (Json::Value& reward : grant["rewardGroup"]["rewards"])
542+
// {
543+
// Json::Value body;
544+
// body["rewardGroupId"] = grant["info"]["rewardGroupId"].asString();
545+
// body["selections"] = {};
546+
// body["selections"].append(reward["id"].asString());
547+
//
548+
// result += LCU::Request("POST", std::format("/lol-rewards/v1/grants/{}/select", grant["info"]["id"].asString()),
549+
// body.toStyledString());
550+
// }
551+
// }
552+
// }
553+
// }
554+
// }
555+
//
556+
// ImGui::SameLine();
557+
// ImGui::HelpMarker("You need reputation for this to work");
535558

536559
static Json::StreamWriterBuilder wBuilder;
537560
static std::string sResultJson;

0 commit comments

Comments
 (0)