From 98c51aa098cc73787e7833d315970c5ed99b0fe8 Mon Sep 17 00:00:00 2001 From: Azrub Date: Fri, 8 Aug 2025 03:56:11 +0200 Subject: [PATCH] Release v1.5.1.0 New Features: - Auto Show/Hide UI: New setting that automatically shows/hides the UI when entering/exiting Training Area Technical Changes: Architecture refactor; replaced coordinate arrays and magic numbers with enum-based system: - NEW: MenuSequences.h - Centralized sequence definitions with clean logic - REFACTORED: Types.h - Semantic enum structure mapping GW2 interface 1:1 (BOON_ALACRITY vs stepIndex == 13) - REFACTORED: AutomationLogic.cpp - Eliminated all magic numbers, unified healer logic - Improved maintainability - Enhanced readability: Self-documenting code with meaningful names like GOLEM_SLOW instead of array indices --- GolemHelper/Automation/AutomationLogic.cpp | 177 ++++++++++++++------- GolemHelper/Automation/AutomationLogic.h | 4 +- GolemHelper/Common/MenuSequences.h | 73 +++++++++ GolemHelper/Common/Types.h | 170 +++++++++++++++----- GolemHelper/Config/ConfigManager.cpp | 20 ++- GolemHelper/GolemHelper.cpp | 4 +- GolemHelper/GolemHelper.vcxproj | 1 + GolemHelper/GolemHelper.vcxproj.filters | 3 + GolemHelper/Input/KeybindManager.cpp | 8 +- GolemHelper/UI/UIManager.cpp | 81 +--------- GolemHelper/Utils/MapUtils.cpp | 14 ++ 11 files changed, 375 insertions(+), 180 deletions(-) create mode 100644 GolemHelper/Common/MenuSequences.h diff --git a/GolemHelper/Automation/AutomationLogic.cpp b/GolemHelper/Automation/AutomationLogic.cpp index e9381e3..4c4d49d 100644 --- a/GolemHelper/Automation/AutomationLogic.cpp +++ b/GolemHelper/Automation/AutomationLogic.cpp @@ -2,18 +2,21 @@ #include #include "AutomationLogic.h" #include "../Common/Globals.h" +#include "../Common/MenuSequences.h" #include "CoordinateUtils.h" bool AutomationLogic::ShouldSkipBoonStep(int stepIndex) { - if (g_state.isQuickDps && stepIndex == 14) { + MenuOption step = MenuSequences::BOON_SEQUENCE[stepIndex]; + + if (g_state.isQuickDps && step == BOON_QUICKNESS) { return true; } - if (g_state.isAlacDps && (stepIndex == 13 || stepIndex == 18)) { + if (g_state.isAlacDps && step == BOON_ALACRITY) { return true; } - if (g_state.showBoonAdvanced && g_state.skipAegis && stepIndex == 10) { + if (g_state.showBoonAdvanced && g_state.skipAegis && step == BOON_AEGIS) { return true; } @@ -25,15 +28,17 @@ bool AutomationLogic::ShouldSkipGolemStep(int stepIndex) { return false; } - if (g_state.skipBurning && stepIndex == 7) { + MenuOption step = MenuSequences::GOLEM_SEQUENCE[stepIndex]; + + if (g_state.skipBurning && step == GOLEM_BURNING) { return true; } - if (g_state.skipConfusion && stepIndex == 8) { + if (g_state.skipConfusion && step == GOLEM_CONFUSION) { return true; } - if (g_state.skipSlow && stepIndex == 17) { + if (g_state.skipSlow && step == GOLEM_SLOW) { return true; } @@ -50,10 +55,10 @@ void AutomationLogic::ApplyHealerBoons() { std::string mode = "Healer Bench - "; if (g_state.isQuickDps) { - mode += "Quick DPS (Healer provides Alacrity)"; + mode += "Quick DPS"; } else if (g_state.isAlacDps) { - mode += "Alac DPS (Healer provides Quickness)"; + mode += "Alac DPS"; } mode += " + Environment "; @@ -71,27 +76,47 @@ void AutomationLogic::ApplyHealerBoons() { g_api->GameBinds.InvokeAsync(EGameBinds_MiscInteract, 50); Sleep(g_state.initialDelay); - if (g_state.isQuickDps) { - for (int i = 0; i < 10; i++) { - CoordinateUtils::ClickAtScaled(g_coords.healerStepX[i], g_coords.healerStepY[i], g_state.stepDelay); + bool alacrityCounted = false; + for (int i = 0; i < MenuSequences::HEALER_QUICK_LENGTH; i++) { + MenuOption step = MenuSequences::HEALER_QUICK_SEQUENCE[i]; + + if (g_state.isAlacDps && step == BOON_ALACRITY) { + if (!alacrityCounted) { + auto quicknessCoord = g_coords.coords.find(BOON_QUICKNESS); + if (quicknessCoord != g_coords.coords.end()) { + CoordinateUtils::ClickAtScaled( + quicknessCoord->second.first, + quicknessCoord->second.second, + g_state.stepDelay + ); + } + alacrityCounted = true; + } + continue; } - } - else if (g_state.isAlacDps) { - int alacStepY[9] = { 262, 352, 352, 305, 500, 450, 450, 305, 262 }; - for (int i = 0; i < 9; i++) { - CoordinateUtils::ClickAtScaled(830, alacStepY[i], g_state.stepDelay); + + auto coordIt = g_coords.coords.find(step); + if (coordIt != g_coords.coords.end()) { + CoordinateUtils::ClickAtScaled( + coordIt->second.first, + coordIt->second.second, + g_state.stepDelay + ); } } - int finalY; + MenuOption envDamageOption; switch (g_state.envDamageLevel) { - case ENV_MILD: finalY = 352; break; - case ENV_MODERATE: finalY = 305; break; - case ENV_EXTREME: finalY = 262; break; - default: finalY = 352; break; + case ENV_MILD: envDamageOption = BOON_ENV_MILD; break; + case ENV_MODERATE: envDamageOption = BOON_ENV_MODERATE; break; + case ENV_EXTREME: envDamageOption = BOON_ENV_EXTREME; break; + default: envDamageOption = BOON_ENV_MILD; break; } - CoordinateUtils::ClickAtScaled(830, finalY, 50); + auto envCoord = g_coords.coords.find(envDamageOption); + if (envCoord != g_coords.coords.end()) { + CoordinateUtils::ClickAtScaled(envCoord->second.first, envCoord->second.second, 50); + } } catch (...) { g_api->Log(ELogLevel_WARNING, "GolemHelper", "Exception during healer boon sequence"); @@ -104,7 +129,7 @@ void AutomationLogic::ApplyHealerBoons() { g_api->Log(ELogLevel_INFO, "GolemHelper", "Healer boon sequence completed!"); } -void AutomationLogic::ApplyAllBoons() { +void AutomationLogic::ApplyBoons() { if (!g_api || !g_state.enabled) return; if (g_state.environmentDamage) { @@ -142,31 +167,54 @@ void AutomationLogic::ApplyAllBoons() { g_api->GameBinds.InvokeAsync(EGameBinds_MiscInteract, 50); Sleep(g_state.initialDelay); - for (int i = 0; i < 20; i++) { - if (g_coords.boonStepX[i] == 0 && g_coords.boonStepY[i] == 0) { + for (int i = 0; i < MenuSequences::BOON_LENGTH; i++) { + int stepIndex = i; + MenuOption step = MenuSequences::BOON_SEQUENCE[i]; + auto coordIt = g_coords.coords.find(step); + + if (coordIt == g_coords.coords.end() || + (coordIt->second.first == 0 && coordIt->second.second == 0)) { continue; } - if (ShouldSkipBoonStep(i)) { + if (ShouldSkipBoonStep(stepIndex)) { continue; } - if (i == 9) { - CoordinateUtils::ClickAtScaled(g_coords.boonStepX[i], g_coords.boonStepY[i], g_state.stepDelay); + if (step == BOON_RESOLUTION) { + CoordinateUtils::ClickAtScaled( + coordIt->second.first, + coordIt->second.second, + g_state.stepDelay + ); if (g_state.showBoonAdvanced && g_state.addResistance) { - CoordinateUtils::ClickAtScaled(g_coords.resistanceX, g_coords.resistanceY, g_state.stepDelay); + auto resistanceCoord = g_coords.coords.find(BOON_RESISTANCE); + if (resistanceCoord != g_coords.coords.end()) { + CoordinateUtils::ClickAtScaled( + resistanceCoord->second.first, + resistanceCoord->second.second, + g_state.stepDelay + ); + } } if (g_state.showBoonAdvanced && g_state.addStability) { - CoordinateUtils::ClickAtScaled(g_coords.stabilityX, g_coords.stabilityY, g_state.stepDelay); + auto stabilityCoord = g_coords.coords.find(BOON_STABILITY); + if (stabilityCoord != g_coords.coords.end()) { + CoordinateUtils::ClickAtScaled( + stabilityCoord->second.first, + stabilityCoord->second.second, + g_state.stepDelay + ); + } } continue; } - int delay = (i == 19) ? 50 : g_state.stepDelay; - CoordinateUtils::ClickAtScaled(g_coords.boonStepX[i], g_coords.boonStepY[i], delay); + int delay = (i == MenuSequences::BOON_LENGTH - 1) ? 50 : g_state.stepDelay; + CoordinateUtils::ClickAtScaled(coordIt->second.first, coordIt->second.second, delay); } } catch (...) { @@ -180,7 +228,7 @@ void AutomationLogic::ApplyAllBoons() { g_api->Log(ELogLevel_INFO, "GolemHelper", "Boon sequence completed!"); } -void AutomationLogic::ApplyGolemSettings() { +void AutomationLogic::SpawnGolem() { if (!g_api || !g_state.enabled) return; bool uiWasVisible = g_state.showUI; @@ -212,49 +260,70 @@ void AutomationLogic::ApplyGolemSettings() { g_api->GameBinds.InvokeAsync(EGameBinds_MiscInteract, 50); Sleep(g_state.initialDelay); - for (int i = 0; i < 25; i++) { - if (g_coords.golemStepX[i] == 0 && g_coords.golemStepY[i] == 0) { + for (int i = 0; i < MenuSequences::GOLEM_LENGTH; i++) { + int stepIndex = i; + MenuOption step = MenuSequences::GOLEM_SEQUENCE[i]; + auto coordIt = g_coords.coords.find(step); + + if (coordIt == g_coords.coords.end() || + (coordIt->second.first == 0 && coordIt->second.second == 0)) { continue; } - if (ShouldSkipGolemStep(i)) { + if (ShouldSkipGolemStep(stepIndex)) { continue; } - int currentX = g_coords.golemStepX[i]; - int currentY = g_coords.golemStepY[i]; + int currentX = coordIt->second.first; + int currentY = coordIt->second.second; - if (i == 1) { + if (step == GOLEM_HITBOX_SMALL) { + MenuOption hitboxOption; switch (g_state.hitboxType) { - case HITBOX_SMALL: - currentY = 260; - break; - case HITBOX_MEDIUM: - currentY = 305; - break; - case HITBOX_LARGE: - currentY = 352; - break; + case HITBOX_SMALL: hitboxOption = GOLEM_HITBOX_SMALL; break; + case HITBOX_MEDIUM: hitboxOption = GOLEM_HITBOX_MEDIUM; break; + case HITBOX_LARGE: hitboxOption = GOLEM_HITBOX_LARGE; break; + default: hitboxOption = GOLEM_HITBOX_SMALL; break; + } + + auto hitboxCoord = g_coords.coords.find(hitboxOption); + if (hitboxCoord != g_coords.coords.end()) { + currentX = hitboxCoord->second.first; + currentY = hitboxCoord->second.second; } } - int delay = (i == 24) ? 50 : g_state.stepDelay; + int delay = (i == MenuSequences::GOLEM_LENGTH - 1) ? 50 : g_state.stepDelay; - if (i == 14) { + if (step == GOLEM_CRIPPLE) { CoordinateUtils::ClickAtScaled(currentX, currentY, delay); if (g_state.showAdvanced && g_state.addImmobilize) { - CoordinateUtils::ClickAtScaled(g_coords.immobilizeX, g_coords.immobilizeY, g_state.stepDelay); + auto immobilizeCoord = g_coords.coords.find(GOLEM_IMMOBILIZE); + if (immobilizeCoord != g_coords.coords.end()) { + CoordinateUtils::ClickAtScaled( + immobilizeCoord->second.first, + immobilizeCoord->second.second, + g_state.stepDelay + ); + } } continue; } - if (i == 16) { + if (step == GOLEM_COMBATAFFECTINGCONDITIONS) { CoordinateUtils::ClickAtScaled(currentX, currentY, delay); if (g_state.showAdvanced && g_state.addBlind) { - CoordinateUtils::ClickAtScaled(g_coords.blindX, g_coords.blindY, g_state.stepDelay); + auto blindCoord = g_coords.coords.find(GOLEM_BLIND); + if (blindCoord != g_coords.coords.end()) { + CoordinateUtils::ClickAtScaled( + blindCoord->second.first, + blindCoord->second.second, + g_state.stepDelay + ); + } } continue; @@ -262,7 +331,7 @@ void AutomationLogic::ApplyGolemSettings() { CoordinateUtils::ClickAtScaled(currentX, currentY, delay); - if (g_state.showAdvanced && g_state.fiveBleedingStacks && i == 6) { + if (g_state.showAdvanced && g_state.fiveBleedingStacks && step == GOLEM_BLEEDING) { for (int repeat = 0; repeat < 4; repeat++) { CoordinateUtils::ClickAtScaled(currentX, currentY, g_state.stepDelay); } diff --git a/GolemHelper/Automation/AutomationLogic.h b/GolemHelper/Automation/AutomationLogic.h index 80fafc6..33e0e03 100644 --- a/GolemHelper/Automation/AutomationLogic.h +++ b/GolemHelper/Automation/AutomationLogic.h @@ -4,7 +4,7 @@ class AutomationLogic { public: static bool ShouldSkipBoonStep(int stepIndex); static bool ShouldSkipGolemStep(int stepIndex); - static void ApplyAllBoons(); + static void ApplyBoons(); static void ApplyHealerBoons(); - static void ApplyGolemSettings(); + static void SpawnGolem(); }; \ No newline at end of file diff --git a/GolemHelper/Common/MenuSequences.h b/GolemHelper/Common/MenuSequences.h new file mode 100644 index 0000000..04066db --- /dev/null +++ b/GolemHelper/Common/MenuSequences.h @@ -0,0 +1,73 @@ +#pragma once +#include "Types.h" + +class MenuSequences { +public: + static constexpr MenuOption BOON_SEQUENCE[20] = { + BOON_ADJUSTSELF, + BOON_ADDBOONS, + BOON_OFFENSIVE, + BOON_MIGHT, + BOON_25MIGHT, + BOON_FURY, + BOON_RETURN1, + BOON_DEFENSIVE, + BOON_PROTECTION, + BOON_RESOLUTION, + BOON_AEGIS, + BOON_RETURN2, + BOON_UTILITY, + BOON_ALACRITY, + BOON_QUICKNESS, + BOON_REGENERATION, + BOON_SWIFTNESS, + BOON_VIGOR, + BOON_ALACRITY, + BOON_EXIT + }; + + static constexpr MenuOption HEALER_QUICK_SEQUENCE[10] = { + BOON_ADJUSTSELF, + BOON_ADDBOONS, + BOON_UTILITY, + BOON_ALACRITY, + BOON_ALACRITY, + BOON_RETURN3, + BOON_RETURN4, + BOON_GOBACK, + BOON_ADJUSTENVIRONMENT, + BOON_TOGGLEPULSINGARENADAMAGEON + }; + + static constexpr MenuOption GOLEM_SEQUENCE[25] = { + GOLEM_SPAWNAGOLEM, + GOLEM_HITBOX_SMALL, + GOLEM_AVERAGEENEMY, + GOLEM_ADDITIONALOPTIONS, + GOLEM_ADDCONDITIONS, + GOLEM_DAMAGEOVERTIMECONDITIONS, + GOLEM_BLEEDING, + GOLEM_BURNING, + GOLEM_CONFUSION, + GOLEM_POISON, + GOLEM_TORMENT, + GOLEM_GOBACK1, + GOLEM_MOBILITYAFFECTINGCONDITIONS, + GOLEM_CHILL, + GOLEM_CRIPPLE, + GOLEM_GOBACK2, + GOLEM_COMBATAFFECTINGCONDITIONS, + GOLEM_SLOW, + GOLEM_VULNERABILITY, + GOLEM_25VULNERABILITY, + GOLEM_GOBACK3, + GOLEM_WEAKNESS, + GOLEM_GOBACK4, + GOLEM_GOBACK5, + GOLEM_PLEASESPAWNMYGOLEM + }; + + static constexpr int BOON_LENGTH = 20; + static constexpr int HEALER_QUICK_LENGTH = 10; + static constexpr int GOLEM_LENGTH = 25; +}; \ No newline at end of file diff --git a/GolemHelper/Common/Types.h b/GolemHelper/Common/Types.h index e1374df..17619f6 100644 --- a/GolemHelper/Common/Types.h +++ b/GolemHelper/Common/Types.h @@ -2,6 +2,7 @@ #include "../Dependencies/mumble/mumble.h" #include #include +#include enum HitboxType { HITBOX_SMALL = 0, @@ -15,6 +16,72 @@ enum EnvironmentDamageLevel { ENV_EXTREME = 2 }; +enum MenuOption { + // === BOON MENU === + BOON_ADJUSTSELF, + BOON_ADDBOONS, + BOON_OFFENSIVE, + BOON_MIGHT, + BOON_25MIGHT, + BOON_FURY, + BOON_RETURN1, + BOON_DEFENSIVE, + BOON_PROTECTION, + BOON_RESOLUTION, + BOON_RESISTANCE, + BOON_STABILITY, + BOON_AEGIS, + BOON_RETURN2, + BOON_UTILITY, + BOON_ALACRITY, + BOON_QUICKNESS, + BOON_REGENERATION, + BOON_SWIFTNESS, + BOON_VIGOR, + BOON_EXIT, + + // === HEALER EXTENSIONS === + BOON_RETURN3, + BOON_RETURN4, + BOON_GOBACK, + BOON_ADJUSTENVIRONMENT, + BOON_TOGGLEPULSINGARENADAMAGEON, + BOON_ENV_MILD, + BOON_ENV_MODERATE, + BOON_ENV_EXTREME, + + // === GOLEM MENU === + GOLEM_SPAWNAGOLEM, + GOLEM_HITBOX_SMALL, + GOLEM_HITBOX_MEDIUM, + GOLEM_HITBOX_LARGE, + GOLEM_AVERAGEENEMY, + GOLEM_ADDITIONALOPTIONS, + GOLEM_ADDCONDITIONS, + GOLEM_DAMAGEOVERTIMECONDITIONS, + GOLEM_BLEEDING, + GOLEM_BURNING, + GOLEM_CONFUSION, + GOLEM_POISON, + GOLEM_TORMENT, + GOLEM_GOBACK1, + GOLEM_MOBILITYAFFECTINGCONDITIONS, + GOLEM_CHILL, + GOLEM_CRIPPLE, + GOLEM_IMMOBILIZE, + GOLEM_GOBACK2, + GOLEM_COMBATAFFECTINGCONDITIONS, + GOLEM_BLIND, + GOLEM_SLOW, + GOLEM_VULNERABILITY, + GOLEM_25VULNERABILITY, + GOLEM_GOBACK3, + GOLEM_WEAKNESS, + GOLEM_GOBACK4, + GOLEM_GOBACK5, + GOLEM_PLEASESPAWNMYGOLEM +}; + struct GolemTemplate { std::string name; bool isQuickDps; @@ -75,6 +142,7 @@ struct GolemHelperState { bool addStability = false; bool skipAegis = false; bool alwaysHideIcon = false; + bool autoShowHideUI = false; int debugCounter = 0; int initialDelay = 390; @@ -90,43 +158,69 @@ struct GolemHelperState { }; struct MenuCoordinates { - int golemStepX[25] = { - 830, 830, 830, 830, 830, 830, 830, 830, 830, 830, - 830, 830, 830, 830, 830, 830, 830, 830, 830, 830, - 830, 830, 830, 830, 830 + std::map> coords = { + // === BOON MENU === + {BOON_ADJUSTSELF, {830, 262}}, + {BOON_ADDBOONS, {830, 354}}, + {BOON_OFFENSIVE, {830, 262}}, + {BOON_MIGHT, {830, 262}}, + {BOON_25MIGHT, {830, 400}}, + {BOON_FURY, {830, 305}}, + {BOON_RETURN1, {830, 354}}, + {BOON_DEFENSIVE, {830, 305}}, + {BOON_PROTECTION, {830, 262}}, + {BOON_RESOLUTION, {830, 305}}, + {BOON_RESISTANCE, {830, 354}}, + {BOON_STABILITY, {830, 400}}, + {BOON_AEGIS, {830, 450}}, + {BOON_RETURN2, {830, 500}}, + {BOON_UTILITY, {830, 354}}, + {BOON_ALACRITY, {830, 262}}, + {BOON_QUICKNESS, {830, 305}}, + {BOON_REGENERATION, {830, 354}}, + {BOON_SWIFTNESS, {830, 400}}, + {BOON_VIGOR, {830, 450}}, + {BOON_EXIT, {830, 550}}, + + // === HEALER EXTENSIONS === + {BOON_RETURN3, {830, 500}}, + {BOON_RETURN4, {830, 450}}, + {BOON_GOBACK, {830, 450}}, + {BOON_ADJUSTENVIRONMENT, {830, 305}}, + {BOON_TOGGLEPULSINGARENADAMAGEON, {830, 262}}, + {BOON_ENV_MILD, {830, 352}}, + {BOON_ENV_MODERATE, {830, 305}}, + {BOON_ENV_EXTREME, {830, 262}}, + + // === GOLEM MENU === + {GOLEM_SPAWNAGOLEM, {830, 260}}, + {GOLEM_HITBOX_SMALL, {830, 260}}, + {GOLEM_HITBOX_MEDIUM, {830, 305}}, + {GOLEM_HITBOX_LARGE, {830, 352}}, + {GOLEM_AVERAGEENEMY, {830, 306}}, + {GOLEM_ADDITIONALOPTIONS, {830, 257}}, + {GOLEM_ADDCONDITIONS, {830, 257}}, + {GOLEM_DAMAGEOVERTIMECONDITIONS, {830, 306}}, + {GOLEM_BLEEDING, {830, 257}}, + {GOLEM_BURNING, {830, 306}}, + {GOLEM_CONFUSION, {830, 352}}, + {GOLEM_POISON, {830, 400}}, + {GOLEM_TORMENT, {830, 454}}, + {GOLEM_GOBACK1, {830, 508}}, + {GOLEM_MOBILITYAFFECTINGCONDITIONS, {830, 352}}, + {GOLEM_CHILL, {830, 257}}, + {GOLEM_CRIPPLE, {830, 306}}, + {GOLEM_IMMOBILIZE, {830, 400}}, + {GOLEM_GOBACK2, {830, 454}}, + {GOLEM_COMBATAFFECTINGCONDITIONS, {830, 400}}, + {GOLEM_BLIND, {830, 260}}, + {GOLEM_SLOW, {830, 306}}, + {GOLEM_VULNERABILITY, {830, 352}}, + {GOLEM_25VULNERABILITY, {830, 400}}, + {GOLEM_GOBACK3, {830, 454}}, + {GOLEM_WEAKNESS, {830, 400}}, + {GOLEM_GOBACK4, {830, 454}}, + {GOLEM_GOBACK5, {830, 454}}, + {GOLEM_PLEASESPAWNMYGOLEM, {830, 548}} }; - - int golemStepY[25] = { - 260, 260, 306, 257, 257, 306, 257, 306, 352, 400, - 454, 508, 352, 257, 306, 454, 400, 306, 352, 400, - 454, 400, 454, 454, 548 - }; - - int boonStepX[20] = { - 830, 830, 830, 830, 830, 830, 830, 830, 830, 830, - 830, 830, 830, 830, 830, 830, 830, 830, 830, 830 - }; - - int boonStepY[20] = { - 262, 354, 262, 262, 400, 305, 354, 305, 262, 305, - 450, 500, 354, 262, 305, 354, 400, 450, 262, 550 - }; - - int healerStepX[10] = { - 830, 830, 830, 830, 830, 830, 830, 830, 830, 830 - }; - - int healerStepY[10] = { - 262, 352, 352, 262, 262, 500, 450, 450, 305, 262 - }; - - int immobilizeX = 830; - int immobilizeY = 400; - int blindX = 830; - int blindY = 260; - - int resistanceX = 830; - int resistanceY = 354; - int stabilityX = 830; - int stabilityY = 400; }; \ No newline at end of file diff --git a/GolemHelper/Config/ConfigManager.cpp b/GolemHelper/Config/ConfigManager.cpp index ddfae79..66f4092 100644 --- a/GolemHelper/Config/ConfigManager.cpp +++ b/GolemHelper/Config/ConfigManager.cpp @@ -22,12 +22,15 @@ void ConfigManager::SaveCustomDelaySettings() { configFile << "initialDelay=" << g_state.initialDelay << std::endl; 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.close(); - char logBuffer[300]; - sprintf_s(logBuffer, "Settings saved: initialDelay=%dms, stepDelay=%dms, alwaysHideIcon=%s", - g_state.initialDelay, g_state.stepDelay, g_state.alwaysHideIcon ? "true" : "false"); + char logBuffer[350]; + sprintf_s(logBuffer, "Settings saved: initialDelay=%dms, stepDelay=%dms, alwaysHideIcon=%s, autoShowHideUI=%s", + g_state.initialDelay, g_state.stepDelay, + g_state.alwaysHideIcon ? "true" : "false", + g_state.autoShowHideUI ? "true" : "false"); g_api->Log(ELogLevel_INFO, "GolemHelper", logBuffer); } @@ -73,13 +76,18 @@ void ConfigManager::LoadCustomDelaySettings() { else if (key == "alwaysHideIcon") { g_state.alwaysHideIcon = (value == "1"); } + else if (key == "autoShowHideUI") { + g_state.autoShowHideUI = (value == "1"); + } } configFile.close(); - char logBuffer[300]; - sprintf_s(logBuffer, "Settings loaded: initialDelay=%dms, stepDelay=%dms, alwaysHideIcon=%s", - g_state.initialDelay, g_state.stepDelay, g_state.alwaysHideIcon ? "true" : "false"); + char logBuffer[350]; + sprintf_s(logBuffer, "Settings loaded: initialDelay=%dms, stepDelay=%dms, alwaysHideIcon=%s, autoShowHideUI=%s", + g_state.initialDelay, g_state.stepDelay, + g_state.alwaysHideIcon ? "true" : "false", + g_state.autoShowHideUI ? "true" : "false"); g_api->Log(ELogLevel_INFO, "GolemHelper", logBuffer); } diff --git a/GolemHelper/GolemHelper.cpp b/GolemHelper/GolemHelper.cpp index 4ade1ed..2332611 100644 --- a/GolemHelper/GolemHelper.cpp +++ b/GolemHelper/GolemHelper.cpp @@ -35,7 +35,7 @@ void Load(AddonAPI* aApi) { MapUtils::UpdateQuickAccessVisibility(); - g_api->Log(ELogLevel_INFO, "GolemHelper", "=== GolemHelper v1.5.0.0 Loaded ==="); + g_api->Log(ELogLevel_INFO, "GolemHelper", "=== GolemHelper v1.5.1.0 Loaded ==="); g_api->Log(ELogLevel_INFO, "GolemHelper", "GolemHelper addon loaded successfully!"); } @@ -62,7 +62,7 @@ extern "C" __declspec(dllexport) AddonDefinition* GetAddonDef() { def.Signature = -424248; def.APIVersion = NEXUS_API_VERSION; def.Name = "GolemHelper"; - def.Version = { 1, 5, 0, 0 }; + def.Version = { 1, 5, 1, 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/GolemHelper.vcxproj b/GolemHelper/GolemHelper.vcxproj index 1760d89..c813e74 100644 --- a/GolemHelper/GolemHelper.vcxproj +++ b/GolemHelper/GolemHelper.vcxproj @@ -154,6 +154,7 @@ + diff --git a/GolemHelper/GolemHelper.vcxproj.filters b/GolemHelper/GolemHelper.vcxproj.filters index d3e10bb..c40ae66 100644 --- a/GolemHelper/GolemHelper.vcxproj.filters +++ b/GolemHelper/GolemHelper.vcxproj.filters @@ -108,6 +108,9 @@ Config + + Common + diff --git a/GolemHelper/Input/KeybindManager.cpp b/GolemHelper/Input/KeybindManager.cpp index 1a74207..b37393a 100644 --- a/GolemHelper/Input/KeybindManager.cpp +++ b/GolemHelper/Input/KeybindManager.cpp @@ -10,7 +10,7 @@ void KeybindManager::RegisterKeybinds() { Keybind kb_empty = { 0, false, false, false }; g_api->InputBinds.RegisterWithStruct("GolemHelper.ApplyBoons", HandleBoonKeybind, kb_empty); - g_api->InputBinds.RegisterWithStruct("GolemHelper.ApplyGolem", HandleGolemKeybind, kb_empty); + g_api->InputBinds.RegisterWithStruct("GolemHelper.SpawnGolem", HandleGolemKeybind, kb_empty); g_api->InputBinds.RegisterWithStruct("GolemHelper.QuickDPS", HandleQuickDpsKeybind, kb_empty); g_api->InputBinds.RegisterWithStruct("GolemHelper.AlacDPS", HandleAlacDpsKeybind, kb_empty); g_api->InputBinds.RegisterWithStruct("GolemHelper.Toggle", HandleToggleKeybind, kb_empty); @@ -22,7 +22,7 @@ void KeybindManager::UnregisterKeybinds() { if (!g_api) return; g_api->InputBinds.Deregister("GolemHelper.ApplyBoons"); - g_api->InputBinds.Deregister("GolemHelper.ApplyGolem"); + g_api->InputBinds.Deregister("GolemHelper.SpawnGolem"); g_api->InputBinds.Deregister("GolemHelper.QuickDPS"); g_api->InputBinds.Deregister("GolemHelper.AlacDPS"); g_api->InputBinds.Deregister("GolemHelper.Toggle"); @@ -32,13 +32,13 @@ void KeybindManager::UnregisterKeybinds() { void KeybindManager::HandleBoonKeybind(const char* id, bool release) { if (!release && g_state.enabled) { - AutomationLogic::ApplyAllBoons(); + AutomationLogic::ApplyBoons(); } } void KeybindManager::HandleGolemKeybind(const char* id, bool release) { if (!release && g_state.enabled) { - AutomationLogic::ApplyGolemSettings(); + AutomationLogic::SpawnGolem(); } } diff --git a/GolemHelper/UI/UIManager.cpp b/GolemHelper/UI/UIManager.cpp index 98f33ae..26bec2d 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.0.0"); + ImGui::TextColored(ImVec4(0.2f, 0.8f, 1.0f, 1.0f), "GolemHelper v1.5.1.0"); ImGui::Separator(); if (ImGui::BeginTabBar("GolemHelperTabs", ImGuiTabBarFlags_None)) { @@ -164,7 +164,7 @@ void UIManager::RenderSettingsTab() { if (ImGui::Button("Spawn Golem", ImVec2(150, 0))) { if (g_state.enabled && MapUtils::IsInTrainingArea()) { - g_api->InputBinds.Invoke("GolemHelper.ApplyGolem", false); + g_api->InputBinds.Invoke("GolemHelper.SpawnGolem", false); } } @@ -268,7 +268,7 @@ void UIManager::RenderTemplatesTab() { if (ImGui::Button("Spawn Golem", ImVec2(120, 30))) { if (g_state.enabled && MapUtils::IsInTrainingArea()) { - g_api->InputBinds.Invoke("GolemHelper.ApplyGolem", false); + g_api->InputBinds.Invoke("GolemHelper.SpawnGolem", false); } } @@ -484,79 +484,12 @@ void UIManager::RenderOptions() { MapUtils::UpdateQuickAccessVisibility(); } - ImGui::Checkbox("Enable debug mode", &g_state.debugMode); - - if (ImGui::Button("Reset all settings")) { - g_state.isQuickDps = false; - g_state.isAlacDps = false; - g_state.environmentDamage = false; - g_state.envDamageLevel = ENV_MILD; - g_state.skipBurning = false; - g_state.skipConfusion = false; - g_state.skipSlow = false; - g_state.addImmobilize = false; - g_state.addBlind = false; - g_state.fiveBleedingStacks = false; - g_state.hitboxType = HITBOX_SMALL; - g_state.showAdvanced = false; - g_state.showTimingSettings = false; - g_state.showBoonAdvanced = false; - g_state.addResistance = false; - g_state.addStability = false; - g_state.skipAegis = false; - g_state.stepDelay = 290; - g_state.initialDelay = 390; - g_state.alwaysHideIcon = false; + bool oldAutoShowHideUI = g_state.autoShowHideUI; + ImGui::Checkbox("Auto Show/Hide UI", &g_state.autoShowHideUI); + if (oldAutoShowHideUI != g_state.autoShowHideUI) { ConfigManager::SaveCustomDelaySettings(); - MapUtils::UpdateQuickAccessVisibility(); } - ImGui::Spacing(); - ImGui::Text("Current Modes:"); - - std::string boonMode = "Normal"; - if (g_state.isQuickDps) { - boonMode = "Quick DPS"; - } - else if (g_state.isAlacDps) { - boonMode = "Alac DPS"; - } - - if (g_state.environmentDamage) { - boonMode += " + Env "; - switch (g_state.envDamageLevel) { - case ENV_MILD: boonMode += "Mild"; break; - case ENV_MODERATE: boonMode += "Moderate"; break; - case ENV_EXTREME: boonMode += "Extreme"; break; - } - } - - ImGui::Text("- Boons: %s", boonMode.c_str()); - - std::string golemMods = "Normal"; - if (g_state.showAdvanced && (g_state.skipBurning || g_state.skipConfusion || g_state.skipSlow || - g_state.addImmobilize || g_state.addBlind || g_state.fiveBleedingStacks)) { - golemMods = ""; - if (g_state.skipBurning) golemMods += "Skip Burning "; - if (g_state.skipConfusion) golemMods += "Skip Confusion "; - if (g_state.skipSlow) golemMods += "Skip Slow "; - if (g_state.addImmobilize) golemMods += "Add Immobilize "; - if (g_state.addBlind) golemMods += "Add Blind "; - if (g_state.fiveBleedingStacks) golemMods += "5 Bleeding "; - if (!golemMods.empty()) golemMods.pop_back(); - } - ImGui::Text("- Golem: %s", golemMods.c_str()); - - const char* hitboxName = g_state.hitboxType == HITBOX_SMALL ? "Small" : - g_state.hitboxType == HITBOX_MEDIUM ? "Medium" : "Large"; - ImGui::Text("- Hitbox: %s", hitboxName); - - ImGui::Text("- Step Delay: %d ms", g_state.stepDelay); - ImGui::Text("- Initial Delay: %d ms", g_state.initialDelay); - - ImGui::Text("- Templates: %zu loaded", g_state.templates.size()); - if (g_state.selectedTemplateIndex >= 0 && g_state.selectedTemplateIndex < g_state.templates.size()) { - ImGui::Text("- Active Template: %s", g_state.templates[g_state.selectedTemplateIndex].name.c_str()); - } + ImGui::Checkbox("Enable debug mode", &g_state.debugMode); } \ No newline at end of file diff --git a/GolemHelper/Utils/MapUtils.cpp b/GolemHelper/Utils/MapUtils.cpp index e51292e..48bc02b 100644 --- a/GolemHelper/Utils/MapUtils.cpp +++ b/GolemHelper/Utils/MapUtils.cpp @@ -51,4 +51,18 @@ void MapUtils::UpdateQuickAccessVisibility() { } } } + + if (g_state.autoShowHideUI) { + bool inTrainingArea = IsInTrainingArea(); + static bool wasInTrainingArea = false; + + if (inTrainingArea && !wasInTrainingArea) { + g_state.showUI = true; + } + else if (!inTrainingArea && wasInTrainingArea) { + g_state.showUI = false; + } + + wasInTrainingArea = inTrainingArea; + } } \ No newline at end of file