Skip to content

Commit 12c540b

Browse files
committed
sorting skins, merged loot with misc tab
1 parent 1770af7 commit 12c540b

11 files changed

Lines changed: 130 additions & 209 deletions

File tree

KBotExt/ChampsTab.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ChampsTab
1414
{
1515
static bool bOnOpen = true;
1616
static unsigned iChampsOwned = 0;
17-
bool bSortOnOpen = false;
17+
static bool bSortOnOpen = false;
1818

1919
if (ImGui::BeginTabItem("Champs"))
2020
{

KBotExt/Definitions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct Skin
6262
int itemId;
6363
std::string ownershipType;
6464
bool isVintage;
65-
std::string purchaseDate;
65+
tm purchaseDate;
6666
int qunatity;
6767
std::string uuid;
6868
};

KBotExt/DirectX.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "InfoTab.h"
55
#include "LoginTab.h"
66
#include "ProfileTab.h"
7-
#include "LootTab.h"
87
#include "MiscTab.h"
98
#include "CustomTab.h"
109
#include "InvokeTab.h"
@@ -140,8 +139,6 @@ int Direct3D9Render::Render()
140139

141140
SkinsTab::Render();
142141

143-
LootTab::Render();
144-
145142
MiscTab::Render();
146143

147144
CustomTab::Render();

KBotExt/GameTab.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#pragma once
22

3-
#include <utility>
4-
53
#include "Definitions.h"
64
#include "Includes.h"
75
#include "HTTP.h"

KBotExt/Includes.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
#include <thread>
44
#include <chrono>
55
#include <iostream>
6+
#include <filesystem>
7+
#include <regex>
8+
#include <utility>
69

710
#include <json/json.h>
811

KBotExt/KBotExt.vcxproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@
9090
<ConformanceMode>true</ConformanceMode>
9191
<LanguageStandard>stdcpplatest</LanguageStandard>
9292
<AdditionalIncludeDirectories>$(SolutionDir)\KBotExt;$(SolutionDir)\KBotExt\imgui;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
93+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
94+
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
9395
</ClCompile>
9496
<Link>
9597
<SubSystem>Windows</SubSystem>
@@ -209,7 +211,6 @@
209211
<ClInclude Include="json\version.h" />
210212
<ClInclude Include="json\writer.h" />
211213
<ClInclude Include="LoginTab.h" />
212-
<ClInclude Include="LootTab.h" />
213214
<ClInclude Include="Misc.h" />
214215
<ClInclude Include="MiscTab.h" />
215216
<ClInclude Include="NtQueryInfoProc.h" />

KBotExt/KBotExt.vcxproj.filters

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,6 @@
164164
<ClInclude Include="ProfileTab.h">
165165
<Filter>Tabs</Filter>
166166
</ClInclude>
167-
<ClInclude Include="LootTab.h">
168-
<Filter>Tabs</Filter>
169-
</ClInclude>
170-
<ClInclude Include="MiscTab.h">
171-
<Filter>Tabs</Filter>
172-
</ClInclude>
173167
<ClInclude Include="CustomTab.h">
174168
<Filter>Tabs</Filter>
175169
</ClInclude>
@@ -188,6 +182,9 @@
188182
<ClInclude Include="Settings.h">
189183
<Filter>Header Files</Filter>
190184
</ClInclude>
185+
<ClInclude Include="MiscTab.h">
186+
<Filter>Tabs</Filter>
187+
</ClInclude>
191188
</ItemGroup>
192189
<ItemGroup>
193190
<None Include="json\json_valueiterator.inl">

KBotExt/LoginTab.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#pragma once
22

3-
#include <filesystem>
4-
53
#include "Definitions.h"
64
#include "Includes.h"
75
#include "HTTP.h"

KBotExt/LootTab.h

Lines changed: 0 additions & 165 deletions
This file was deleted.

KBotExt/MiscTab.h

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#pragma once
22

3-
#include <filesystem>
4-
53
#include "Definitions.h"
64
#include "Includes.h"
75
#include "HTTP.h"
@@ -269,9 +267,6 @@ class MiscTab
269267
ImGui::EndCombo();
270268
}
271269

272-
if (ImGui::Button("Check email of the account"))
273-
result = http->Request("GET", "https://127.0.0.1/lol-email-verification/v1/email", "", auth->leagueHeader, "", "", auth->leaguePort);
274-
275270
//if (ImGui::Button("Skip tutorial"))
276271
//{
277272
// http->Request("POST", "https://127.0.0.1/telemetry/v1/events/new_player_experience", R"({"eventName":"hide_screen","plugin":"rcp-fe-lol-new-player-experience","screenName":"npe_tutorial_modules"})", auth->leagueHeader, "", "", auth->leaguePort);
@@ -290,6 +285,70 @@ class MiscTab
290285

