Skip to content

Commit

Permalink
12.17 patch update
Browse files Browse the repository at this point in the history
  • Loading branch information
R3nzTheCodeGOD committed Sep 12, 2022
1 parent da773c2 commit a69d613
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 63 deletions.
3 changes: 3 additions & 0 deletions R3nzSkinTFT/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ void Config::load() noexcept
this->currentComboSkinIndex = config_json.value("currentComboSkinIndex", 0);
this->curretSkinId = config_json.value("curretSkinId", 1);

if (this->curretSkinId <= 0)
this->curretSkinId = 1;

in.close();
}

Expand Down
9 changes: 6 additions & 3 deletions R3nzSkinTFT/GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ void GUI::render() noexcept
{
const auto& vector{ *static_cast<std::vector<SkinDatabase::PetsInfo>*>(vec) };
if (idx < 0 || idx > static_cast<std::int32_t>(vector.size())) return false;
*out_text = idx == 0 ? "Default" : vector.at(idx - 1).skinName.c_str();
*out_text = idx == 0 ? "Default" : vector.at(idx - 1).skinName;
return true;
};

std::call_once(this->changeSkin, [&]() noexcept -> void {
if (cheatManager.config->currentComboSkinIndex > 0 && cheatManager.config->curretSkinId > cheatManager.database->pets[cheatManager.config->currentComboSkinIndex - 1].skinCount)
cheatManager.config->curretSkinId = 1;

if (cheatManager.config->currentComboSkinIndex > 0)
player->changeSkin(cheatManager.database->pets[cheatManager.config->currentComboSkinIndex - 1].modelName.c_str(), cheatManager.config->curretSkinId);
player->changeSkin(cheatManager.database->pets[cheatManager.config->currentComboSkinIndex - 1].modelName, cheatManager.config->curretSkinId);
});

ImGui::Begin("R3nzSkin TFT", nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_AlwaysAutoResize);
Expand All @@ -44,7 +47,7 @@ void GUI::render() noexcept

