#include <iostream>
#include <map>
#include <string>
#include <variant>
#include <optional>
#include <cmath>
class SettingsManager {
public:
using SettingValue = std::variant<int, double, bool, std::string>;
void setSetting(const std::string& key, SettingValue value) {
settings[key] = std::move(value);
}
std::optional<SettingValue> getSetting(const std::string& key) const {
auto it = settings.find(key);
if (it != settings.end()) {
return it->second;
}
return std::nullopt;
}
void applySettings() {
if (auto setting = getSetting("aim_smooth_factor")) {
float factor = std::get<double>(*setting);
factor = std::clamp(factor, 0.0, 1.0); [0, 1]
std::cout << "Aim smoothing factor set to: " << factor << std::endl;
}
if (auto setting = getSetting("com.act_conf_seclect_sync_device")) {
if (std::get<int>(*setting) == 100) {
std::cout << "Device sync setting enabled with value 100." <<
std::endl;
}
}
if (auto setting =
getSetting("Key_act_allow.file_code_unlock_connectInject")) {
std::cout << "Unlock connect inject feature enabled." << std::endl;
}
if (auto setting = getSetting("RDR_aimLockBase64")) {
if (std::get<std::string>(*setting) == "0x7608F0") {
std::cout << "RDR AimLockBase64 setting is applied with address
0x7608F0." << std::endl;
}
}
if (auto setting = getSetting("set")) {
if (std::get<int>(*setting) == 100) {
std::cout << "Setting is configured to 100%." << std::endl;
}
}
if (auto setting = getSetting("on_auto_cws")) {
int cwsValue = std::get<int>(*setting);
if (cwsValue >= 70 && cwsValue <= 100) {
std::cout << "Auto CWS setting is within the valid range: " <<
cwsValue << std::endl;
} else {
std::cout << "Auto CWS setting is out of range." << std::endl;
}
}
if (auto setting = getSetting("uncrack.list")) {
if (std::get<bool>(*setting)) {
std::cout << "Uncrack protection list is enabled." << std::endl;
} else {
std::cout << "Uncrack protection list is disabled." << std::endl;
}
}
}
void displaySettings() const {
std::cout << "Current Settings:" << std::endl;
for (const auto& [key, value] : settings) {
std::cout << "Key: " << key << " -> Value: ";
std::visit([](auto&& val) { std::cout << val << std::endl; }, value);
}
}
double smoothAim(double currentValue, double targetValue, double factor) {
return currentValue + factor * (targetValue - currentValue);
}
private:
std::map<std::string, SettingValue> settings;
};
int main() {
SettingsManager settingsManager;
settingsManager.setSetting("aim_smooth_factor", 0.1);
settingsManager.setSetting("com.act_conf_seclect_sync_device", 100);
settingsManager.setSetting("Key_act_allow.file_code_unlock_connectInject",
"enabled");
settingsManager.setSetting("RDR_aimLockBase64", "0x7608F0");
settingsManager.setSetting("set", 100);
settingsManager.setSetting("on_auto_cws", 85); // Giá trị trong khoảng hợp lệ
settingsManager.applySettings();
settingsManager.displaySettings();
double currentValue = 50.0;
double targetValue = 100.0;
double factor = 0.1;
for (int i = 0; i < 10; ++i) {
currentValue = settingsManager.smoothAim(currentValue, targetValue,
factor);
std::cout << "Smoothed value at step " << i + 1 << ": " << currentValue <<
std::endl;
}
return 0;
}