291286
ImGui::Separator();
292287

288+
static std::vector<std::pair<std::string, std::string>>itemsDisenchant = {
289+
{"Champion shards","CHAMPION_RENTAL"}, {"Champion pernaments","CHAMPION"},
290+
{"Skin shards","CHAMPION_SKIN_RENTAL"}, {"Skin pernaments", "CHAMPION_SKIN"},
291+
{"Eternals","STATSTONE_SHARD"},{"Wards","WARDSKIN_RENTAL"}
292+
};
293+
static size_t itemIndexDisenchant = 0;
294+
const char* comboDisenchant = itemsDisenchant[itemIndexDisenchant].first.c_str();
295+
296+
if (ImGui::Button("Disenchant all: "))
297+
{
298+
Json::Value root;
299+
Json::CharReaderBuilder builder;
300+
const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
301+
JSONCPP_STRING err;
302+
std::string getLoot = http->Request("GET", "https://127.0.0.1/lol-loot/v1/player-loot-map", "", auth->leagueHeader, "", "", auth->leaguePort);
303+
304+
if (reader->parse(getLoot.c_str(), getLoot.c_str() + static_cast<int>(getLoot.length()), &root, &err))
305+
{
306+
if (MessageBoxA(0, "Are you sure?", 0, MB_OKCANCEL) == IDOK)
307+
{
308+
int i = 0;
309+
310+
for (std::string name : root.getMemberNames())
311+
{
312+
std::regex regexStr("^" + itemsDisenchant[itemIndexDisenchant].second + "_[\\d]+");
313+
314+
if (std::regex_match(name, regexStr))
315+
{
316+
std::string disenchantCase = itemsDisenchant[itemIndexDisenchant].second == "STATSTONE_SHARD" ? "DISENCHANT" : "disenchant";
317+
318+
std::string disenchantName = itemsDisenchant[itemIndexDisenchant].second;
319+
if (itemsDisenchant[itemIndexDisenchant].second == "CHAMPION_SKIN_RENTAL")
320+
disenchantName = "SKIN_RENTAL";
321+
322+
std::string disenchantUrl = std::format("https://127.0.0.1/lol-loot/v1/recipes/{0}_{1}/craft?repeat=1", disenchantName, disenchantCase);
323+
std::string disenchantBody = std::format(R"(["{}"])", name).c_str();
324+
http->Request("POST", disenchantUrl, disenchantBody, auth->leagueHeader, "", "", auth->leaguePort);
325+
i++;
326+
}
327+
}
328+
result = std::format("Disenchanted {0} {1}", std::to_string(i), itemsDisenchant[itemIndexDisenchant].first);
329+
}
330+
}
331+
else
332+
result = "Loot not found";
333+
}
334+
335+
ImGui::SameLine();
336+
337+
ImGui::SetNextItemWidth(S.Window.width / 3);
338+
if (ImGui::BeginCombo("##comboDisenchant", comboDisenchant, 0))
339+
{
340+
for (size_t n = 0; n < itemsDisenchant.size(); n++)
341+
{
342+
const bool is_selected = (itemIndexDisenchant == n);
343+
if (ImGui::Selectable(itemsDisenchant[n].first.c_str(), is_selected))
344+
itemIndexDisenchant = n;
345+
346+
if (is_selected)
347+
ImGui::SetItemDefaultFocus();
348+
}
349+
ImGui::EndCombo();
350+
}
351+
293352
// Getting closest champion name with Levenshtein distance algorithm and getting it's id
294353
ImGui::Text("Champion name to ID");
295354
static std::vector<std::string>champNames;
@@ -323,6 +382,9 @@ class MiscTab
323382
ImGui::SameLine();
324383
ImGui::TextWrapped("%s ID: %s", closestChampion.c_str(), closestId.c_str());
325384

385+
if (ImGui::Button("Check email of the account"))
386+
result = http->Request("GET", "https://127.0.0.1/lol-email-verification/v1/email", "", auth->leagueHeader, "", "", auth->leaguePort);
387+
326388
static Json::StreamWriterBuilder wBuilder;
327389
static std::string sResultJson;
328390
static char* cResultJson;

0 commit comments

Comments
 (0)