ImGui::SliderInt("Current Pet SkinId", &cheatManager.config->curretSkinId, 1, cheatManager.database->pets[cheatManager.config->currentComboSkinIndex - 1].skinCount);
if (ImGui::Button("Change Pet Skin"))
player->changeSkin(cheatManager.database->pets[cheatManager.config->currentComboSkinIndex - 1].modelName.c_str(), cheatManager.config->curretSkinId);
player->changeSkin(cheatManager.database->pets[cheatManager.config->currentComboSkinIndex - 1].modelName, cheatManager.config->curretSkinId);
footer();
ImGui::EndTabItem();
}
Expand Down
5 changes: 2 additions & 3 deletions R3nzSkinTFT/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,14 @@ namespace d3d_vtable {
static void render(void* device, bool is_d3d11 = false) noexcept
{
static const auto client{ cheatManager.memory->client };
if (client && client->gameState == GGameState_s::Running) {
if (client && client->gameState == GGameState_s::Running && cheatManager.gui->is_open) {
if (is_d3d11)
::ImGui_ImplDX11_NewFrame();
else
::ImGui_ImplDX9_NewFrame();
::ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();
if (cheatManager.gui->is_open)
cheatManager.gui->render();
cheatManager.gui->render();
ImGui::EndFrame();
ImGui::Render();

Expand Down
22 changes: 11 additions & 11 deletions R3nzSkinTFT/SkinDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@

#include "CheatManager.hpp"
#include "SkinDatabase.hpp"
#include "offsets.hpp"

void SkinDatabase::update() noexcept
std::uint32_t SkinDatabase::getSkinsLenForModel(std::string model) noexcept
{
const auto getSkinsLenForModel = [](std::string model) noexcept -> std::uint32_t
{
const auto getCharacterPackage{ cheatManager.memory->getCharacterPackage };
const auto defaultSkinData{ *reinterpret_cast<std::uintptr_t*>(getCharacterPackage(model, 0u) + 0x34) };
for (auto skinsLen{ 1u };; skinsLen++) {
if (*reinterpret_cast<std::uintptr_t*>(getCharacterPackage(model, skinsLen) + 0x34) == defaultSkinData)
return skinsLen;
}
};
static const auto getCharacterPackage{ reinterpret_cast<std::uintptr_t(__cdecl*)(std::string&,std::uint32_t)>(cheatManager.memory->getLeagueModule() + offsets::functions::FnCharacterData__GetCharacterPackage) };
const auto defaultSkinData{ *reinterpret_cast<std::uintptr_t*>(getCharacterPackage(model, 0u) + 0x34) };
for (auto skinsLen{ 1u };; ++skinsLen)
if (*reinterpret_cast<std::uintptr_t*>(getCharacterPackage(model, skinsLen) + 0x34) == defaultSkinData)
return skinsLen - 1u;
}

void SkinDatabase::update() noexcept
{
// automatically update number of skins
for (auto& pet : this->pets)
pet.skinCount = getSkinsLenForModel(pet.modelName) - 1u;
pet.skinCount = this->getSkinsLenForModel(pet.modelName);
}
90 changes: 47 additions & 43 deletions R3nzSkinTFT/SkinDatabase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,58 @@ class SkinDatabase {
public:
class PetsInfo {
public:
std::string modelName;
std::string skinName;
std::uint32_t skinCount;
const char* modelName;
const char* skinName;
std::uint32_t skinCount{ 1 };
};

void update() noexcept;
std::uint32_t getSkinsLenForModel(std::string model) noexcept;

// PetModelName, PetName, PetSkinCount(autoupdate)
std::vector<PetsInfo> pets{
{ "PetAkaliDragon", "Ossia", 1 },
{ "PetAoShin", "Ao Shin", 1 },
{ "PetBallDragon", "Poggless", 1 },
{ "PetBellSwayer", "Bell Swayer", 1 },
{ "PetBuglet", "Flutterbug", 1 },
{ "PetChibiEkko", "Ekko", 1 },
{ "PetChibiJinx", "Jinx", 1 },
{ "PetChibiVi", "Vi", 1 },
{ "PetChibiYasuo", "Yasuo", 1 },
{ "PetChoncc", "Choncc", 1 },
{ "PetDowsie", "Dowsie", 1 },
{ "PetDsSquid", "Squink", 1 },
{ "PetDsSwordGuy", "Abyssia", 1 },
{ "PetDsWhale", "Starmaw", 1 },
{ "PetDuckBill", "Duckbill", 1 },
{ "PetFairy", "Nixie", 1 },
{ "PetFenroar", "Fenroar", 1 },
{ "PetGargoyle", "Craggle", 1 },
{ "PetGemTiger", "Protector", 1 },
{ "PetGhosty", "Hauntling", 1 },
{ "PetGloop", "Gloop", 1 },
{ "PetGriffin", "Silverwing", 1 },
{ "PetGrumpyLion", "Furyhorn", 1 },
{ "PetHextechBirb", "Tocker", 1 },
{ "PetJawDragon", "Burno", 1 },
{ "PetMiner", "Molediver", 1 },
{ "PetMiniGolem", "Runespirit", 1 },
{ "PetNimbleFoot", "Nimblefoot", 1 },
{ "PetPegasus", "Lightcharger", 1 },
{ "PetPenguKnight", "Featherknight", 1 },
{ "PetPixiMander", "Piximander", 1 },
{ "PetQiyanaDog", "QiQi", 1 },
{ "PetSennaBunny", "Melisma", 1 },
{ "PetSgCat", "Dango", 1 },
{ "PetSgPig", "Fuwa", 1 },
{ "PetSgShisa", "Shisa", 1 },
{ "PetSpiritFox", "Hushtail", 1 },
{ "PetTftAvatar", "River Sprite", 1 },
{ "PetTurtle", "Paddlemar", 1 },
{ "PetUmbra", "Umbra", 1 }
{ "PetAkaliDragon", "Ossia" },
{ "PetAoShin", "Ao Shin" },
{ "PetBallDragon", "Poggless" },
{ "PetBellSwayer", "Bell Swayer" },
{ "PetBuglet", "Flutterbug" },
{ "PetChibiEkko", "Chibi Ekko" },
{ "PetChibiJinx", "Chibi Jinx" },
{ "PetChibiLeeSin", "Chibi Lee Sin" },
{ "PetChibiVi", "Chibi Vi" },
{ "PetChibiYasuo", "Chibi Yasuo" },
{ "PetChoncc", "Choncc" },
{ "PetDowsie", "Dowsie" },
{ "PetDsSquid", "Squink" },
{ "PetDsSwordGuy", "Abyssia" },
{ "PetDsWhale", "Starmaw" },
{ "PetDuckBill", "Duckbill" },
{ "PetElegantDragon", "Prancie" },
{ "PetFairy", "Nixie" },
{ "PetFenroar", "Fenroar" },
{ "PetGargoyle", "Craggle" },
{ "PetGemTiger", "Protector" },
{ "PetGhosty", "Hauntling" },
{ "PetGloop", "Gloop" },
{ "PetGriffin", "Silverwing" },
{ "PetGrumpyLion", "Furyhorn" },
{ "PetHextechBirb", "Tocker" },
{ "PetJawDragon", "Burno" },
{ "PetMiner", "Molediver" },
{ "PetMiniGolem", "Runespirit" },
{ "PetNimbleFoot", "Nimblefoot" },
{ "PetPegasus", "Lightcharger" },
{ "PetPenguKnight", "Featherknight" },
{ "PetPixiMander", "Piximander" },
{ "PetPupDragon", "Bungo" },
{ "PetQiyanaDog", "QiQi" },
{ "PetSennaBunny", "Melisma" },
{ "PetSgCat", "Dango" },
{ "PetSgPig", "Fuwa" },
{ "PetSgShisa", "Shisa" },
{ "PetSpiritFox", "Hushtail" },
{ "PetTftAvatar", "River Sprite" },
{ "PetTurtle", "Paddlemar" },
{ "PetUmbra", "Umbra" }
};
};
1 change: 0 additions & 1 deletion R3nzSkinTFT/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ void Memory::update(bool gameClient) noexcept
} else {
this->localPlayer = *reinterpret_cast<AIBaseCommon**>(this->getLeagueModule() + offsets::global::LocalPlayer);
this->materialRegistry = reinterpret_cast<FnMaterialRegistryGetSingletonPtr>(this->getLeagueModule() + offsets::functions::FnRiot__Renderer__MaterialRegistry__GetSingletonPtr)();
this->getCharacterPackage = reinterpret_cast<FnGetCharacterPackage>(this->getLeagueModule() + offsets::functions::FnCharacterData__GetCharacterPackage);
this->d3dDevice = *reinterpret_cast<IDirect3DDevice9**>(this->materialRegistry + offsets::MaterialRegistry::D3DDevice);
this->swapChain = *reinterpret_cast<IDXGISwapChain**>(this->materialRegistry + offsets::MaterialRegistry::SwapChain);
}
Expand Down
2 changes: 0 additions & 2 deletions R3nzSkinTFT/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ class Memory {
[[nodiscard]] inline auto getRiotWindow() const noexcept { return *reinterpret_cast<HWND*>(this->getLeagueModule() + offsets::global::Riot__g_window); }

using FnMaterialRegistryGetSingletonPtr = std::uintptr_t(__stdcall*)();
using FnGetCharacterPackage = std::uintptr_t(__cdecl*)(std::string&, std::uint32_t);

GameClient* client;
AIBaseCommon* localPlayer;
std::uintptr_t materialRegistry;
IDirect3DDevice9* d3dDevice;
IDXGISwapChain* swapChain;
FnGetCharacterPackage getCharacterPackage;
private:
void update(bool gameClient = true) noexcept;

Expand Down

0 comments on commit a69d613

Please sign in to comment.