From 088fc1c7cd215909e5a9901967dac8d96a76477b Mon Sep 17 00:00:00 2001 From: Azrub Date: Wed, 8 Oct 2025 17:40:30 +0200 Subject: [PATCH] Release v1.6.0.0 New Features: - Added "Remove and Respawn" button - Added "Respawn" and "Remove and Respawn" buttons to Templates tab for quick access - Added "Always Load Last Settings" option - automatically saves and restores your last used settings on startup UI Improvements: - Improved button spacing and layout consistency --- GolemHelper/Common/Types.h | 1 + GolemHelper/Config/ConfigManager.cpp | 108 ++++++++++++++++++++++-- GolemHelper/Config/ConfigManager.h | 2 + GolemHelper/GolemHelper.cpp | 9 +- GolemHelper/UI/UIManager.cpp | 121 +++++++++++++++++++++++---- 5 files changed, 215 insertions(+), 26 deletions(-) diff --git a/GolemHelper/Common/Types.h b/GolemHelper/Common/Types.h index 6068d95..8a2a9b1 100644 --- a/GolemHelper/Common/Types.h +++ b/GolemHelper/Common/Types.h @@ -146,6 +146,7 @@ struct GolemHelperState { bool skipAegis = false; bool alwaysHideIcon = false; bool autoShowHideUI = false; + bool alwaysLoadLastSettings = false; int debugCounter = 0; int initialDelay = 390; diff --git a/GolemHelper/Config/ConfigManager.cpp b/GolemHelper/Config/ConfigManager.cpp index 66f4092..dc6268b 100644 --- a/GolemHelper/Config/ConfigManager.cpp +++ b/GolemHelper/Config/ConfigManager.cpp @@ -23,14 +23,16 @@ void ConfigManager::SaveCustomDelaySettings() { configFile << "stepDelay=" << g_state.stepDelay << std::endl; configFile << "alwaysHideIcon=" << (g_state.alwaysHideIcon ? "1" : "0") << std::endl; configFile << "autoShowHideUI=" << (g_state.autoShowHideUI ? "1" : "0") << std::endl; + configFile << "alwaysLoadLastSettings=" << (g_state.alwaysLoadLastSettings ? "1" : "0") << std::endl; configFile.close(); - char logBuffer[350]; - sprintf_s(logBuffer, "Settings saved: initialDelay=%dms, stepDelay=%dms, alwaysHideIcon=%s, autoShowHideUI=%s", + char logBuffer[512]; + sprintf_s(logBuffer, "Settings saved: initialDelay=%dms, stepDelay=%dms, alwaysHideIcon=%s, autoShowHideUI=%s, alwaysLoadLastSettings=%s", g_state.initialDelay, g_state.stepDelay, g_state.alwaysHideIcon ? "true" : "false", - g_state.autoShowHideUI ? "true" : "false"); + g_state.autoShowHideUI ? "true" : "false", + g_state.alwaysLoadLastSettings ? "true" : "false"); g_api->Log(ELogLevel_INFO, "GolemHelper", logBuffer); } @@ -79,19 +81,113 @@ void ConfigManager::LoadCustomDelaySettings() { else if (key == "autoShowHideUI") { g_state.autoShowHideUI = (value == "1"); } + else if (key == "alwaysLoadLastSettings") { + g_state.alwaysLoadLastSettings = (value == "1"); + } } configFile.close(); - char logBuffer[350]; - sprintf_s(logBuffer, "Settings loaded: initialDelay=%dms, stepDelay=%dms, alwaysHideIcon=%s, autoShowHideUI=%s", + char logBuffer[512]; + sprintf_s(logBuffer, "Settings loaded: initialDelay=%dms, stepDelay=%dms, alwaysHideIcon=%s, autoShowHideUI=%s, alwaysLoadLastSettings=%s", g_state.initialDelay, g_state.stepDelay, g_state.alwaysHideIcon ? "true" : "false", - g_state.autoShowHideUI ? "true" : "false"); + g_state.autoShowHideUI ? "true" : "false", + g_state.alwaysLoadLastSettings ? "true" : "false"); g_api->Log(ELogLevel_INFO, "GolemHelper", logBuffer); } catch (...) { g_api->Log(ELogLevel_INFO, "GolemHelper", "Could not load config file, using defaults"); } +} + +void ConfigManager::SaveLastUsedSettings() { + if (!g_api) return; + + std::string addonPath = g_api->Paths.GetAddonDirectory("GolemHelper"); + std::string settingsPath = addonPath + "\\last_settings.ini"; + + try { + std::ofstream settingsFile(settingsPath); + if (!settingsFile.is_open()) { + g_api->Log(ELogLevel_WARNING, "GolemHelper", "Could not create last settings file"); + return; + } + + settingsFile << "[LastUsedSettings]" << std::endl; + settingsFile << "isQuickDps=" << (g_state.isQuickDps ? "1" : "0") << std::endl; + settingsFile << "isAlacDps=" << (g_state.isAlacDps ? "1" : "0") << std::endl; + settingsFile << "showBoonAdvanced=" << (g_state.showBoonAdvanced ? "1" : "0") << std::endl; + settingsFile << "environmentDamage=" << (g_state.environmentDamage ? "1" : "0") << std::endl; + settingsFile << "envDamageLevel=" << static_cast(g_state.envDamageLevel) << std::endl; + settingsFile << "skipBurning=" << (g_state.skipBurning ? "1" : "0") << std::endl; + settingsFile << "showAdvanced=" << (g_state.showAdvanced ? "1" : "0") << std::endl; + settingsFile << "skipConfusion=" << (g_state.skipConfusion ? "1" : "0") << std::endl; + settingsFile << "skipSlow=" << (g_state.skipSlow ? "1" : "0") << std::endl; + settingsFile << "addImmobilize=" << (g_state.addImmobilize ? "1" : "0") << std::endl; + settingsFile << "addBlind=" << (g_state.addBlind ? "1" : "0") << std::endl; + settingsFile << "fiveBleedingStacks=" << (g_state.fiveBleedingStacks ? "1" : "0") << std::endl; + settingsFile << "hitboxType=" << static_cast(g_state.hitboxType) << std::endl; + settingsFile << "addResistance=" << (g_state.addResistance ? "1" : "0") << std::endl; + settingsFile << "addStability=" << (g_state.addStability ? "1" : "0") << std::endl; + settingsFile << "skipAegis=" << (g_state.skipAegis ? "1" : "0") << std::endl; + + settingsFile.close(); + g_api->Log(ELogLevel_INFO, "GolemHelper", "Last used settings saved"); + + } + catch (...) { + g_api->Log(ELogLevel_WARNING, "GolemHelper", "Failed to save last settings file"); + } +} + +void ConfigManager::LoadLastUsedSettings() { + if (!g_api) return; + + std::string addonPath = g_api->Paths.GetAddonDirectory("GolemHelper"); + std::string settingsPath = addonPath + "\\last_settings.ini"; + + try { + std::ifstream settingsFile(settingsPath); + if (!settingsFile.is_open()) { + g_api->Log(ELogLevel_INFO, "GolemHelper", "No last settings file found"); + return; + } + + std::string line; + while (std::getline(settingsFile, line)) { + if (line.empty() || line[0] == '[') continue; + + size_t equalPos = line.find('='); + if (equalPos == std::string::npos) continue; + + std::string key = line.substr(0, equalPos); + std::string value = line.substr(equalPos + 1); + + if (key == "isQuickDps") g_state.isQuickDps = (value == "1"); + else if (key == "isAlacDps") g_state.isAlacDps = (value == "1"); + else if (key == "showBoonAdvanced") g_state.showBoonAdvanced = (value == "1"); + else if (key == "environmentDamage") g_state.environmentDamage = (value == "1"); + else if (key == "envDamageLevel") g_state.envDamageLevel = static_cast(std::stoi(value)); + else if (key == "showAdvanced") g_state.showAdvanced = (value == "1"); + else if (key == "skipBurning") g_state.skipBurning = (value == "1"); + else if (key == "skipConfusion") g_state.skipConfusion = (value == "1"); + else if (key == "skipSlow") g_state.skipSlow = (value == "1"); + else if (key == "addImmobilize") g_state.addImmobilize = (value == "1"); + else if (key == "addBlind") g_state.addBlind = (value == "1"); + else if (key == "fiveBleedingStacks") g_state.fiveBleedingStacks = (value == "1"); + else if (key == "hitboxType") g_state.hitboxType = static_cast(std::stoi(value)); + else if (key == "addResistance") g_state.addResistance = (value == "1"); + else if (key == "addStability") g_state.addStability = (value == "1"); + else if (key == "skipAegis") g_state.skipAegis = (value == "1"); + } + + settingsFile.close(); + g_api->Log(ELogLevel_INFO, "GolemHelper", "Last used settings loaded"); + + } + catch (...) { + g_api->Log(ELogLevel_INFO, "GolemHelper", "Could not load last settings file"); + } } \ No newline at end of file diff --git a/GolemHelper/Config/ConfigManager.h b/GolemHelper/Config/ConfigManager.h index 585e33a..e1eb57e 100644 --- a/GolemHelper/Config/ConfigManager.h +++ b/GolemHelper/Config/ConfigManager.h @@ -4,4 +4,6 @@ class ConfigManager { public: static void SaveCustomDelaySettings(); static void LoadCustomDelaySettings(); + static void SaveLastUsedSettings(); + static void LoadLastUsedSettings(); }; \ No newline at end of file diff --git a/GolemHelper/GolemHelper.cpp b/GolemHelper/GolemHelper.cpp index a75f73e..ba247d3 100644 --- a/GolemHelper/GolemHelper.cpp +++ b/GolemHelper/GolemHelper.cpp @@ -23,6 +23,11 @@ void Load(AddonAPI* aApi) { ConfigManager::LoadCustomDelaySettings(); TemplateManager::LoadTemplates(); + + if (g_state.alwaysLoadLastSettings) { + ConfigManager::LoadLastUsedSettings(); + } + FileUtils::CopyResourceIcons(); g_api->Renderer.Register(ERenderType_Render, UIManager::RenderUI); @@ -35,7 +40,7 @@ void Load(AddonAPI* aApi) { MapUtils::UpdateQuickAccessVisibility(); - g_api->Log(ELogLevel_INFO, "GolemHelper", "=== GolemHelper v1.5.3.0 Loaded ==="); + g_api->Log(ELogLevel_INFO, "GolemHelper", "=== GolemHelper v1.6.0.0 Loaded ==="); g_api->Log(ELogLevel_INFO, "GolemHelper", "GolemHelper addon loaded successfully!"); } @@ -62,7 +67,7 @@ extern "C" __declspec(dllexport) AddonDefinition* GetAddonDef() { def.Signature = -424248; def.APIVersion = NEXUS_API_VERSION; def.Name = "GolemHelper"; - def.Version = { 1, 5, 3, 0 }; + def.Version = { 1, 6, 0, 0 }; def.Author = "Azrub"; def.Description = "Automates the process of setting optimal boon and golem configurations in the training area"; def.Load = Load; diff --git a/GolemHelper/UI/UIManager.cpp b/GolemHelper/UI/UIManager.cpp index 278250a..93d9df1 100644 --- a/GolemHelper/UI/UIManager.cpp +++ b/GolemHelper/UI/UIManager.cpp @@ -17,7 +17,7 @@ void UIManager::RenderUI() { if (ImGui::Begin("GolemHelper", &g_state.showUI, ImGuiWindowFlags_AlwaysAutoResize)) { - ImGui::TextColored(ImVec4(0.2f, 0.8f, 1.0f, 1.0f), "GolemHelper v1.5.3.0"); + ImGui::TextColored(ImVec4(0.2f, 0.8f, 1.0f, 1.0f), "GolemHelper v1.6.0.0"); ImGui::Separator(); if (ImGui::BeginTabBar("GolemHelperTabs", ImGuiTabBarFlags_None)) { @@ -82,7 +82,7 @@ void UIManager::RenderUI() { void UIManager::RenderSettingsTab() { ImGui::Text("Boon Configuration"); - if (ImGui::Button("Apply Boons", ImVec2(150, 0))) { + if (ImGui::Button("Apply Boons", ImVec2(130, 0))) { if (g_state.enabled && MapUtils::IsInTrainingArea()) { g_api->InputBinds.Invoke("GolemHelper.ApplyBoons", false); } @@ -162,17 +162,20 @@ void UIManager::RenderSettingsTab() { ImGui::Text("Golem Configuration"); - if (ImGui::Button("Spawn Golem", ImVec2(120, 0))) { + if (ImGui::Button("Spawn Golem", ImVec2(110, 0))) { if (g_state.enabled && MapUtils::IsInTrainingArea()) { g_api->InputBinds.Invoke("GolemHelper.SpawnGolem", false); } } - ImGui::SameLine(); + ImGui::SameLine(0, 5); if (ImGui::Button("Respawn", ImVec2(80, 0))) { if (g_state.enabled && MapUtils::IsInTrainingArea()) { g_api->InputBinds.Invoke("GolemHelper.RespawnGolem", false); } } + + ImGui::Spacing(); + if (ImGui::Button("Remove and Respawn", ImVec2(150, 0))) { if (g_state.enabled && MapUtils::IsInTrainingArea()) { g_api->InputBinds.Invoke("GolemHelper.RemoveAndRespawnGolem", false); @@ -238,22 +241,22 @@ void UIManager::RenderSettingsTab() { int oldInitialDelay = g_state.initialDelay; ImGui::Text("Initial Delay (after F key):"); - ImGui::SetNextItemWidth(205); + ImGui::SetNextItemWidth(200); ImGui::SliderInt("##initial", &g_state.initialDelay, 100, 1000, "%d ms"); ImGui::Text("Step Delay (between clicks):"); - ImGui::SetNextItemWidth(205); + ImGui::SetNextItemWidth(200); ImGui::SliderInt("##step", &g_state.stepDelay, 100, 1000, "%d ms"); ImGui::Spacing(); - if (ImGui::Button("Reset to Default", ImVec2(120, 0))) { + if (ImGui::Button("Reset to Default", ImVec2(117, 0))) { g_state.stepDelay = 290; g_state.initialDelay = 390; ConfigManager::SaveCustomDelaySettings(); } - ImGui::SameLine(); - if (ImGui::Button("Slow Mode", ImVec2(80, 0))) { + ImGui::SameLine(0, 5); + if (ImGui::Button("Slow Mode", ImVec2(78, 0))) { g_state.stepDelay = 1000; g_state.initialDelay = 600; ConfigManager::SaveCustomDelaySettings(); @@ -267,24 +270,97 @@ void UIManager::RenderSettingsTab() { } } ImGui::PopStyleColor(2); + + if (g_state.alwaysLoadLastSettings) { + static bool lastIsQuickDps = g_state.isQuickDps; + static bool lastIsAlacDps = g_state.isAlacDps; + static bool lastEnvironmentDamage = g_state.environmentDamage; + static EnvironmentDamageLevel lastEnvDamageLevel = g_state.envDamageLevel; + static bool lastSkipBurning = g_state.skipBurning; + static bool lastSkipConfusion = g_state.skipConfusion; + static bool lastSkipSlow = g_state.skipSlow; + static bool lastAddImmobilize = g_state.addImmobilize; + static bool lastAddBlind = g_state.addBlind; + static bool lastFiveBleedingStacks = g_state.fiveBleedingStacks; + static HitboxType lastHitboxType = g_state.hitboxType; + static bool lastAddResistance = g_state.addResistance; + static bool lastAddStability = g_state.addStability; + static bool lastSkipAegis = g_state.skipAegis; + static bool lastShowBoonAdvanced = g_state.showBoonAdvanced; + static bool lastShowAdvanced = g_state.showAdvanced; + + if (lastIsQuickDps != g_state.isQuickDps || + lastIsAlacDps != g_state.isAlacDps || + lastEnvironmentDamage != g_state.environmentDamage || + lastEnvDamageLevel != g_state.envDamageLevel || + lastSkipBurning != g_state.skipBurning || + lastSkipConfusion != g_state.skipConfusion || + lastSkipSlow != g_state.skipSlow || + lastAddImmobilize != g_state.addImmobilize || + lastAddBlind != g_state.addBlind || + lastFiveBleedingStacks != g_state.fiveBleedingStacks || + lastHitboxType != g_state.hitboxType || + lastAddResistance != g_state.addResistance || + lastAddStability != g_state.addStability || + lastSkipAegis != g_state.skipAegis || + lastShowBoonAdvanced != g_state.showBoonAdvanced || + lastShowAdvanced != g_state.showAdvanced) { + + ConfigManager::SaveLastUsedSettings(); + + lastIsQuickDps = g_state.isQuickDps; + lastIsAlacDps = g_state.isAlacDps; + lastEnvironmentDamage = g_state.environmentDamage; + lastEnvDamageLevel = g_state.envDamageLevel; + lastSkipBurning = g_state.skipBurning; + lastSkipConfusion = g_state.skipConfusion; + lastSkipSlow = g_state.skipSlow; + lastAddImmobilize = g_state.addImmobilize; + lastAddBlind = g_state.addBlind; + lastFiveBleedingStacks = g_state.fiveBleedingStacks; + lastHitboxType = g_state.hitboxType; + lastAddResistance = g_state.addResistance; + lastAddStability = g_state.addStability; + lastSkipAegis = g_state.skipAegis; + lastShowBoonAdvanced = g_state.showBoonAdvanced; + lastShowAdvanced = g_state.showAdvanced; + } + } } void UIManager::RenderTemplatesTab() { - if (ImGui::Button("Apply Boons", ImVec2(120, 30))) { + ImGui::Spacing(); + + if (ImGui::Button("Apply Boons", ImVec2(110, 0))) { if (g_state.enabled && MapUtils::IsInTrainingArea()) { g_api->InputBinds.Invoke("GolemHelper.ApplyBoons", false); } } - ImGui::SameLine(); - - if (ImGui::Button("Spawn Golem", ImVec2(120, 30))) { + ImGui::SameLine(0, 5); + if (ImGui::Button("Spawn Golem", ImVec2(110, 0))) { if (g_state.enabled && MapUtils::IsInTrainingArea()) { g_api->InputBinds.Invoke("GolemHelper.SpawnGolem", false); } } + ImGui::Spacing(); + + if (ImGui::Button("Respawn", ImVec2(110, 0))) { + if (g_state.enabled && MapUtils::IsInTrainingArea()) { + g_api->InputBinds.Invoke("GolemHelper.RespawnGolem", false); + } + } + ImGui::SameLine(0, 5); + if (ImGui::Button("Remove and Respawn", ImVec2(150, 0))) { + if (g_state.enabled && MapUtils::IsInTrainingArea()) { + g_api->InputBinds.Invoke("GolemHelper.RemoveAndRespawnGolem", false); + } + } + + ImGui::Spacing(); ImGui::Spacing(); ImGui::Separator(); + ImGui::Spacing(); ImGui::Text("Template Management"); ImGui::Separator(); @@ -292,7 +368,7 @@ void UIManager::RenderTemplatesTab() { ImGui::Text("Save Current Settings:"); ImGui::SetNextItemWidth(170); ImGui::InputText("##templateName", g_state.newTemplateName, sizeof(g_state.newTemplateName)); - ImGui::SameLine(); + ImGui::SameLine(0, 5); if (ImGui::Button("Save", ImVec2(50, 0))) { if (strlen(g_state.newTemplateName) > 0) { @@ -336,14 +412,14 @@ void UIManager::RenderTemplatesTab() { g_state.lastUserTemplateIndex = userTemplateIndices[currentUserIndex]; } - ImGui::SameLine(); + ImGui::SameLine(0, 5); if (ImGui::Button("Load", ImVec2(50, 0))) { if (currentUserIndex >= 0 && currentUserIndex < userTemplateIndices.size()) { TemplateManager::LoadTemplate(userTemplateIndices[currentUserIndex]); } } - ImGui::SameLine(); + ImGui::SameLine(0, 5); if (ImGui::Button("Del", ImVec2(50, 0))) { if (currentUserIndex >= 0 && currentUserIndex < userTemplateIndices.size()) { TemplateManager::DeleteTemplate(userTemplateIndices[currentUserIndex]); @@ -459,10 +535,12 @@ void UIManager::RenderTemplatesTab() { TemplateManager::LoadTemplate(templateIndex); g_state.selectedTemplateIndex = -1; } - if (i < 2) ImGui::SameLine(); + if (i < 2) ImGui::SameLine(0, 5);; } } + ImGui::Spacing(); + for (int i = 3; i < 5; i++) { const std::string& name = defaultNames[i]; int templateIndex = -1; @@ -478,7 +556,7 @@ void UIManager::RenderTemplatesTab() { TemplateManager::LoadTemplate(templateIndex); g_state.selectedTemplateIndex = -1; } - if (i == 3) ImGui::SameLine(); + if (i == 3) ImGui::SameLine(0, 5);; } } } @@ -502,5 +580,12 @@ void UIManager::RenderOptions() { ConfigManager::SaveCustomDelaySettings(); } + bool oldAlwaysLoadLastSettings = g_state.alwaysLoadLastSettings; + ImGui::Checkbox("Always Load Last Settings", &g_state.alwaysLoadLastSettings); + + if (oldAlwaysLoadLastSettings != g_state.alwaysLoadLastSettings) { + ConfigManager::SaveCustomDelaySettings(); + } + ImGui::Checkbox("Enable debug mode", &g_state.debugMode); } \ No newline at end of file