mirror of
https://github.com/360NENZ/Taiga74164-Akebi-GC.git
synced 2025-09-19 12:16:20 +08:00
@ -1,13 +1,18 @@
|
||||
#include <pch.h>
|
||||
#include "Settings.h"
|
||||
|
||||
#include <cheat-base/render/gui-util.h>
|
||||
#include <cheat-base/render/renderer.h>
|
||||
#include <cheat-base/cheat/CheatManagerBase.h>
|
||||
#include <cheat-base/render/renderer.h>
|
||||
#include <cheat-base/render/gui-util.h>
|
||||
#include <misc/cpp/imgui_stdlib.h>
|
||||
#include <cheat-base/util.h>
|
||||
|
||||
#include "shlwapi.h"
|
||||
#pragma comment(lib, "shlwapi.lib")
|
||||
|
||||
namespace cheat::feature
|
||||
{
|
||||
Settings::Settings() : Feature(),
|
||||
Settings::Settings() : Feature(),
|
||||
NF(f_MenuKey, "Show Cheat Menu Key", "General", Hotkey(VK_F1)),
|
||||
NF(f_HotkeysEnabled, "Hotkeys Enabled", "General", true),
|
||||
NF(f_FontSize, "Font size", "General", 16.0f),
|
||||
@ -16,8 +21,8 @@ namespace cheat::feature
|
||||
NF(f_StatusMove, "Move Status Window", "General::StatusWindow", true),
|
||||
NF(f_StatusShow, "Show Status Window", "General::StatusWindow", true),
|
||||
|
||||
NF(f_InfoMove, "Move Info Window", "General::InfoWindow", true),
|
||||
NF(f_InfoShow, "Show Info Window", "General::InfoWindow", true),
|
||||
NF(f_InfoMove, "Move Info Window", "General::InfoWindow", true),
|
||||
NF(f_InfoShow, "Show Info Window", "General::InfoWindow", true),
|
||||
|
||||
NF(f_FpsMove, "Move FPS Indicator", "General::FPS", false),
|
||||
NF(f_FpsShow, "Show FPS Indicator", "General::FPS", true),
|
||||
@ -25,22 +30,68 @@ namespace cheat::feature
|
||||
NF(f_NotificationsShow, "Show Notifications", "General::Notify", true),
|
||||
NF(f_NotificationsDelay, "Notifications Delay", "General::Notify", 500),
|
||||
|
||||
NF(f_FileLogging, "File Logging", "General::Logging", false),
|
||||
NF(f_FileLogging, "File Logging", "General::Logging", false),
|
||||
NF(f_ConsoleLogging, "Console Logging", "General::Logging", true),
|
||||
|
||||
NF(f_FastExitEnable, "Fast Exit", "General::FastExit", false),
|
||||
NF(f_HotkeyExit, "Hotkeys", "General::FastExit", Hotkey(VK_F12))
|
||||
NF(f_HotkeyExit, "Hotkeys", "General::FastExit", Hotkey(VK_F12)),
|
||||
NFS(f_DefaultTheme, "Theme", "General::Colors", "Default"),
|
||||
themesDir(util::GetCurrentPath() / "themes")
|
||||
|
||||
{
|
||||
{
|
||||
renderer::SetGlobalFontSize(static_cast<float>(f_FontSize));
|
||||
f_HotkeyExit.value().PressedEvent += MY_METHOD_HANDLER(Settings::OnExitKeyPressed);
|
||||
}
|
||||
if (!std::filesystem::exists(themesDir))
|
||||
std::filesystem::create_directory(themesDir);
|
||||
|
||||
const FeatureGUIInfo& Settings::GetGUIInfo() const
|
||||
{
|
||||
static const FeatureGUIInfo info{ "", "Settings", false };
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
bool inited = false;
|
||||
void Settings::Init() {
|
||||
if (this->f_DefaultTheme.value() != "Default" && !inited)
|
||||
{
|
||||
LOG_INFO("Loading theme: %s", themesDir / (f_DefaultTheme.value() + ".json").c_str());
|
||||
if (!std::filesystem::exists(themesDir / (f_DefaultTheme.value() + ".json")))
|
||||
f_DefaultTheme = "Default";
|
||||
else Colors_Import(f_DefaultTheme.value());
|
||||
inited = true;
|
||||
}
|
||||
}
|
||||
|
||||
const FeatureGUIInfo& Settings::GetGUIInfo() const
|
||||
{
|
||||
static const FeatureGUIInfo info{ "", "Settings", false };
|
||||
return info;
|
||||
}
|
||||
|
||||
void Settings::Colors_Export(std::string name)
|
||||
{
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
auto colors = style.Colors;
|
||||
|
||||
nlohmann::json json;
|
||||
for (int i = 0; i < ImGuiCol_COUNT; i++)
|
||||
json[ImGui::GetStyleColorName((ImGuiCol)i)] = { colors[i].x, colors[i].y, colors[i].z, colors[i].w };
|
||||
std::ofstream file(themesDir / (name + ".json"));
|
||||
file << std::setw(4) << json << std::endl;
|
||||
}
|
||||
|
||||
void Settings::Colors_Import(std::string name)
|
||||
{
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
auto colors = style.Colors;
|
||||
nlohmann::json json;
|
||||
std::ifstream file(themesDir / (name + ".json"));
|
||||
file >> json;
|
||||
for (int i = 0; i < ImGuiCol_COUNT; i++)
|
||||
{
|
||||
auto color = json[ImGui::GetStyleColorName((ImGuiCol)i)];
|
||||
colors[i].x = color[0];
|
||||
colors[i].y = color[1];
|
||||
colors[i].z = color[2];
|
||||
colors[i].w = color[3];
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::DrawMain()
|
||||
{
|
||||
@ -103,7 +154,7 @@ namespace cheat::feature
|
||||
ImGui::BeginGroupPanel("Show Notifications");
|
||||
{
|
||||
ConfigWidget(f_NotificationsShow, "Notifications on the bottom-right corner of the window will be displayed.");
|
||||
ConfigWidget(f_NotificationsDelay, 1,1,10000, "Delay in milliseconds between notifications.");
|
||||
ConfigWidget(f_NotificationsDelay, 1, 1, 10000, "Delay in milliseconds between notifications.");
|
||||
}
|
||||
ImGui::EndGroupPanel();
|
||||
|
||||
@ -123,13 +174,36 @@ namespace cheat::feature
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::EndGroupPanel();
|
||||
|
||||
ImGui::BeginGroupPanel("Colors");
|
||||
{
|
||||
static std::string nameBuffer_;
|
||||
ImGui::InputText("Name", &nameBuffer_);
|
||||
if (std::filesystem::exists(themesDir / (nameBuffer_ + ".json")))
|
||||
{
|
||||
if (this->f_DefaultTheme.value() != nameBuffer_)
|
||||
if (ImGui::Button("Set as default"))
|
||||
f_DefaultTheme = nameBuffer_;
|
||||
if (ImGui::Button("Load"))
|
||||
{
|
||||
Colors_Import(nameBuffer_);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::Text("Theme does not exist.");
|
||||
}
|
||||
if (ImGui::Button("Save"))
|
||||
Colors_Export(nameBuffer_);
|
||||
}
|
||||
ImGui::EndGroupPanel();
|
||||
}
|
||||
|
||||
Settings& Settings::GetInstance()
|
||||
{
|
||||
static Settings instance;
|
||||
return instance;
|
||||
}
|
||||
Settings& Settings::GetInstance()
|
||||
{
|
||||
static Settings instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void Settings::OnExitKeyPressed()
|
||||
{
|
||||
@ -139,4 +213,3 @@ namespace cheat::feature
|
||||
ExitProcess(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ namespace cheat::feature
|
||||
{
|
||||
|
||||
class Settings : public Feature
|
||||
{
|
||||
{
|
||||
public:
|
||||
config::Field<Hotkey> f_MenuKey;
|
||||
config::Field<bool> f_HotkeysEnabled;
|
||||
@ -31,10 +31,16 @@ namespace cheat::feature
|
||||
config::Field<bool> f_FastExitEnable;
|
||||
config::Field<Hotkey> f_HotkeyExit;
|
||||
|
||||
std::filesystem::path themesDir;
|
||||
config::Field<std::string> f_DefaultTheme;
|
||||
|
||||
static Settings& GetInstance();
|
||||
|
||||
const FeatureGUIInfo& GetGUIInfo() const override;
|
||||
void DrawMain() override;
|
||||
void Init();
|
||||
void Colors_Export(std::string name);
|
||||
void Colors_Import(std::string name);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <cheat-base/render/backend/dx12-hook.h>
|
||||
|
||||
#include <cheat-base/ResourceLoader.h>
|
||||
#include <cheat-base/cheat/misc/Settings.h>
|
||||
|
||||
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
@ -33,7 +34,7 @@ namespace renderer
|
||||
static constexpr int _fontsCount = _fontSizeMax / _fontSizeStep;
|
||||
static std::array<ImFont*, _fontsCount> _fonts;
|
||||
|
||||
static Data _customFontData {};
|
||||
static Data _customFontData{};
|
||||
|
||||
static WNDPROC OriginalWndProcHandler;
|
||||
static ID3D11RenderTargetView* mainRenderTargetView;
|
||||
@ -253,6 +254,9 @@ namespace renderer
|
||||
|
||||
pContext->OMSetRenderTargets(1, &mainRenderTargetView, nullptr);
|
||||
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
||||
|
||||
auto& themes = cheat::feature::Settings::GetInstance();
|
||||
themes.Init();
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK hWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
|
@ -13,25 +13,25 @@ namespace cheat::feature
|
||||
{
|
||||
static void LCAbilityElement_ReduceModifierDurability_Hook(app::LCAbilityElement* __this, int32_t modifierDurabilityIndex, float reduceDurability, app::Nullable_1_Single_ deltaTime, MethodInfo* method);
|
||||
|
||||
AutoDestroy::AutoDestroy() : Feature(),
|
||||
NF(f_Enabled, "Auto Destroy", "AutoDestroy", false),
|
||||
NF(f_DestroyOres, "Destroy Ores", "AutoDestroy", false),
|
||||
NF(f_DestroyShields, "Destroy Shields", "AutoDestroy", false),
|
||||
NF(f_DestroyDoodads, "Destroy Doodads", "AutoDestroy", false),
|
||||
NF(f_DestroyPlants, "Destroy Plants", "AutoDestroy", false),
|
||||
NF(f_Range, "Range", "AutoDestroy", 10.0f)
|
||||
{
|
||||
AutoDestroy::AutoDestroy() : Feature(),
|
||||
NF(f_Enabled, "Auto Destroy", "AutoDestroy", false),
|
||||
NF(f_DestroyOres, "Destroy Ores", "AutoDestroy", false),
|
||||
NF(f_DestroyShields, "Destroy Shields", "AutoDestroy", false),
|
||||
NF(f_DestroyDoodads, "Destroy Doodads", "AutoDestroy", false),
|
||||
NF(f_DestroyPlants, "Destroy Plants", "AutoDestroy", false),
|
||||
NF(f_Range, "Range", "AutoDestroy", 10.0f)
|
||||
{
|
||||
HookManager::install(app::MoleMole_LCAbilityElement_ReduceModifierDurability, LCAbilityElement_ReduceModifierDurability_Hook);
|
||||
}
|
||||
|
||||
const FeatureGUIInfo& AutoDestroy::GetGUIInfo() const
|
||||
{
|
||||
static const FeatureGUIInfo info { "Auto Destroy Objects", "World", true };
|
||||
return info;
|
||||
}
|
||||
const FeatureGUIInfo& AutoDestroy::GetGUIInfo() const
|
||||
{
|
||||
static const FeatureGUIInfo info{ "Auto Destroy Objects", "World", true };
|
||||
return info;
|
||||
}
|
||||
|
||||
void AutoDestroy::DrawMain()
|
||||
{
|
||||
void AutoDestroy::DrawMain()
|
||||
{
|
||||
ImGui::TextColored(ImColor(255, 165, 0, 255), "Note. This feature is not fully tested detection-wise.\n"
|
||||
"Not recommended for main accounts or used with high values.");
|
||||
|
||||
@ -47,15 +47,15 @@ namespace cheat::feature
|
||||
ConfigWidget("Plants", f_DestroyPlants, "Dandelion Seeds, Sakura Bloom, etc.");
|
||||
ImGui::Unindent();
|
||||
ConfigWidget("Range (m)", f_Range, 0.1f, 1.0f, 15.0f);
|
||||
}
|
||||
}
|
||||
|
||||
bool AutoDestroy::NeedStatusDraw() const
|
||||
bool AutoDestroy::NeedStatusDraw() const
|
||||
{
|
||||
return f_Enabled;
|
||||
}
|
||||
return f_Enabled;
|
||||
}
|
||||
|
||||
void AutoDestroy::DrawStatus()
|
||||
{
|
||||
void AutoDestroy::DrawStatus()
|
||||
{
|
||||
ImGui::Text("Destroy [%.01fm%s%s%s%s%s]",
|
||||
f_Range.value(),
|
||||
f_DestroyOres || f_DestroyShields || f_DestroyDoodads || f_DestroyPlants ? "|" : "",
|
||||
@ -63,13 +63,13 @@ namespace cheat::feature
|
||||
f_DestroyShields ? "S" : "",
|
||||
f_DestroyDoodads ? "D" : "",
|
||||
f_DestroyPlants ? "P" : "");
|
||||
}
|
||||
}
|
||||
|
||||
AutoDestroy& AutoDestroy::GetInstance()
|
||||
{
|
||||
static AutoDestroy instance;
|
||||
return instance;
|
||||
}
|
||||
AutoDestroy& AutoDestroy::GetInstance()
|
||||
{
|
||||
static AutoDestroy instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
// Thanks to @RyujinZX
|
||||
// Every ore has ability element component
|
||||
@ -88,12 +88,11 @@ namespace cheat::feature
|
||||
(autoDestroy.f_DestroyOres && game::filters::combined::Ores.IsValid(manager.entity(entity))) ||
|
||||
(autoDestroy.f_DestroyDoodads && (game::filters::combined::Doodads.IsValid(manager.entity(entity)) || game::filters::chest::SBramble.IsValid(manager.entity(entity)))) ||
|
||||
(autoDestroy.f_DestroyShields && !game::filters::combined::MonsterBosses.IsValid(manager.entity(entity)) && (
|
||||
game::filters::combined::MonsterShielded.IsValid(manager.entity(entity)) || // For shields attached to monsters, e.g. abyss mage shields.
|
||||
game::filters::combined::MonsterEquips.IsValid(manager.entity(entity)) || // For shields/weapons equipped by monsters, e.g. rock shield.
|
||||
(autoDestroy.f_DestroyPlants && game::filters::combined::PlantDestroy.IsValid(manager.entity(entity))) // For plants e.g dandelion seeds.
|
||||
))
|
||||
game::filters::combined::MonsterShielded.IsValid(manager.entity(entity)) || // For shields attached to monsters, e.g. abyss mage shields.
|
||||
game::filters::combined::MonsterEquips.IsValid(manager.entity(entity)))) || // For shields/weapons equipped by monsters, e.g. rock shield.
|
||||
(autoDestroy.f_DestroyPlants && game::filters::combined::PlantDestroy.IsValid(manager.entity(entity))) // For plants e.g dandelion seeds.
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
// This value always above any ore durability
|
||||
reduceDurability = 1000;
|
||||
|
Reference in New Issue
Block a user