Skip to content

Commit

Permalink
1 click friend remover/shard disenchant, legacy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KebsCS committed May 16, 2021
1 parent f652924 commit 533e149
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 26 deletions.
110 changes: 97 additions & 13 deletions DirectX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ void GetAllChampions(std::string patch)
champSkins = temp;
}

void CheckVersion()
{
HTTP http;
std::string getLatest = http.Request("GET", "https://api.github.com/repos/KebsCS/KBotExt/releases/latest");
Aws::String aws_s(getLatest.c_str(), getLatest.size());
Aws::Utils::Json::JsonValue Info(aws_s);
std::string latestName = Info.View().AsObject().GetString("tag_name").c_str();
if (latestName != "1.2.1")
{
if (MessageBoxA(0, "Open download website?", "New version available", MB_YESNO) == IDYES)
{
ShellExecute(0, 0, L"https://github.com/KebsCS/KBotExt/releases/latest", 0, 0, SW_SHOW);
}
}
}

bool Direct3D9Render::DirectXInit(HWND hWnd)
{
// Setup swap chain
Expand Down Expand Up @@ -83,6 +99,9 @@ bool Direct3D9Render::DirectXInit(HWND hWnd)

gamePatch = GetCurrentPatch();

// Check latest app version
CheckVersion();

MakeHeader();

std::thread t{ GetAllChampions, gamePatch };
Expand Down Expand Up @@ -385,6 +404,11 @@ void Direct3D9Render::GameTab()
{
req = http.Request("POST", "https://127.0.0.1/lol-lobby/v2/lobby/matchmaking/search", "", LolHeader, "", "", clientPort);
}
ImGui::SameLine();
if (ImGui::Button("Dodge"))
{
req = http.Request("POST", R"(https://127.0.0.1/lol-login/v1/session/invoke?destination=lcdsServiceProxy&method=call&args=["","teambuilder-draft","quitV2",""])", "", LolHeader, "", "", clientPort);
}

ImGui::Checkbox("Auto accept", &bAutoAccept);

Expand Down Expand Up @@ -968,18 +992,17 @@ void Direct3D9Render::LaunchOldClient()
outfile << content;
outfile.close();
}
for (std::string s : lolProcs)

if (::FindWindowA(0, "League of Legends"))
{
std::string kill = "taskkill /im " + s + " /t /f";
utils->Exec(kill.c_str());
HTTP http;
http.Request("POST", "https://127.0.0.1/process-control/v1/process/quit", "", LolHeader, "", "", clientPort);

// wait for client to close (maybe theres a better method of doing that)
std::this_thread::sleep_for(std::chrono::milliseconds(4500));
}
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
//this doesnt work but works if I paste it into cmd
//std::string run = R"("C:\Riot Games\League of Legends\LeagueClient.exe" --system-yaml-override="C:\Riot Games\League of Legends\LoL Companion\system.yaml")";
ShellExecute(NULL, NULL, LR"(C:\Riot Games\Riot Client\League of Legends\LeagueClient.exe)", NULL, NULL, SW_SHOWNORMAL);
//ShellExecute(NULL, NULL, L"C:\\Riot Games\\Riot Client\\RiotClientServices.exe", L"--launch-product=league_of_legends --launch-patchline=live", NULL, SW_SHOWNORMAL);

//system(run.c_str());
ShellExecute(NULL, L"open", L"\"C:\\Riot Games\\League of Legends\\LeagueClient.exe\"", L"--system-yaml-override=\"C:\\Riot Games\\League of Legends\\LoL Companion\\system.yaml\"", NULL, SW_SHOWNORMAL);
}

