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