void Direct3D9Render::SkinsTab()
Expand All @@ -988,11 +1011,13 @@ void Direct3D9Render::SkinsTab()
{
HTTP http;
static std::string req;
static Aws::Utils::Json::JsonValue Info;
if (skinsOpen)
{
req = http.Request("GET", "https://127.0.0.1/lol-inventory/v2/inventory/CHAMPION_SKIN", "", LolHeader, "", "", clientPort);

Aws::String aws_s(req.c_str(), req.size());
Aws::Utils::Json::JsonValue Info(aws_s);
Aws::String aws_s(req.c_str(), req.size());
Info = aws_s;
}

auto skinsArr = Info.View().AsArray();

Expand Down Expand Up @@ -1039,7 +1064,17 @@ void Direct3D9Render::LootTab()
if (ImGui::BeginTabItem("Loot"))
{
HTTP http;
static std::string req;// = http.Request("GET"), "https://127.0.0.1/lol-loot/v1/player-loot-map"), "", LolHeader, "", "", clientPort);
static std::string req;
static std::string getLoot;
static Aws::Utils::Json::JsonValue Info;
if (lootOpen)
{
getLoot = http.Request("GET", "https://127.0.0.1/lol-loot/v1/player-loot-map", "", LolHeader, "", "", clientPort);
Aws::String aws_s(getLoot.c_str(), getLoot.size());
Info = aws_s;
}

auto lootArr = Info.View().AsObject().GetAllObjects();

//GET /lol-loot/v1/player-display-categories
//["CHEST","CHAMPION","SKIN","COMPANION","ETERNALS","EMOTE","WARDSKIN","SUMMONERICON"]
Expand All @@ -1060,6 +1095,10 @@ void Direct3D9Render::LootTab()
//lol-loot/v1/recipes/WARDSKIN_RENTAL_disenchant/craft?repeat=1
//["WARD_SKIN_RENTAL_199"]

//disenchant champ shards
//lol-loot/v1/recipes/CHAMPION_RENTAL_disenchant/craft?repeat=1
//["CHAMPION_RENTAL_22"]

if (ImGui::Button("Craft Key"))
req = http.Request("POST", "https://127.0.0.1/lol-loot/v1/recipes/MATERIAL_key_fragment_forge/craft?repeat=1", "[\"MATERIAL_key_fragment\"]", LolHeader, "", "", clientPort);

Expand All @@ -1069,10 +1108,32 @@ void Direct3D9Render::LootTab()
if (ImGui::Button("Open Mastery Chest"))
req = http.Request("POST", "https://127.0.0.1/lol-loot/v1/recipes/CHEST_champion_mastery_OPEN/craft?repeat=1", R"(["CHEST_champion_mastery","MATERIAL_key"])", LolHeader, "", "", clientPort);

if (ImGui::Button("Disenchant all champion shards"))
{
if (MessageBoxA(0, "Are you sure?", 0, MB_OKCANCEL) == IDOK)
{
int i = 0;
for (auto a : lootArr)
{
std::string name = a.first.c_str();
if (name.find("CHAMPION_RENTAL") != std::string::npos)
{
std::string body = "[\"" + name + "\"]";
http.Request("POST", "https://127.0.0.1/lol-loot/v1/recipes/CHAMPION_RENTAL_disenchant/craft?repeat=1", body, LolHeader, "", "", clientPort);
i++;
}
}
req = "Disenchanted " + std::to_string(i) + " champion shards";
}
}

ImGui::TextWrapped("%s", req.c_str());

lootOpen = false;
ImGui::EndTabItem();
}
else
lootOpen = true;
}

void Direct3D9Render::MiscTab()
Expand Down Expand Up @@ -1120,9 +1181,32 @@ void Direct3D9Render::MiscTab()
if (ImGui::Button("Close client"))
miscReq = http.Request("POST", "https://127.0.0.1/process-control/v1/process/quit", "", LolHeader, "", "", clientPort);

ImGui::Separator();

if (ImGui::Button("Free Tristana + Riot Girl skin"))
miscReq = http.Request("POST", "https://127.0.0.1/lol-login/v1/session/invoke?destination=inventoryService&method=giftFacebookFan&args=[]", "", LolHeader, "", "", clientPort);

if (ImGui::Button("Remove all friends"))
{
if (MessageBoxA(0, "Are you sure?", 0, MB_OKCANCEL) == IDOK)
{
std::string getFriends = http.Request("GET", "https://127.0.0.1/lol-chat/v1/friends", "", LolHeader, "", "", clientPort);
Aws::String aws_s(getFriends.c_str(), getFriends.size());
Aws::Utils::Json::JsonValue Info(aws_s);

auto friendArr = Info.View().AsArray();
size_t friendArrSize = friendArr.GetLength();
for (size_t i = 0; i < friendArrSize; ++i)
{
auto friendObj = friendArr.GetItem(i).AsObject();

std::string req = "https://127.0.0.1/lol-chat/v1/friends/" + std::string(friendObj.GetString("pid").c_str());
http.Request("DELETE", req, "", LolHeader, "", "", clientPort);
}
miscReq = "Deleted " + std::to_string(friendArrSize) + " friends";
}
}

ImGui::TextWrapped(miscReq.c_str());
ImGui::EndTabItem();
}
Expand Down
10 changes: 1 addition & 9 deletions DirectX.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Direct3D9Render
std::string session;
bool champsOpen = true;
bool skinsOpen = true;
bool lootOpen = true;

std::string gamePatch;
std::string GetCurrentPatch();
Expand All @@ -54,15 +55,6 @@ class Direct3D9Render
std::vector<ChampMinimal>champsMinimal;
std::vector<ChampMastery>champsMastery;

std::vector<std::string>lolProcs =
{
"RiotClientServices.exe",
"LeagueClient.exe",
"RiotClientCrashHandler.exe",
"LeagueClientUx.exe",
"LeagueClientUxRender.exe",
};

public:
bool closedClient = false;

Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For fun project made in the span of 2 nights back in February 2021, which I'm no
* DirectX 11 with ImGui for drawings

## Features
* Auto update every patch
* Works every patch
* Launch multiple clients
* Free skin and free champion (Riot Girl Tristana)
* Start any lobby/game
Expand All @@ -22,8 +22,7 @@ For fun project made in the span of 2 nights back in February 2021, which I'm no
* Send any custom request
* 1 click login
* Fast key crafer/chest opener
* Remove all friends/disenchant all shards with 1 click

## TODO
* Cleanup code
* Fix loot tab
* Fix launching legacy client
* Cleanup code, different tabs in different files etc

0 comments on commit 533e149

Please sign in to comment.