From 92224456e5e5839cbe63f8b1370b4ddd6efb19ae Mon Sep 17 00:00:00 2001 From: kurumimeow Date: Sun, 13 Apr 2025 18:10:22 +0530 Subject: [PATCH 1/3] add heist modifier --- .../recovery/Heist/ApartmentHeist.cpp | 123 +++++++++ .../recovery/Heist/CayoPericoHeist.cpp | 230 ++++++++++++++++ .../recovery/Heist/DiamondCasinoHeist.cpp | 254 ++++++++++++++++++ .../features/recovery/Heist/DoomsdayHeist.cpp | 136 ++++++++++ src/game/frontend/items/Items.hpp | 16 ++ src/game/frontend/items/TabItem.cpp | 22 ++ src/game/frontend/submenus/Network.cpp | 2 +- src/game/frontend/submenus/Recovery.cpp | 2 + .../Recovery/Heist/ApartmentHeist.cpp | 33 +++ .../Recovery/Heist/ApartmentHeist.hpp | 6 + .../Recovery/Heist/CayoPericoHeist.cpp | 56 ++++ .../Recovery/Heist/CayoPericoHeist.hpp | 6 + .../Recovery/Heist/DiamondCasinoHeist.cpp | 65 +++++ .../Recovery/Heist/DiamondCasinoHeist.hpp | 6 + .../submenus/Recovery/Heist/DoomsdayHeist.cpp | 33 +++ .../submenus/Recovery/Heist/DoomsdayHeist.hpp | 6 + .../submenus/Recovery/HeistModifier.cpp | 26 ++ .../submenus/Recovery/HeistModifier.hpp | 8 + src/game/gta/ScriptGlobal.hpp | 13 +- src/game/gta/ScriptLocal.hpp | 20 ++ 20 files changed, 1061 insertions(+), 2 deletions(-) create mode 100644 src/game/features/recovery/Heist/ApartmentHeist.cpp create mode 100644 src/game/features/recovery/Heist/CayoPericoHeist.cpp create mode 100644 src/game/features/recovery/Heist/DiamondCasinoHeist.cpp create mode 100644 src/game/features/recovery/Heist/DoomsdayHeist.cpp create mode 100644 src/game/frontend/items/TabItem.cpp create mode 100644 src/game/frontend/submenus/Recovery/Heist/ApartmentHeist.cpp create mode 100644 src/game/frontend/submenus/Recovery/Heist/ApartmentHeist.hpp create mode 100644 src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.cpp create mode 100644 src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.hpp create mode 100644 src/game/frontend/submenus/Recovery/Heist/DiamondCasinoHeist.cpp create mode 100644 src/game/frontend/submenus/Recovery/Heist/DiamondCasinoHeist.hpp create mode 100644 src/game/frontend/submenus/Recovery/Heist/DoomsdayHeist.cpp create mode 100644 src/game/frontend/submenus/Recovery/Heist/DoomsdayHeist.hpp create mode 100644 src/game/frontend/submenus/Recovery/HeistModifier.cpp create mode 100644 src/game/frontend/submenus/Recovery/HeistModifier.hpp diff --git a/src/game/features/recovery/Heist/ApartmentHeist.cpp b/src/game/features/recovery/Heist/ApartmentHeist.cpp new file mode 100644 index 00000000..e2961619 --- /dev/null +++ b/src/game/features/recovery/Heist/ApartmentHeist.cpp @@ -0,0 +1,123 @@ +#include "core/commands/IntCommand.hpp" +#include "core/commands/Command.hpp" +#include "game/gta/Stats.hpp" +#include "game/gta/ScriptGlobal.hpp" +#include "game/gta/ScriptLocal.hpp" +#include "core/backend/ScriptMgr.hpp" + +namespace YimMenu::Features +{ + namespace ApartmentHeist + { + static IntCommand _ApartmentHeistCut1{"apartmentheistcut1", "Player 1", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _ApartmentHeistCut2{"apartmentheistcut2", "Player 2", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _ApartmentHeistCut3{"apartmentheistcut3", "Player 3", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _ApartmentHeistCut4{"apartmentheistcut4", "Player 4", "Player 1 cut", std::nullopt, std::nullopt, 0}; + + class SetCuts : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptGlobal(1929794 + 1 + 1).SetValue(100 - (_ApartmentHeistCut1.GetState() + _ApartmentHeistCut2.GetState() + _ApartmentHeistCut3.GetState() + _ApartmentHeistCut4.GetState())); + ScriptGlobal(1929794 + 1 + 2).SetValue(_ApartmentHeistCut2.GetState()); + ScriptGlobal(1929794 + 1 + 3).SetValue(_ApartmentHeistCut3.GetState()); + ScriptGlobal(1929794 + 1 + 4).SetValue(_ApartmentHeistCut4.GetState()); + + ScriptMgr::Yield(500ms); + + ScriptGlobal(1931762 + 3008 + 1).SetValue(-1 * (ScriptGlobal(1929794 + 1 + 1).GetValue() + ScriptGlobal(1929794 + 1 + 2).GetValue() + ScriptGlobal(1929794 + 1 + 3).GetValue() + ScriptGlobal(1929794 + 1 + 4).GetValue() - 100)); + ScriptGlobal(1931762 + 3008 + 2).SetValue(ScriptGlobal(1929794 + 1 + 2).GetValue()); + ScriptGlobal(1931762 + 3008 + 3).SetValue(ScriptGlobal(1929794 + 1 + 3).GetValue()); + ScriptGlobal(1931762 + 3008 + 4).SetValue(ScriptGlobal(1929794 + 1 + 4).GetValue()); + } + }; + + class ForceReady : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptGlobal(2657994 + 1 + (1 * 467) + 269).SetValue(6); + ScriptGlobal(2657994 + 1 + (2 * 467) + 269).SetValue(6); + ScriptGlobal(2657994 + 1 + (3 * 467) + 269).SetValue(6); + } + }; + + class Setup : public Command + { + using Command::Command; + + virtual void OnCall() override + { + Stats::SetInt("MPX_HEIST_PLANNING_STAGE", -1); + } + }; + + class SkipHacking : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptLocal("fm_mission_controller"_J, 12216 + 24).SetValue(7); + ScriptLocal("fm_mission_controller"_J, 10213).SetValue(ScriptLocal("fm_mission_controller"_J, 10213).GetValue() | (1 << 9)); + } + }; + + class SkipDrilling : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptLocal("fm_mission_controller"_J, 10507 + 11).SetValue(100.0f); + } + }; + + class InstantFinish : public Command + { + using Command::Command; + + virtual void OnCall() override + { + Scripts::ForceScriptHost(Scripts::FindScriptThread("fm_mission_controller"_J)); + ScriptMgr::Yield(500ms); + + ScriptLocal("fm_mission_controller"_J, 20387 + 1725 + 1).SetValue(80); + ScriptLocal("fm_mission_controller"_J, 20387).SetValue(12); + ScriptLocal("fm_mission_controller"_J, 29006 + 1).SetValue(99999); + ScriptLocal("fm_mission_controller"_J, 32462 + 1 + 68).SetValue(99999); + + // TODO: find a way og getting current heist info so that InstantFinishPacific can be implemented here conditionally. + } + }; + + class InstantFinishPacific : public Command + { + using Command::Command; + + virtual void OnCall() override + { + Scripts::ForceScriptHost(Scripts::FindScriptThread("fm_mission_controller"_J)); + ScriptMgr::Yield(500ms); + + ScriptLocal("fm_mission_controller"_J, 20387 + 2686).SetValue(1875000); + ScriptLocal("fm_mission_controller"_J, 20387 + 1062).SetValue(5); + ScriptLocal("fm_mission_controller"_J, 20387).SetValue(12); + ScriptLocal("fm_mission_controller"_J, 29006 + 1).SetValue(99999); + ScriptLocal("fm_mission_controller"_J, 32462 + 1 + 68).SetValue(99999); + } + }; + + static SetCuts _ApartmentHeistSetCuts{"apartmentheistsetcuts", "Set Cuts", "Sets heist cut"}; + static ForceReady _ApartmentHeistForceReady{"apartmentheistforceready", "Force Ready", "Forces all players to be ready"}; + static Setup _ApartmentHeistSetup{"apartmentheistsetup", "Setup", "Sets up current apartment heist"}; + static SkipHacking _ApartmentHeistSkipHacking{"apartmentheistskiphacking", "Skip Hacking", "Skips hacking process"}; + static SkipDrilling _ApartmentHeistSkipDrilling{"apartmentheistskipdrilling", "Skip Drilling", "Skips drilling process"}; + static InstantFinish _ApartmentHeistInstantFinish{"apartmentheistinstantfinish", "Instant Finish", "Instantly passes the heist"}; + static InstantFinishPacific _ApartmentHeistInstantFinishPacific{"apartmentheistinstantfinishpacific", "Instant Finish (Pacific)", "Instantly passes the heist"}; + } +} \ No newline at end of file diff --git a/src/game/features/recovery/Heist/CayoPericoHeist.cpp b/src/game/features/recovery/Heist/CayoPericoHeist.cpp new file mode 100644 index 00000000..b5219e37 --- /dev/null +++ b/src/game/features/recovery/Heist/CayoPericoHeist.cpp @@ -0,0 +1,230 @@ +#include "core/commands/Command.hpp" +#include "core/commands/IntCommand.hpp" +#include "core/commands/ListCommand.hpp" +#include "game/backend/Self.hpp" +#include "game/gta/Natives.hpp" +#include "game/gta/Stats.hpp" +#include "game/gta/ScriptGlobal.hpp" +#include "game/gta/ScriptLocal.hpp" +#include "core/backend/ScriptMgr.hpp" + +namespace YimMenu::Features +{ + namespace CayoPericoHeist + { + static IntCommand _CayoPericoHeistCut1{"cayopericoheistcut1", "Player 1", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _CayoPericoHeistCut2{"cayopericoheistcut2", "Player 2", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _CayoPericoHeistCut3{"cayopericoheistcut3", "Player 3", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _CayoPericoHeistCut4{"cayopericoheistcut4", "Player 4", "Player 1 cut", std::nullopt, std::nullopt, 0}; + + class SetCuts : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptGlobal(1973698 + 831 + 56 + 1).SetValue(_CayoPericoHeistCut1.GetState()); + ScriptGlobal(1973698 + 831 + 56 + 2).SetValue(_CayoPericoHeistCut2.GetState()); + ScriptGlobal(1973698 + 831 + 56 + 3).SetValue(_CayoPericoHeistCut3.GetState()); + ScriptGlobal(1973698 + 831 + 56 + 4).SetValue(_CayoPericoHeistCut4.GetState()); + } + }; + + class ForceReady : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptGlobal(1974810 + 1 + (1 * 27) + 8 + 1).SetValue(1); + ScriptGlobal(1974810 + 1 + (2 * 27) + 8 + 2).SetValue(1); + ScriptGlobal(1974810 + 1 + (3 * 27) + 8 + 3).SetValue(1); + } + }; + + static std::vector> cayoPericoHeistDifficulty = { + {126823, "Normal"}, + {131055, "Hard"} + }; + static ListCommand _CayoPericoHeistDifficulty{"cayopericoheistdifficulty", "Difficulty", "Heist difficulty", cayoPericoHeistDifficulty, 126823}; + + static std::vector> cayoPericoHeistPrimaryTarget = { + {5, "Panther Statue"}, + {3, "Pink Diamond"}, + {4, "Madrazo Files"}, + {2, "Bearer Bonds"}, + {1, "Ruby Necklace"}, + {0, "Sinsimito Tequila"} + }; + static ListCommand _CayoPericoHeistPrimaryTarget{"cayopericoheistprimarytarget", "Primary Target", "Primary target", cayoPericoHeistPrimaryTarget, 5}; + + static std::vector> cayoPericoHeistWeapon = { + {1, "Aggressor"}, + {2, "Conspirator"}, + {3, "Crack Shot"}, + {4, "Saboteur"}, + {5, "Marksman"} + }; + static ListCommand _CayoPericoHeistWeapon{"cayopericoheistweapon", "Weapon", "Weapon category", cayoPericoHeistWeapon, 2}; + + class Setup : public Command + { + using Command::Command; + + virtual void OnCall() override + { + Stats::SetInt("MPX_H4CNF_TARGET", _CayoPericoHeistPrimaryTarget.GetState()); // Primary target + Stats::SetInt("MPX_H4LOOT_CASH_I", 2359448); + Stats::SetInt("MPX_H4LOOT_CASH_I_SCOPED", 2359448); + Stats::SetInt("MPX_H4LOOT_CASH_C", 0); + Stats::SetInt("MPX_H4LOOT_CASH_C_SCOPED", 0); + Stats::SetInt("MPX_H4LOOT_COKE_I", 4901222); + Stats::SetInt("MPX_H4LOOT_COKE_I_SCOPED", 4901222); + Stats::SetInt("MPX_H4LOOT_COKE_C", 0); + Stats::SetInt("MPX_H4LOOT_COKE_C_SCOPED", 0); + Stats::SetInt("MPX_H4LOOT_GOLD_I", 0); + Stats::SetInt("MPX_H4LOOT_GOLD_I_SCOPED", 0); + Stats::SetInt("MPX_H4LOOT_GOLD_C", 255); + Stats::SetInt("MPX_H4LOOT_GOLD_C_SCOPED", 255); + Stats::SetInt("MPX_H4LOOT_WEED_I", 0); + Stats::SetInt("MPX_H4LOOT_WEED_I_SCOPED", 0); + Stats::SetInt("MPX_H4LOOT_WEED_C", 0); + Stats::SetInt("MPX_H4LOOT_WEED_C_SCOPED", 0); + Stats::SetInt("MPX_H4LOOT_PAINT", 127); + Stats::SetInt("MPX_H4LOOT_PAINT_SCOPED", 127); + Stats::SetInt("MPX_H4LOOT_CASH_V", 599431); + Stats::SetInt("MPX_H4LOOT_COKE_V", 1198863); + Stats::SetInt("MPX_H4LOOT_GOLD_V", 1598484); + Stats::SetInt("MPX_H4LOOT_PAINT_V", 1198863); + Stats::SetInt("MPX_H4LOOT_WEED_V", 0); + Stats::SetInt("MPX_H4_PROGRESS", _CayoPericoHeistDifficulty.GetState()); // Difficulty + Stats::SetInt("MPX_H4CNF_BS_GEN", 262143); + Stats::SetInt("MPX_H4CNF_BS_ENTR", 63); + Stats::SetInt("MPX_H4CNF_BS_ABIL", 63); + Stats::SetInt("MPX_H4CNF_WEP_DISRP", 3); + Stats::SetInt("MPX_H4CNF_ARM_DISRP", 3); + Stats::SetInt("MPX_H4CNF_HEL_DISRP", 3); + Stats::SetInt("MPX_H4CNF_APPROACH", -1); + Stats::SetInt("MPX_H4CNF_BOLTCUT", 4424); + Stats::SetInt("MPX_H4CNF_UNIFORM", 5256); + Stats::SetInt("MPX_H4CNF_GRAPPEL", 5156); + Stats::SetInt("MPX_H4_MISSIONS", -1); + Stats::SetInt("MPX_H4CNF_WEAPONS", _CayoPericoHeistWeapon.GetState()); // Weapon + Stats::SetInt("MPX_H4CNF_TROJAN", 5); + Stats::SetInt("MPX_H4_PLAYTHROUGH_STATUS", 100); + + ScriptMgr::Yield(500ms); + + ScriptLocal("heist_island_planning"_J, 1566).SetValue(2); // Reload Planning Screen + } + }; + + static IntCommand _CayoPericoHeistPrimaryTargetValue{"cayopericoheistprimarytargetvalue", "Primary Target Value", "Updates primary target value", std::nullopt, std::nullopt, 0}; + + class SetPrimaryTargetValue : public Command + { + using Command::Command; + + virtual void OnCall() override + { + int primary_target = Stats::GetInt("MPX_H4CNF_TARGET"); + + if (0 <= primary_target && primary_target <= 5) + { + ScriptGlobal(262145 + 29496 + primary_target).SetValue(_CayoPericoHeistPrimaryTargetValue.GetState()); + } + } + }; + + static IntCommand _CayoPericoHeistSecondaryTakeValue{"cayopericoheistsecondarytakevalue", "Secondary Take Value", "Updates secondary take value", std::nullopt, std::nullopt, 0}; + + class SetSecondaryTakeValue : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptLocal("fm_mission_controller_2020"_J, 56033 + 1518 + 53).SetValue(_CayoPericoHeistSecondaryTakeValue.GetState()); + } + }; + + class SkipHacking : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptLocal("fm_mission_controller_2020"_J, 25388).SetValue(5); + } + }; + + class CutSewer : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptLocal("fm_mission_controller_2020"_J, 30212).SetValue(6); + } + }; + + class CutGlass : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptLocal("fm_mission_controller_2020"_J, 31451 + 3).SetValue(100.0f); + } + }; + + class TakePrimaryTarget : public Command + { + using Command::Command; + + virtual void OnCall() override + { + auto ped = Self::GetPed(); + + if (!ped) + return; + + auto pos = ped.GetPosition(); + auto heading = ped.GetHeading(); + + TASK::TASK_GO_STRAIGHT_TO_COORD(ped.GetHandle(), 5006.917, -5755.931, 15.484, 1.0, 3, 15, 5); + ScriptLocal("fm_mission_controller_2020"_J, 31450).SetValue(5); + ScriptLocal("fm_mission_controller_2020"_J, 31451).SetValue(3); + + ScriptMgr::Yield(4000ms); + + TASK::TASK_GO_STRAIGHT_TO_COORD(ped.GetHandle(), pos.x, pos.y, pos.z, 1.0, 3, heading, 5); + } + }; + + class InstantFinish : public Command + { + using Command::Command; + + virtual void OnCall() override + { + Scripts::ForceScriptHost(Scripts::FindScriptThread("fm_mission_controller_2020"_J)); + ScriptMgr::Yield(500ms); + + ScriptLocal("fm_mission_controller_2020"_J, 52581).SetValue(9); + ScriptLocal("fm_mission_controller_2020"_J, 52581 + 1776 + 1).SetValue(50); + } + }; + + static SetCuts _CayoPericoHeistSetCuts{"cayopericoheistsetcuts", "Set Cuts", "Sets heist cut"}; + static ForceReady _CayoPericoHeistForceReady{"cayopericoheistforceready", "Force Ready", "Forces all players to be ready"}; + static Setup _CayoPericoHeistSetup{"cayopericoheistsetup", "Setup", "Sets up cayo perico heist"}; + static SetPrimaryTargetValue _CayoPericoHeistSetPrimaryTargetValue{"cayopericoheistsetprimarytargetvalue", "Set Primary Target Value", "Updates primary target value"}; + static SetSecondaryTakeValue _CayoPericoHeistSetSecondaryTakeValue{"cayopericoheistsetsecondarytakevalue", "Set Secondary Take Value", "Updates secondary take value"}; + static SkipHacking _CayoPericoHeistSkipHacking{"cayopericoheistskiphacking", "Skip Hacking", "Skips hacking process"}; + static CutSewer _CayoPericoHeistCutSewer{"cayopericoheistcutsewer", "Cut Sewer", "Cuts the sewer"}; + static CutGlass _CayoPericoHeistCutGlass{"cayopericoheistcutglass", "Cut Glass", "Cuts the glass"}; + static TakePrimaryTarget _CayoPericoHeistTakePrimaryTarget{"cayopericoheisttakeprimarytarget", "Take Primary Target", "Takes primary target"}; + static InstantFinish _CayoPericoHeistInstantFinish{"cayopericoheistinstantfinish", "Instant Finish", "Instantly passes the heist"}; + } +} \ No newline at end of file diff --git a/src/game/features/recovery/Heist/DiamondCasinoHeist.cpp b/src/game/features/recovery/Heist/DiamondCasinoHeist.cpp new file mode 100644 index 00000000..663b300f --- /dev/null +++ b/src/game/features/recovery/Heist/DiamondCasinoHeist.cpp @@ -0,0 +1,254 @@ +#include "core/commands/Command.hpp" +#include "core/commands/IntCommand.hpp" +#include "core/commands/ListCommand.hpp" +#include "game/gta/Stats.hpp" +#include "game/gta/ScriptGlobal.hpp" +#include "game/gta/ScriptLocal.hpp" +#include "core/backend/ScriptMgr.hpp" + +namespace YimMenu::Features +{ + namespace DiamondCasinoHeist + { + static IntCommand _DiamondCasinoHeistCut1{"diamondcasinoheistcut1", "Player 1", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _DiamondCasinoHeistCut2{"diamondcasinoheistcut2", "Player 2", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _DiamondCasinoHeistCut3{"diamondcasinoheistcut3", "Player 3", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _DiamondCasinoHeistCut4{"diamondcasinoheistcut4", "Player 4", "Player 1 cut", std::nullopt, std::nullopt, 0}; + + class SetCuts : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptGlobal(1966898 + 1497 + 736 + 92 + 1).SetValue(_DiamondCasinoHeistCut1.GetState()); + ScriptGlobal(1966898 + 1497 + 736 + 92 + 2).SetValue(_DiamondCasinoHeistCut2.GetState()); + ScriptGlobal(1966898 + 1497 + 736 + 92 + 3).SetValue(_DiamondCasinoHeistCut3.GetState()); + ScriptGlobal(1966898 + 1497 + 736 + 92 + 4).SetValue(_DiamondCasinoHeistCut4.GetState()); + } + }; + + class ForceReady : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptGlobal(1971261 + 1 + (1 * 68) + 8 + 1).SetValue(1); + ScriptGlobal(1971261 + 1 + (2 * 68) + 8 + 2).SetValue(1); + ScriptGlobal(1971261 + 1 + (3 * 68) + 8 + 3).SetValue(1); + } + }; + + static std::vector> diamondCasinoHeistDifficulty = { + {0, "Normal"}, + {1, "Hard"} + }; + static ListCommand _DiamondCasinoHeistDifficulty{"diamondcasinoheistdifficulty", "Difficulty", "Heist difficulty", diamondCasinoHeistDifficulty, 0}; + + static std::vector> diamondCasinoHeistPrimaryTarget = { + {3, "Diamonds"}, + {1, "Gold"}, + {2, "Artwork"}, + {0, "Cash"} + }; + static ListCommand _DiamondCasinoHeistPrimaryTarget{"diamondcasinoheistprimarytarget", "Primary Target", "Primary target", diamondCasinoHeistPrimaryTarget, 3}; + + static std::vector> diamondCasinoHeistApproach = { + {0, "Silent & Sneaky"}, + {1, "The Big Con"}, + {2, "Aggressive"} + }; + static ListCommand _DiamondCasinoHeistApproach{"diamondcasinoheistapproach", "Approach", "Heist approach", diamondCasinoHeistApproach, 0}; + + static std::vector> diamondCasinoHeistGunman = { + {0, "Chester McCoy"}, + {1, "Gustavo Mota"}, + {2, "Patrick McReary"}, + {3, "Charlie Reed"}, + {4, "Karl Abolaji"}, + {5, "Remove Gunman"} + }; + static ListCommand _DiamondCasinoHeistGunman{"diamondcasinoheistgunman", "Gunman", "Gunman", diamondCasinoHeistGunman, 0}; + + static std::vector> diamondCasinoHeistWeapons = { + {0, "Weapon 1"}, + {1, "Weapon 2"} + }; + static ListCommand _DiamondCasinoHeistWeapon{"diamondcasinoheistweapon", "Weapon", "Weapon", diamondCasinoHeistWeapons, 0}; + + static std::vector> diamondCasinoHeistDriver = { + {0, "Chester McCoy"}, + {1, "Eddie Toh"}, + {2, "Taliana Martinez"}, + {3, "Zach Nelson"}, + {4, "Karim Denz"}, + {5, "Remove Driver"} + }; + static ListCommand _DiamondCasinoHeistDriver{"diamondcasinoheistdriver", "Driver", "Driver", diamondCasinoHeistDriver, 0}; + + static std::vector> diamondCasinoHeistVehicles = { + {0, "Vehicle 1"}, {1, "Vehicle 2"}, {2, "Vehicle 3"}, {3, "Vehicle 4"} + }; + static ListCommand _DiamondCasinoHeistVehicle{"diamondcasinoheistvehicle", "Vehicle", "Vehicle", diamondCasinoHeistVehicles, 0}; + + static std::vector> diamondCasinoHeistHacker = { + {4, "Avi Schwartzman"}, + {5, "Paige Harris"}, + {2, "Christian Feltz"}, + {3, "Yohan Blair"}, + {1, "Rickie Lukens"}, + {6, "Remove Hacker"} + }; + static ListCommand _DiamondCasinoHeistHacker{"diamondcasinoheisthacker", "Hacker", "Hacker", diamondCasinoHeistHacker, 4}; + + class Setup : public Command + { + using Command::Command; + + virtual void OnCall() override + { + Stats::SetInt("MPX_H3_COMPLETEDPOSIX", -1); + Stats::SetInt("MPX_H3OPT_MASKS", 4); + Stats::SetInt("MPX_H3OPT_WEAPS", _DiamondCasinoHeistWeapon.GetState()); + Stats::SetInt("MPX_H3OPT_VEHS", _DiamondCasinoHeistVehicle.GetState()); + Stats::SetInt("MPX_CAS_HEIST_FLOW", -1); + Stats::SetInt("MPX_H3_LAST_APPROACH", 0); + Stats::SetInt("MPX_H3OPT_APPROACH", _DiamondCasinoHeistApproach.GetState() + 1); // 1 = Silent & Sneaky, 2 = The Big Con, 3 = Aggressive + + switch (_DiamondCasinoHeistDifficulty.GetState()) + { + case 0: Stats::SetInt("MPX_H3_HARD_APPROACH", 0); break; + case 1: Stats::SetInt("MPX_H3_HARD_APPROACH", _DiamondCasinoHeistApproach.GetState() + 1); break; + default: break; + } + + Stats::SetInt("MPX_H3OPT_TARGET", _DiamondCasinoHeistPrimaryTarget.GetState()); + Stats::SetInt("MPX_H3OPT_POI", 1023); + Stats::SetInt("MPX_H3OPT_ACCESSPOINTS", 2047); + + switch (_DiamondCasinoHeistGunman.GetState()) + { + case 0: Stats::SetInt("MPX_H3OPT_CREWWEAP", 4); break; + case 1: Stats::SetInt("MPX_H3OPT_CREWWEAP", 2); break; + case 2: Stats::SetInt("MPX_H3OPT_CREWWEAP", 5); break; + case 3: Stats::SetInt("MPX_H3OPT_CREWWEAP", 3); break; + case 4: Stats::SetInt("MPX_H3OPT_CREWWEAP", 1); break; + case 5: Stats::SetInt("MPX_H3OPT_CREWWEAP", 6); break; + default: break; + } + + switch (_DiamondCasinoHeistDriver.GetState()) + { + case 0: Stats::SetInt("MPX_H3OPT_CREWDRIVER", 5); break; + case 1: Stats::SetInt("MPX_H3OPT_CREWDRIVER", 3); break; + case 2: Stats::SetInt("MPX_H3OPT_CREWDRIVER", 2); break; + case 3: Stats::SetInt("MPX_H3OPT_CREWDRIVER", 4); break; + case 4: Stats::SetInt("MPX_H3OPT_CREWDRIVER", 1); break; + case 5: Stats::SetInt("MPX_H3OPT_CREWDRIVER", 6); break; + default: break; + } + + Stats::SetInt("MPX_H3OPT_CREWHACKER", _DiamondCasinoHeistHacker.GetState()); + Stats::SetInt("MPX_H3OPT_DISRUPTSHIP", 3); // Security Strength: 1 = Strong, 2 = Medium, 3 = Weak + Stats::SetInt("MPX_H3OPT_BODYARMORLVL", -1); + Stats::SetInt("MPX_H3OPT_KEYLEVELS", 2); // 1 = Level1 Security Pass, 2 = Level2 Security Pass + + Stats::SetInt("MPX_H3OPT_BITSET0", rand() % (INT_MAX)); // Refresh board + Stats::SetInt("MPX_H3OPT_BITSET1", rand() % (INT_MAX)); // Refresh board + + ScriptMgr::Yield(500ms); + + Stats::SetInt("MPX_H3OPT_BITSET0", -1); // Refresh board + Stats::SetInt("MPX_H3OPT_BITSET1", -1); // Refresh board + } + }; + + static IntCommand _DiamondCasinoHeistPotentialTake{"diamondcasinoheistpotentialtake", "Potential Take", "Updates potential take", std::nullopt, std::nullopt, 0}; + + class SetPotentialTake : public Command + { + using Command::Command; + + virtual void OnCall() override + { + int primary_target = Stats::GetInt("MPX_H3OPT_TARGET"); + + if (0 <= primary_target && primary_target <= 3) + { + switch (primary_target) + { + case 0: ScriptGlobal(262145 + 28347 + 0).SetValue(_DiamondCasinoHeistPotentialTake.GetState()); break; // "Cash" + case 1: ScriptGlobal(262145 + 28347 + 2).SetValue(_DiamondCasinoHeistPotentialTake.GetState()); break; // "Gold" + case 2: ScriptGlobal(262145 + 28347 + 1).SetValue(_DiamondCasinoHeistPotentialTake.GetState()); break; // "Artwork" + case 3: ScriptGlobal(262145 + 28347 + 3).SetValue(_DiamondCasinoHeistPotentialTake.GetState()); break; // "Diamond" + default: break; + } + } + } + }; + + static IntCommand _DiamondCasinoHeistActualTake{"diamondcasinoheistactualtake", "Actual Take", "Updates actual take", std::nullopt, std::nullopt, 0}; + + class SetActualTake : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptLocal("fm_mission_controller"_J, 20387 + 2686).SetValue(_DiamondCasinoHeistActualTake.GetState()); + } + }; + + class SkipHacking : public Command + { + using Command::Command; + + virtual void OnCall() override + { + if (ScriptLocal("fm_mission_controller"_J, 53999).GetValue() != 1) + ScriptLocal("fm_mission_controller"_J, 53999).SetValue(5); // Fingerprint + + if (ScriptLocal("fm_mission_controller"_J, 55065).GetValue() != 1) + ScriptLocal("fm_mission_controller"_J, 55065).SetValue(5); // Keypad + } + }; + + class SkipDrilling : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptLocal("fm_mission_controller"_J, 10547 + 7).SetValue(ScriptLocal("fm_mission_controller"_J, 10547 + 37).GetValue()); + } + }; + + class InstantFinish : public Command + { + using Command::Command; + + virtual void OnCall() override + { + Scripts::ForceScriptHost(Scripts::FindScriptThread("fm_mission_controller"_J)); + ScriptMgr::Yield(500ms); + + ScriptLocal("fm_mission_controller"_J, 20387 + 1740 + 1).SetValue(80); + ScriptLocal("fm_mission_controller"_J, 20387 + 2686).SetValue(4443220); + ScriptLocal("fm_mission_controller"_J, 20387 + 1062).SetValue(5); + ScriptLocal("fm_mission_controller"_J, 20387).SetValue(12); + ScriptLocal("fm_mission_controller"_J, 29006 + 1).SetValue(99999); + ScriptLocal("fm_mission_controller"_J, 32462 + 1 + 68).SetValue(99999); + } + }; + + static SetCuts _DiamondCasinoHeistSetCuts{"diamondcasinoheistsetcuts", "Set Cuts", "Sets heist cut"}; + static ForceReady _DiamondCasinoHeistForceReady{"diamondcasinoheistforceready", "Force Ready", "Forces all players to be ready"}; + static Setup _DiamondCasinoHeistSetup{"diamondcasinoheistsetup", "Setup", "Sets up diamond casino heist"}; + static SetPotentialTake _DiamondCasinoHeistSetPotentialTake{"diamondcasinoheistsetpotentialtake", "Set Potential Take", "Updates potential take"}; + static SetActualTake _DiamondCasinoHeistSetActualTake{"diamondcasinoheistsetactualtake", "Set Actual Take", "Updates actual take"}; + static SkipHacking _DiamondCasinoHeistSkipHacking{"diamondcasinoheistskiphacking", "Skip Hacking", "Skips hacking process"}; + static SkipDrilling _DiamondCasinoHeistSkipDrilling{"diamondcasinoheistskipdrilling", "Skip Drilling", "Skips drilling process"}; + static InstantFinish _DiamondCasinoHeistInstantFinish{"diamondcasinoheistinstantfinish", "Instant Finish", "Instantly passes the heist"}; + } +} \ No newline at end of file diff --git a/src/game/features/recovery/Heist/DoomsdayHeist.cpp b/src/game/features/recovery/Heist/DoomsdayHeist.cpp new file mode 100644 index 00000000..0884f412 --- /dev/null +++ b/src/game/features/recovery/Heist/DoomsdayHeist.cpp @@ -0,0 +1,136 @@ +#include "core/commands/Command.hpp" +#include "core/commands/IntCommand.hpp" +#include "core/commands/ListCommand.hpp" +#include "game/gta/Stats.hpp" +#include "game/gta/ScriptGlobal.hpp" +#include "game/gta/ScriptLocal.hpp" +#include "core/backend/ScriptMgr.hpp" + +namespace YimMenu::Features +{ + namespace DoomsdayHeist + { + static IntCommand _DoomsdayHeistCut1{"doomsdayheistcut1", "Player 1", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _DoomsdayHeistCut2{"doomsdayheistcut2", "Player 2", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _DoomsdayHeistCut3{"doomsdayheistcut3", "Player 3", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _DoomsdayHeistCut4{"doomsdayheistcut4", "Player 4", "Player 1 cut", std::nullopt, std::nullopt, 0}; + + class SetCuts : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptGlobal(1962078 + 812 + 50 + 1).SetValue(_DoomsdayHeistCut1.GetState()); + ScriptGlobal(1962078 + 812 + 50 + 2).SetValue(_DoomsdayHeistCut2.GetState()); + ScriptGlobal(1962078 + 812 + 50 + 3).SetValue(_DoomsdayHeistCut3.GetState()); + ScriptGlobal(1962078 + 812 + 50 + 4).SetValue(_DoomsdayHeistCut4.GetState()); + } + }; + + class ForceReady : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptGlobal(1882925 + 1 + (1 * 149) + 43 + 1 + 4 + 8).SetValue(1); + ScriptGlobal(1882925 + 1 + (2 * 149) + 43 + 2 + 4 + 8).SetValue(1); + ScriptGlobal(1882925 + 1 + (3 * 149) + 43 + 3 + 4 + 8).SetValue(1); + } + }; + + static std::vector> doomsdayHeistCategory = { + {0, "The Data Breaches"}, + {1, "The Bogdan Problem"}, + {2, "The Doomsday Senario"} + }; + static ListCommand _DoomsdayHeistCategory{"doomsdayheistcategory", "Select Heist", "Heist categories", doomsdayHeistCategory, 0}; + + class Setup : public Command + { + using Command::Command; + + virtual void OnCall() override + { + switch (_DoomsdayHeistCategory.GetState()) + { + case 0: + Stats::SetInt("MPX_GANGOPS_FLOW_MISSION_PROG", 503); + Stats::SetInt("MPX_GANGOPS_HEIST_STATUS", -229383); + Stats::SetInt("MPX_GANGOPS_FLOW_NOTIFICATIONS", 1557); + break; + case 1: + Stats::SetInt("MPX_GANGOPS_FLOW_MISSION_PROG", 240); + Stats::SetInt("MPX_GANGOPS_HEIST_STATUS", -229378); + Stats::SetInt("MPX_GANGOPS_FLOW_NOTIFICATIONS", 1557); + break; + case 2: + Stats::SetInt("MPX_GANGOPS_FLOW_MISSION_PROG", 16368); + Stats::SetInt("MPX_GANGOPS_HEIST_STATUS", -229380); + Stats::SetInt("MPX_GANGOPS_FLOW_NOTIFICATIONS", 1557); + break; + default: break; + } + + ScriptMgr::Yield(500ms); + + ScriptLocal("gb_gang_ops_planning"_J, 207).SetValue(6); // Reload planning screen + } + }; + + class SkipHacking : public Command + { + using Command::Command; + + virtual void OnCall() override + { + ScriptLocal("fm_mission_controller"_J, 1538).SetValue(3); + ScriptLocal("fm_mission_controller"_J, 1569).SetValue(2); + ScriptLocal("fm_mission_controller"_J, 1294 + 135).SetValue(3); + } + }; + + class InstantFinish : public Command + { + using Command::Command; + + virtual void OnCall() override + { + Scripts::ForceScriptHost(Scripts::FindScriptThread("fm_mission_controller"_J)); + ScriptMgr::Yield(500ms); + + ScriptLocal("fm_mission_controller"_J, 20387 + 1725 + 1).SetValue(80); + ScriptLocal("fm_mission_controller"_J, 20387).SetValue(12); + ScriptLocal("fm_mission_controller"_J, 29006 + 1).SetValue(99999); + ScriptLocal("fm_mission_controller"_J, 32462 + 1 + 68).SetValue(99999); + + // TODO: find a way og getting current heist info so that InstantFinishAct3 can be implemented here conditionally. + } + }; + + class InstantFinishAct3 : public Command + { + using Command::Command; + + virtual void OnCall() override + { + Scripts::ForceScriptHost(Scripts::FindScriptThread("fm_mission_controller"_J)); + ScriptMgr::Yield(500ms); + + ScriptLocal("fm_mission_controller"_J, 20387).SetValue(12); + ScriptLocal("fm_mission_controller"_J, 20387 + 1740 + 1).SetValue(150); + ScriptLocal("fm_mission_controller"_J, 20387 + 1062).SetValue(5); + ScriptLocal("fm_mission_controller"_J, 29006 + 1).SetValue(99999); + ScriptLocal("fm_mission_controller"_J, 32462 + 1 + 68).SetValue(99999); + } + }; + + static SetCuts _DoomsdayHeistSetCuts{"doomsdayheistsetcuts", "Set Cuts", "Sets heist cut"}; + static ForceReady _DoomsdayHeistForceReady{"doomsdayheistforceready", "Force Ready", "Forces all players to be ready"}; + static Setup _DoomsdayHeistSetup{"doomsdayheistsetup", "Setup", "Sets up doomsday heist"}; + static SkipHacking _DoomsdayHeistSkipHacking{"doomsdayheistskiphacking", "Skip Hacking", "Skips hacking process"}; + static InstantFinish _DoomsdayHeistInstantFinish{"doomsdayheistinstantfinish", "Instant Finish", "Instantly passes the heist"}; + static InstantFinishAct3 _DoomsdayHeistInstantFinishAct3{"doomsdayheistinstantfinishact3", "Instant Finish (Act: III)", "Instantly passes the heist"}; + } +} \ No newline at end of file diff --git a/src/game/frontend/items/Items.hpp b/src/game/frontend/items/Items.hpp index 34f1b677..bd157238 100644 --- a/src/game/frontend/items/Items.hpp +++ b/src/game/frontend/items/Items.hpp @@ -197,4 +197,20 @@ namespace YimMenu std::optional m_LabelOverride; std::optional m_CurrentInput = std::nullopt; }; + + class TabItem : public UIItem + { + public: + explicit TabItem(const std::string& name); + void Draw() override; + + void AddItem(std::shared_ptr&& item) + { + m_Items.push_back(std::move(item)); + } + + private: + std::string m_Name; + std::vector> m_Items; + }; } \ No newline at end of file diff --git a/src/game/frontend/items/TabItem.cpp b/src/game/frontend/items/TabItem.cpp new file mode 100644 index 00000000..427f47be --- /dev/null +++ b/src/game/frontend/items/TabItem.cpp @@ -0,0 +1,22 @@ +#include "Items.hpp" + +namespace YimMenu +{ + TabItem::TabItem(const std::string& name) : + m_Name(name) + { + } + + void TabItem::Draw() + { + if (ImGui::BeginTabItem(m_Name.c_str())) + { + for (auto& item : m_Items) + { + if (item->CanDraw()) + item->Draw(); + } + ImGui::EndTabItem(); + } + } +} diff --git a/src/game/frontend/submenus/Network.cpp b/src/game/frontend/submenus/Network.cpp index 9bb0f963..d58befbc 100644 --- a/src/game/frontend/submenus/Network.cpp +++ b/src/game/frontend/submenus/Network.cpp @@ -4,7 +4,7 @@ #include "game/frontend/items/Items.hpp" #include "game/frontend/submenus/Network/SavedPlayers.hpp" #include "game/gta/Network.hpp" -#include "game/frontend/submenus/network/RandomEvents.hpp" +#include "game/frontend/submenus/Network/RandomEvents.hpp" namespace YimMenu::Submenus { diff --git a/src/game/frontend/submenus/Recovery.cpp b/src/game/frontend/submenus/Recovery.cpp index 481b90ea..04dd7b5a 100644 --- a/src/game/frontend/submenus/Recovery.cpp +++ b/src/game/frontend/submenus/Recovery.cpp @@ -3,6 +3,7 @@ #include "game/features/recovery/GiveVehicleReward.hpp" #include "Recovery/StatEditor.hpp" #include "Recovery/Transactions.hpp" +#include "Recovery/HeistModifier.hpp" namespace YimMenu::Submenus { @@ -40,5 +41,6 @@ namespace YimMenu::Submenus AddCategory(std::move(missions)); AddCategory(BuildStatEditorMenu()); AddCategory(BuildTransactionsMenu()); + AddCategory(BuildHeistModifierMenu()); } } \ No newline at end of file diff --git a/src/game/frontend/submenus/Recovery/Heist/ApartmentHeist.cpp b/src/game/frontend/submenus/Recovery/Heist/ApartmentHeist.cpp new file mode 100644 index 00000000..309cddda --- /dev/null +++ b/src/game/frontend/submenus/Recovery/Heist/ApartmentHeist.cpp @@ -0,0 +1,33 @@ +#include "ApartmentHeist.hpp" + +namespace YimMenu::Submenus +{ + std::shared_ptr RenderApartmentHeistMenu() + { + auto tab = std::make_shared("Apartment Heist"); + + auto cuts = std::make_shared("Heist Cuts", 2); + auto setups = std::make_shared("Heist Setups"); + auto misc = std::make_shared("Misc", 1); + + cuts->AddItem(std::make_shared("apartmentheistcut1"_J)); + cuts->AddItem(std::make_shared("apartmentheistcut3"_J)); + cuts->AddItem(std::make_shared("apartmentheistcut2"_J)); + cuts->AddItem(std::make_shared("apartmentheistcut4"_J)); + cuts->AddItem(std::make_shared("apartmentheistforceready"_J)); + cuts->AddItem(std::make_shared("apartmentheistsetcuts"_J)); + + setups->AddItem(std::make_shared("apartmentheistsetup"_J)); + + misc->AddItem(std::make_shared("apartmentheistskiphacking"_J)); + misc->AddItem(std::make_shared("apartmentheistskipdrilling"_J)); + misc->AddItem(std::make_shared("apartmentheistinstantfinish"_J)); + misc->AddItem(std::make_shared("apartmentheistinstantfinishpacific"_J)); + + tab->AddItem(cuts); + tab->AddItem(setups); + tab->AddItem(misc); + + return tab; + } +} \ No newline at end of file diff --git a/src/game/frontend/submenus/Recovery/Heist/ApartmentHeist.hpp b/src/game/frontend/submenus/Recovery/Heist/ApartmentHeist.hpp new file mode 100644 index 00000000..7de2104c --- /dev/null +++ b/src/game/frontend/submenus/Recovery/Heist/ApartmentHeist.hpp @@ -0,0 +1,6 @@ +#include "game/frontend/submenus/Recovery/HeistModifier.hpp" + +namespace YimMenu::Submenus +{ + std::shared_ptr RenderApartmentHeistMenu(); +} diff --git a/src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.cpp b/src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.cpp new file mode 100644 index 00000000..d60fbf9b --- /dev/null +++ b/src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.cpp @@ -0,0 +1,56 @@ +#include "CayoPericoHeist.hpp" + +namespace YimMenu::Submenus +{ + std::shared_ptr RenderCayoPericoHeistMenu() + { + auto tab = std::make_shared("Cayo Perico Heist"); + + auto cuts = std::make_shared("Heist Cuts", 2); + auto setups = std::make_shared("Heist Setups"); + auto sep = std::make_shared(""); + auto misc = std::make_shared("Misc", 1); + + cuts->AddItem(std::make_shared("cayopericoheistcut1"_J)); + cuts->AddItem(std::make_shared("cayopericoheistcut3"_J)); + cuts->AddItem(std::make_shared("cayopericoheistcut2"_J)); + cuts->AddItem(std::make_shared("cayopericoheistcut4"_J)); + cuts->AddItem(std::make_shared("cayopericoheistforceready"_J)); + cuts->AddItem(std::make_shared("cayopericoheistsetcuts"_J)); + + setups->AddItem(std::make_shared("cayopericoheistdifficulty"_J)); + setups->AddItem(std::make_shared([] { + ImGui::SameLine(); + })); + setups->AddItem(std::make_shared("cayopericoheistprimarytarget"_J)); + setups->AddItem(std::make_shared([] { + ImGui::SameLine(); + })); + setups->AddItem(std::make_shared("cayopericoheistweapon"_J)); + setups->AddItem(std::make_shared("cayopericoheistsetup"_J)); + + sep->AddItem(std::make_shared("cayopericoheistprimarytargetvalue"_J)); + sep->AddItem(std::make_shared([] { + ImGui::SameLine(); + })); + sep->AddItem(std::make_shared("cayopericoheistsetprimarytargetvalue"_J)); + sep->AddItem(std::make_shared("cayopericoheistsecondarytakevalue"_J)); + sep->AddItem(std::make_shared([] { + ImGui::SameLine(); + })); + sep->AddItem(std::make_shared("cayopericoheistsetsecondarytakevalue"_J)); + + misc->AddItem(std::make_shared("cayopericoheistskiphacking"_J)); + misc->AddItem(std::make_shared("cayopericoheistcutsewer"_J)); + misc->AddItem(std::make_shared("cayopericoheistcutglass"_J)); + misc->AddItem(std::make_shared("cayopericoheisttakeprimarytarget"_J)); + misc->AddItem(std::make_shared("cayopericoheistinstantfinish"_J)); + + tab->AddItem(cuts); + tab->AddItem(setups); + tab->AddItem(sep); + tab->AddItem(misc); + + return tab; + } +} \ No newline at end of file diff --git a/src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.hpp b/src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.hpp new file mode 100644 index 00000000..59dddfa4 --- /dev/null +++ b/src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.hpp @@ -0,0 +1,6 @@ +#include "game/frontend/submenus/Recovery/HeistModifier.hpp" + +namespace YimMenu::Submenus +{ + std::shared_ptr RenderCayoPericoHeistMenu(); +} diff --git a/src/game/frontend/submenus/Recovery/Heist/DiamondCasinoHeist.cpp b/src/game/frontend/submenus/Recovery/Heist/DiamondCasinoHeist.cpp new file mode 100644 index 00000000..1f77192e --- /dev/null +++ b/src/game/frontend/submenus/Recovery/Heist/DiamondCasinoHeist.cpp @@ -0,0 +1,65 @@ +#include "DiamondCasinoHeist.hpp" + +namespace YimMenu::Submenus +{ + std::shared_ptr RenderDiamondCasinoHeistMenu() + { + auto tab = std::make_shared("Diamond Casino Heist"); + + auto cuts = std::make_shared("Heist Cuts", 2); + auto setups = std::make_shared("Heist Setups", 1); + auto config = std::make_shared(""); + auto config_ = std::make_shared(""); + auto sep = std::make_shared(""); + auto misc = std::make_shared("Misc", 1); + + cuts->AddItem(std::make_shared("diamondcasinoheistcut1"_J)); + cuts->AddItem(std::make_shared("diamondcasinoheistcut3"_J)); + cuts->AddItem(std::make_shared("diamondcasinoheistcut2"_J)); + cuts->AddItem(std::make_shared("diamondcasinoheistcut4"_J)); + cuts->AddItem(std::make_shared("diamondcasinoheistforceready"_J)); + cuts->AddItem(std::make_shared("diamondcasinoheistsetcuts"_J)); + + setups->AddItem(std::make_shared("diamondcasinoheistdifficulty"_J)); + setups->AddItem(std::make_shared("diamondcasinoheistprimarytarget"_J)); + setups->AddItem(std::make_shared("diamondcasinoheistapproach"_J)); + + config->AddItem(std::make_shared("diamondcasinoheistgunman"_J)); + config->AddItem(std::make_shared([] { + ImGui::SameLine(); + })); + config->AddItem(std::make_shared("diamondcasinoheistweapon"_J)); + config->AddItem(std::make_shared("diamondcasinoheistdriver"_J)); + config->AddItem(std::make_shared([] { + ImGui::SameLine(); + })); + config->AddItem(std::make_shared("diamondcasinoheistvehicle"_J)); + config->AddItem(std::make_shared("diamondcasinoheisthacker"_J)); + + config_->AddItem(std::make_shared("diamondcasinoheistsetup"_J)); + + sep->AddItem(std::make_shared("diamondcasinoheistpotentialtake"_J)); + sep->AddItem(std::make_shared([] { + ImGui::SameLine(); + })); + sep->AddItem(std::make_shared("diamondcasinoheistsetpotentialtake"_J)); + sep->AddItem(std::make_shared("diamondcasinoheistactualtake"_J)); + sep->AddItem(std::make_shared([] { + ImGui::SameLine(); + })); + sep->AddItem(std::make_shared("diamondcasinoheistsetactualtake"_J)); + + misc->AddItem(std::make_shared("diamondcasinoheistskiphacking"_J)); + misc->AddItem(std::make_shared("diamondcasinoheistskipdrilling"_J)); + misc->AddItem(std::make_shared("diamondcasinoheistinstantfinish"_J)); + + tab->AddItem(cuts); + tab->AddItem(setups); + tab->AddItem(config); + tab->AddItem(config_); + tab->AddItem(sep); + tab->AddItem(misc); + + return tab; + } +} \ No newline at end of file diff --git a/src/game/frontend/submenus/Recovery/Heist/DiamondCasinoHeist.hpp b/src/game/frontend/submenus/Recovery/Heist/DiamondCasinoHeist.hpp new file mode 100644 index 00000000..7394e33c --- /dev/null +++ b/src/game/frontend/submenus/Recovery/Heist/DiamondCasinoHeist.hpp @@ -0,0 +1,6 @@ +#include "game/frontend/submenus/Recovery/HeistModifier.hpp" + +namespace YimMenu::Submenus +{ + std::shared_ptr RenderDiamondCasinoHeistMenu(); +} diff --git a/src/game/frontend/submenus/Recovery/Heist/DoomsdayHeist.cpp b/src/game/frontend/submenus/Recovery/Heist/DoomsdayHeist.cpp new file mode 100644 index 00000000..39d40a43 --- /dev/null +++ b/src/game/frontend/submenus/Recovery/Heist/DoomsdayHeist.cpp @@ -0,0 +1,33 @@ +#include "DoomsdayHeist.hpp" + +namespace YimMenu::Submenus +{ + std::shared_ptr RenderDoomsdayHeistMenu() + { + auto tab = std::make_shared("Doomsday Heist"); + + auto cuts = std::make_shared("Heist Cuts", 2); + auto setups = std::make_shared("Heist Setups"); + auto misc = std::make_shared("Misc", 1); + + cuts->AddItem(std::make_shared("doomsdayheistcut1"_J)); + cuts->AddItem(std::make_shared("doomsdayheistcut3"_J)); + cuts->AddItem(std::make_shared("doomsdayheistcut2"_J)); + cuts->AddItem(std::make_shared("doomsdayheistcut4"_J)); + cuts->AddItem(std::make_shared("doomsdayheistforceready"_J)); + cuts->AddItem(std::make_shared("doomsdayheistsetcuts"_J)); + + setups->AddItem(std::make_shared("doomsdayheistcategory"_J)); + setups->AddItem(std::make_shared("doomsdayheistsetup"_J)); + + misc->AddItem(std::make_shared("doomsdayheistskiphacking"_J)); + misc->AddItem(std::make_shared("doomsdayheistinstantfinish"_J)); + misc->AddItem(std::make_shared("doomsdayheistinstantfinishact3"_J)); + + tab->AddItem(cuts); + tab->AddItem(setups); + tab->AddItem(misc); + + return tab; + } +} \ No newline at end of file diff --git a/src/game/frontend/submenus/Recovery/Heist/DoomsdayHeist.hpp b/src/game/frontend/submenus/Recovery/Heist/DoomsdayHeist.hpp new file mode 100644 index 00000000..078d71e5 --- /dev/null +++ b/src/game/frontend/submenus/Recovery/Heist/DoomsdayHeist.hpp @@ -0,0 +1,6 @@ +#include "game/frontend/submenus/Recovery/HeistModifier.hpp" + +namespace YimMenu::Submenus +{ + std::shared_ptr RenderDoomsdayHeistMenu(); +} diff --git a/src/game/frontend/submenus/Recovery/HeistModifier.cpp b/src/game/frontend/submenus/Recovery/HeistModifier.cpp new file mode 100644 index 00000000..5b7c01af --- /dev/null +++ b/src/game/frontend/submenus/Recovery/HeistModifier.cpp @@ -0,0 +1,26 @@ +#include "HeistModifier.hpp" +#include "Heist/ApartmentHeist.hpp" +#include "Heist/DiamondCasinoHeist.hpp" +#include "Heist/CayoPericoHeist.hpp" +#include "Heist/DoomsdayHeist.hpp" + +namespace YimMenu::Submenus +{ + std::shared_ptr BuildHeistModifierMenu() + { + auto menu = std::make_shared("Heists"); + + menu->AddItem(std::make_shared([] { + ImGui::BeginTabBar("Heist Modifier"); + })); + menu->AddItem(RenderApartmentHeistMenu()); + menu->AddItem(RenderDiamondCasinoHeistMenu()); + menu->AddItem(RenderCayoPericoHeistMenu()); + menu->AddItem(RenderDoomsdayHeistMenu()); + menu->AddItem(std::make_shared([] { + ImGui::EndTabBar(); + })); + + return menu; + } +} \ No newline at end of file diff --git a/src/game/frontend/submenus/Recovery/HeistModifier.hpp b/src/game/frontend/submenus/Recovery/HeistModifier.hpp new file mode 100644 index 00000000..843f9944 --- /dev/null +++ b/src/game/frontend/submenus/Recovery/HeistModifier.hpp @@ -0,0 +1,8 @@ +#pragma once +#include "core/frontend/manager/Category.hpp" +#include "game/frontend/items/Items.hpp" + +namespace YimMenu::Submenus +{ + std::shared_ptr BuildHeistModifierMenu(); +} \ No newline at end of file diff --git a/src/game/gta/ScriptGlobal.hpp b/src/game/gta/ScriptGlobal.hpp index 1d3b166a..81a2b8e6 100644 --- a/src/game/gta/ScriptGlobal.hpp +++ b/src/game/gta/ScriptGlobal.hpp @@ -36,11 +36,22 @@ namespace YimMenu return *static_cast>>(Get()); } + template + constexpr T GetValue() + { + return *this->As(); + } + + template + constexpr void SetValue(T value) + { + *this->As() = value; + } + bool CanAccess() const; private: void* Get() const; }; - } \ No newline at end of file diff --git a/src/game/gta/ScriptLocal.hpp b/src/game/gta/ScriptLocal.hpp index f9d88d9b..580f70be 100644 --- a/src/game/gta/ScriptLocal.hpp +++ b/src/game/gta/ScriptLocal.hpp @@ -2,6 +2,8 @@ #include #include #include +#include +#include namespace YimMenu { @@ -32,6 +34,12 @@ namespace YimMenu } + constexpr ScriptLocal(joaat_t script, std::size_t index) : + ScriptLocal(Scripts::FindScriptThread(script)->m_Stack, index) + { + + } + constexpr ScriptLocal At(std::ptrdiff_t offset) const { return { m_StackPtr, m_Index + offset }; @@ -65,6 +73,18 @@ namespace YimMenu return *static_cast>>(Get()); } + template + constexpr T GetValue() + { + return *this->As(); + } + + template + constexpr void SetValue(T value) + { + *this->As() = value; + } + bool CanAccess() const; private: From 7565dec8a2d10dee670103ab43b05dc8fd15af78 Mon Sep 17 00:00:00 2001 From: kurumimeow Date: Sun, 13 Apr 2025 18:43:02 +0530 Subject: [PATCH 2/3] move cayo perico cooldown into heist tab --- .../features/recovery/CayoPericoCooldown.cpp | 19 -------- .../features/recovery/CayoPericoSetup.cpp | 47 ------------------- .../recovery/Heist/CayoPericoHeist.cpp | 13 +++++ src/game/features/teleport/TpToWaypoint.cpp | 1 - src/game/frontend/submenus/Recovery.cpp | 5 -- .../Recovery/Heist/CayoPericoHeist.cpp | 1 + 6 files changed, 14 insertions(+), 72 deletions(-) delete mode 100644 src/game/features/recovery/CayoPericoCooldown.cpp delete mode 100644 src/game/features/recovery/CayoPericoSetup.cpp diff --git a/src/game/features/recovery/CayoPericoCooldown.cpp b/src/game/features/recovery/CayoPericoCooldown.cpp deleted file mode 100644 index 13ea767c..00000000 --- a/src/game/features/recovery/CayoPericoCooldown.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "core/commands/Command.hpp" -#include "game/gta/Stats.hpp" - -namespace YimMenu::Features -{ - class CayoPericoCooldown : public Command - { - using Command::Command; - - virtual void OnCall() override - { - Stats::SetInt("MPX_H4_TARGET_POSIX", 1); - Stats::SetInt("MPX_H4_COOLDOWN", 1); - Stats::SetInt("MPX_H4_COOLDOWN_HARD", 1); - } - }; - - static CayoPericoCooldown _CayoPericoCooldown{"skipcayocooldown", "Cooldown skip for Cayo Perico Heist", "Skips the cooldown between each Cayo Perico heist"}; -} \ No newline at end of file diff --git a/src/game/features/recovery/CayoPericoSetup.cpp b/src/game/features/recovery/CayoPericoSetup.cpp deleted file mode 100644 index c615bd1c..00000000 --- a/src/game/features/recovery/CayoPericoSetup.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "core/commands/Command.hpp" -#include "game/gta/Stats.hpp" - -namespace YimMenu::Features -{ - class CayoPericoSetup : public Command - { - using Command::Command; - - virtual void OnCall() override - { - Stats::SetInt("MPX_H4CNF_BS_GEN", 131071); - Stats::SetInt("MPX_H4CNF_BS_ENTR", 63); - Stats::SetInt("MPX_H4CNF_BS_ABIL", 63); - Stats::SetInt("MPX_H4CNF_WEAPONS", 2); - Stats::SetInt("MPX_H4CNF_WEP_DISRP", 3); - Stats::SetInt("MPX_H4CNF_ARM_DISRP", 3); - Stats::SetInt("MPX_H4CNF_HEL_DISRP", 3); - Stats::SetInt("MPX_H4CNF_TARGET", 5); - Stats::SetInt("MPX_H4CNF_TROJAN", 4); - Stats::SetInt("MPX_H4CNF_APPROACH", -1); - Stats::SetInt("MPX_H4LOOT_CASH_I", 0); - Stats::SetInt("MPX_H4LOOT_CASH_C", 0); - Stats::SetInt("MPX_H4LOOT_WEED_I", 0); - Stats::SetInt("MPX_H4LOOT_WEED_C", 0); - Stats::SetInt("MPX_H4LOOT_COKE_I", 0); - Stats::SetInt("MPX_H4LOOT_COKE_C", 0); - Stats::SetInt("MPX_H4LOOT_GOLD_I", -1); - Stats::SetInt("MPX_H4LOOT_GOLD_C", -1); - Stats::SetInt("MPX_H4LOOT_PAINT", -1); - Stats::SetInt("MPX_H4_PROGRESS", 131055); - Stats::SetInt("MPX_H4LOOT_CASH_I_SCOPED", 0); - Stats::SetInt("MPX_H4LOOT_CASH_C_SCOPED", 0); - Stats::SetInt("MPX_H4LOOT_WEED_I_SCOPED", 0); - Stats::SetInt("MPX_H4LOOT_WEED_C_SCOPED", 0); - Stats::SetInt("MPX_H4LOOT_COKE_I_SCOPED", 0); - Stats::SetInt("MPX_H4LOOT_COKE_C_SCOPED", 0); - Stats::SetInt("MPX_H4LOOT_GOLD_I_SCOPED", -1); - Stats::SetInt("MPX_H4LOOT_GOLD_C_SCOPED", -1); - Stats::SetInt("MPX_H4LOOT_PAINT_SCOPED", -1); - Stats::SetInt("MPX_H4_MISSIONS", 65535); - Stats::SetInt("MPX_H4_PLAYTHROUGH_STATUS", 40000); - } - }; - - static CayoPericoSetup _CayoPericoSetup{"skipcayosetup", "Setup Cayo Perico Heist", "Gives the best cayo perico loadout."}; -} \ No newline at end of file diff --git a/src/game/features/recovery/Heist/CayoPericoHeist.cpp b/src/game/features/recovery/Heist/CayoPericoHeist.cpp index b5219e37..f003f3e1 100644 --- a/src/game/features/recovery/Heist/CayoPericoHeist.cpp +++ b/src/game/features/recovery/Heist/CayoPericoHeist.cpp @@ -148,6 +148,18 @@ namespace YimMenu::Features } }; + class SkipCooldown : public Command + { + using Command::Command; + + virtual void OnCall() override + { + Stats::SetInt("MPX_H4_TARGET_POSIX", 1); + Stats::SetInt("MPX_H4_COOLDOWN", 1); + Stats::SetInt("MPX_H4_COOLDOWN_HARD", 1); + } + }; + class SkipHacking : public Command { using Command::Command; @@ -221,6 +233,7 @@ namespace YimMenu::Features static Setup _CayoPericoHeistSetup{"cayopericoheistsetup", "Setup", "Sets up cayo perico heist"}; static SetPrimaryTargetValue _CayoPericoHeistSetPrimaryTargetValue{"cayopericoheistsetprimarytargetvalue", "Set Primary Target Value", "Updates primary target value"}; static SetSecondaryTakeValue _CayoPericoHeistSetSecondaryTakeValue{"cayopericoheistsetsecondarytakevalue", "Set Secondary Take Value", "Updates secondary take value"}; + static SkipCooldown _CayoPericoHeistSkipCooldown{"cayopericoheistskipcooldown", "Skip Cooldown", "Skips the cooldown between each Cayo Perico heist"}; static SkipHacking _CayoPericoHeistSkipHacking{"cayopericoheistskiphacking", "Skip Hacking", "Skips hacking process"}; static CutSewer _CayoPericoHeistCutSewer{"cayopericoheistcutsewer", "Cut Sewer", "Cuts the sewer"}; static CutGlass _CayoPericoHeistCutGlass{"cayopericoheistcutglass", "Cut Glass", "Cuts the glass"}; diff --git a/src/game/features/teleport/TpToWaypoint.cpp b/src/game/features/teleport/TpToWaypoint.cpp index 153b604d..9271dc30 100644 --- a/src/game/features/teleport/TpToWaypoint.cpp +++ b/src/game/features/teleport/TpToWaypoint.cpp @@ -75,7 +75,6 @@ namespace YimMenu::Features auto new_coords{coords}; ResolveZCoordinate(new_coords); Self::GetPed().TeleportTo(new_coords); - ScriptMgr::Yield(); }); HUD::SET_WAYPOINT_OFF(); } diff --git a/src/game/frontend/submenus/Recovery.cpp b/src/game/frontend/submenus/Recovery.cpp index 04dd7b5a..60e76fcd 100644 --- a/src/game/frontend/submenus/Recovery.cpp +++ b/src/game/frontend/submenus/Recovery.cpp @@ -14,7 +14,6 @@ namespace YimMenu::Submenus auto missions = std::make_shared("Missions"); auto vehiclesGroup = std::make_shared("Vehicles"); auto generalGroup = std::make_shared("General"); - auto cayoPericoGroup = std::make_shared("Cayo Perico"); vehiclesGroup->AddItem(std::make_shared("dlcvehicles"_J)); @@ -31,12 +30,8 @@ namespace YimMenu::Submenus generalGroup->AddItem(std::make_shared("playallmissionssolo"_J)); generalGroup->AddItem(std::make_shared("forcelaunchheist"_J)); - cayoPericoGroup->AddItem(std::make_shared("skipcayosetup"_J)); - cayoPericoGroup->AddItem(std::make_shared("skipcayocooldown"_J)); - shopping->AddItem(vehiclesGroup); missions->AddItem(generalGroup); - missions->AddItem(cayoPericoGroup); AddCategory(std::move(shopping)); AddCategory(std::move(missions)); AddCategory(BuildStatEditorMenu()); diff --git a/src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.cpp b/src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.cpp index d60fbf9b..9091e3b5 100644 --- a/src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.cpp +++ b/src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.cpp @@ -40,6 +40,7 @@ namespace YimMenu::Submenus })); sep->AddItem(std::make_shared("cayopericoheistsetsecondarytakevalue"_J)); + misc->AddItem(std::make_shared("cayopericoheistskipcooldown"_J)); misc->AddItem(std::make_shared("cayopericoheistskiphacking"_J)); misc->AddItem(std::make_shared("cayopericoheistcutsewer"_J)); misc->AddItem(std::make_shared("cayopericoheistcutglass"_J)); From a84e1c864340edec625222892721f319a71213f7 Mon Sep 17 00:00:00 2001 From: kurumimeow Date: Sun, 20 Apr 2025 01:55:25 +0530 Subject: [PATCH 3/3] fixes - used tunables instead of globals for primary target - removed cayo perico "remove cooldown" as setup gets the job done --- src/core/commands/ListCommand.cpp | 6 + src/core/commands/ListCommand.hpp | 1 + .../recovery/Heist/ApartmentHeist.cpp | 65 ++++--- .../recovery/Heist/CayoPericoHeist.cpp | 88 +++++---- .../recovery/Heist/DiamondCasinoHeist.cpp | 173 +++++++++++++----- .../features/recovery/Heist/DoomsdayHeist.cpp | 59 +++--- .../Recovery/Heist/CayoPericoHeist.cpp | 23 +-- .../Recovery/Heist/DiamondCasinoHeist.cpp | 50 +++-- src/game/gta/ScriptGlobal.hpp | 12 -- src/game/gta/ScriptLocal.hpp | 12 -- 10 files changed, 284 insertions(+), 205 deletions(-) diff --git a/src/core/commands/ListCommand.cpp b/src/core/commands/ListCommand.cpp index d65c5e58..cdc680b9 100644 --- a/src/core/commands/ListCommand.cpp +++ b/src/core/commands/ListCommand.cpp @@ -38,6 +38,12 @@ namespace YimMenu MarkDirty(); } + void ListCommand::SetList(std::vector> list) + { + m_List = std::move(list); + MarkDirty(); + } + std::vector>& ListCommand::GetList() { return m_List; diff --git a/src/core/commands/ListCommand.hpp b/src/core/commands/ListCommand.hpp index 8dca5f70..4738c842 100644 --- a/src/core/commands/ListCommand.hpp +++ b/src/core/commands/ListCommand.hpp @@ -18,6 +18,7 @@ namespace YimMenu ListCommand(std::string name, std::string label, std::string description, std::vector> list, int def_val = 0); int GetState(); void SetState(int state); + void SetList(std::vector> list); std::vector>& GetList(); }; } \ No newline at end of file diff --git a/src/game/features/recovery/Heist/ApartmentHeist.cpp b/src/game/features/recovery/Heist/ApartmentHeist.cpp index e2961619..d23ef763 100644 --- a/src/game/features/recovery/Heist/ApartmentHeist.cpp +++ b/src/game/features/recovery/Heist/ApartmentHeist.cpp @@ -1,18 +1,20 @@ #include "core/commands/IntCommand.hpp" #include "core/commands/Command.hpp" #include "game/gta/Stats.hpp" +#include "game/backend/Players.hpp" #include "game/gta/ScriptGlobal.hpp" #include "game/gta/ScriptLocal.hpp" #include "core/backend/ScriptMgr.hpp" +#include "types/script/globals/GlobalPlayerBD.hpp" namespace YimMenu::Features { namespace ApartmentHeist { static IntCommand _ApartmentHeistCut1{"apartmentheistcut1", "Player 1", "Player 1 cut", std::nullopt, std::nullopt, 0}; - static IntCommand _ApartmentHeistCut2{"apartmentheistcut2", "Player 2", "Player 1 cut", std::nullopt, std::nullopt, 0}; - static IntCommand _ApartmentHeistCut3{"apartmentheistcut3", "Player 3", "Player 1 cut", std::nullopt, std::nullopt, 0}; - static IntCommand _ApartmentHeistCut4{"apartmentheistcut4", "Player 4", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _ApartmentHeistCut2{"apartmentheistcut2", "Player 2", "Player 2 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _ApartmentHeistCut3{"apartmentheistcut3", "Player 3", "Player 3 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _ApartmentHeistCut4{"apartmentheistcut4", "Player 4", "Player 4 cut", std::nullopt, std::nullopt, 0}; class SetCuts : public Command { @@ -20,17 +22,20 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptGlobal(1929794 + 1 + 1).SetValue(100 - (_ApartmentHeistCut1.GetState() + _ApartmentHeistCut2.GetState() + _ApartmentHeistCut3.GetState() + _ApartmentHeistCut4.GetState())); - ScriptGlobal(1929794 + 1 + 2).SetValue(_ApartmentHeistCut2.GetState()); - ScriptGlobal(1929794 + 1 + 3).SetValue(_ApartmentHeistCut3.GetState()); - ScriptGlobal(1929794 + 1 + 4).SetValue(_ApartmentHeistCut4.GetState()); + auto base1 = ScriptGlobal(1929794).At(1); + auto base2 = ScriptGlobal(1931762).At(3008); + + *base1.At(1).As() = 100 - (_ApartmentHeistCut1.GetState() + _ApartmentHeistCut2.GetState() + _ApartmentHeistCut3.GetState() + _ApartmentHeistCut4.GetState()); + *base1.At(2).As() = _ApartmentHeistCut2.GetState(); + *base1.At(3).As() = _ApartmentHeistCut3.GetState(); + *base1.At(4).As() = _ApartmentHeistCut4.GetState(); ScriptMgr::Yield(500ms); - ScriptGlobal(1931762 + 3008 + 1).SetValue(-1 * (ScriptGlobal(1929794 + 1 + 1).GetValue() + ScriptGlobal(1929794 + 1 + 2).GetValue() + ScriptGlobal(1929794 + 1 + 3).GetValue() + ScriptGlobal(1929794 + 1 + 4).GetValue() - 100)); - ScriptGlobal(1931762 + 3008 + 2).SetValue(ScriptGlobal(1929794 + 1 + 2).GetValue()); - ScriptGlobal(1931762 + 3008 + 3).SetValue(ScriptGlobal(1929794 + 1 + 3).GetValue()); - ScriptGlobal(1931762 + 3008 + 4).SetValue(ScriptGlobal(1929794 + 1 + 4).GetValue()); + *base2.At(1).As() = -1 * (*base1.At(1).As() + *base1.At(2).As() + *base1.At(3).As() + *base1.At(4).As() - 100); + *base2.At(2).As() = *base1.At(2).As(); + *base2.At(3).As() = *base1.At(3).As(); + *base2.At(4).As() = *base1.At(4).As(); } }; @@ -40,9 +45,13 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptGlobal(2657994 + 1 + (1 * 467) + 269).SetValue(6); - ScriptGlobal(2657994 + 1 + (2 * 467) + 269).SetValue(6); - ScriptGlobal(2657994 + 1 + (3 * 467) + 269).SetValue(6); + if (auto gpbd = GlobalPlayerBD::Get(); gpbd && Scripts::SafeToModifyFreemodeBroadcastGlobals()) + { + for (auto& player : Players::GetPlayers()) + { + gpbd->Entries[player.second.GetId()].HeistCutSelectionStage = 6; + } + } } }; @@ -62,8 +71,8 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptLocal("fm_mission_controller"_J, 12216 + 24).SetValue(7); - ScriptLocal("fm_mission_controller"_J, 10213).SetValue(ScriptLocal("fm_mission_controller"_J, 10213).GetValue() | (1 << 9)); + *ScriptLocal("fm_mission_controller"_J, 12216).At(24).As() = 7; + *ScriptLocal("fm_mission_controller"_J, 10213).As() = *ScriptLocal("fm_mission_controller"_J, 10213).As() | (1 << 9); } }; @@ -73,7 +82,7 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptLocal("fm_mission_controller"_J, 10507 + 11).SetValue(100.0f); + *ScriptLocal("fm_mission_controller"_J, 10507).At(11).As() = 100.0f; } }; @@ -86,12 +95,12 @@ namespace YimMenu::Features Scripts::ForceScriptHost(Scripts::FindScriptThread("fm_mission_controller"_J)); ScriptMgr::Yield(500ms); - ScriptLocal("fm_mission_controller"_J, 20387 + 1725 + 1).SetValue(80); - ScriptLocal("fm_mission_controller"_J, 20387).SetValue(12); - ScriptLocal("fm_mission_controller"_J, 29006 + 1).SetValue(99999); - ScriptLocal("fm_mission_controller"_J, 32462 + 1 + 68).SetValue(99999); + *ScriptLocal("fm_mission_controller"_J, 20387).At(1725).At(1).As() = 80; + *ScriptLocal("fm_mission_controller"_J, 20387).As() = 12; + *ScriptLocal("fm_mission_controller"_J, 29006).At(1).As() = 99999; + *ScriptLocal("fm_mission_controller"_J, 32462).At(1).At(68).As() = 99999; - // TODO: find a way og getting current heist info so that InstantFinishPacific can be implemented here conditionally. + // TODO: find a way of getting current heist info so that InstantFinishPacific can be implemented here conditionally. } }; @@ -104,11 +113,11 @@ namespace YimMenu::Features Scripts::ForceScriptHost(Scripts::FindScriptThread("fm_mission_controller"_J)); ScriptMgr::Yield(500ms); - ScriptLocal("fm_mission_controller"_J, 20387 + 2686).SetValue(1875000); - ScriptLocal("fm_mission_controller"_J, 20387 + 1062).SetValue(5); - ScriptLocal("fm_mission_controller"_J, 20387).SetValue(12); - ScriptLocal("fm_mission_controller"_J, 29006 + 1).SetValue(99999); - ScriptLocal("fm_mission_controller"_J, 32462 + 1 + 68).SetValue(99999); + *ScriptLocal("fm_mission_controller"_J, 20387).At(2686).As() = 1875000; + *ScriptLocal("fm_mission_controller"_J, 20387).At(1062).As() = 5; + *ScriptLocal("fm_mission_controller"_J, 20387).As() = 12; + *ScriptLocal("fm_mission_controller"_J, 29006).At(1).As() = 99999; + *ScriptLocal("fm_mission_controller"_J, 32462).At(1).At(68).As() = 99999; } }; @@ -118,6 +127,6 @@ namespace YimMenu::Features static SkipHacking _ApartmentHeistSkipHacking{"apartmentheistskiphacking", "Skip Hacking", "Skips hacking process"}; static SkipDrilling _ApartmentHeistSkipDrilling{"apartmentheistskipdrilling", "Skip Drilling", "Skips drilling process"}; static InstantFinish _ApartmentHeistInstantFinish{"apartmentheistinstantfinish", "Instant Finish", "Instantly passes the heist"}; - static InstantFinishPacific _ApartmentHeistInstantFinishPacific{"apartmentheistinstantfinishpacific", "Instant Finish (Pacific)", "Instantly passes the heist"}; + static InstantFinishPacific _ApartmentHeistInstantFinishPacific{"apartmentheistinstantfinishpacific", "Instant Finish (Pacific)", "Instantly passes Pacific Standard Job"}; } } \ No newline at end of file diff --git a/src/game/features/recovery/Heist/CayoPericoHeist.cpp b/src/game/features/recovery/Heist/CayoPericoHeist.cpp index f003f3e1..401c5dfc 100644 --- a/src/game/features/recovery/Heist/CayoPericoHeist.cpp +++ b/src/game/features/recovery/Heist/CayoPericoHeist.cpp @@ -7,15 +7,16 @@ #include "game/gta/ScriptGlobal.hpp" #include "game/gta/ScriptLocal.hpp" #include "core/backend/ScriptMgr.hpp" +#include "game/backend/Tunables.hpp" namespace YimMenu::Features { namespace CayoPericoHeist { static IntCommand _CayoPericoHeistCut1{"cayopericoheistcut1", "Player 1", "Player 1 cut", std::nullopt, std::nullopt, 0}; - static IntCommand _CayoPericoHeistCut2{"cayopericoheistcut2", "Player 2", "Player 1 cut", std::nullopt, std::nullopt, 0}; - static IntCommand _CayoPericoHeistCut3{"cayopericoheistcut3", "Player 3", "Player 1 cut", std::nullopt, std::nullopt, 0}; - static IntCommand _CayoPericoHeistCut4{"cayopericoheistcut4", "Player 4", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _CayoPericoHeistCut2{"cayopericoheistcut2", "Player 2", "Player 2 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _CayoPericoHeistCut3{"cayopericoheistcut3", "Player 3", "Player 3 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _CayoPericoHeistCut4{"cayopericoheistcut4", "Player 4", "Player 4 cut", std::nullopt, std::nullopt, 0}; class SetCuts : public Command { @@ -23,10 +24,12 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptGlobal(1973698 + 831 + 56 + 1).SetValue(_CayoPericoHeistCut1.GetState()); - ScriptGlobal(1973698 + 831 + 56 + 2).SetValue(_CayoPericoHeistCut2.GetState()); - ScriptGlobal(1973698 + 831 + 56 + 3).SetValue(_CayoPericoHeistCut3.GetState()); - ScriptGlobal(1973698 + 831 + 56 + 4).SetValue(_CayoPericoHeistCut4.GetState()); + auto base = ScriptGlobal(1973698).At(831).At(56); + + *base.At(1).As() = _CayoPericoHeistCut1.GetState(); + *base.At(2).As() = _CayoPericoHeistCut2.GetState(); + *base.At(3).As() = _CayoPericoHeistCut3.GetState(); + *base.At(4).As() = _CayoPericoHeistCut4.GetState(); } }; @@ -36,9 +39,12 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptGlobal(1974810 + 1 + (1 * 27) + 8 + 1).SetValue(1); - ScriptGlobal(1974810 + 1 + (2 * 27) + 8 + 2).SetValue(1); - ScriptGlobal(1974810 + 1 + (3 * 27) + 8 + 3).SetValue(1); + auto base = ScriptGlobal(1974810); + + *base.At(0, 27).At(8).At(0).As() = 1; + *base.At(1, 27).At(8).At(1).As() = 1; + *base.At(2, 27).At(8).At(2).As() = 1; + *base.At(3, 27).At(8).At(3).As() = 1; } }; @@ -65,7 +71,7 @@ namespace YimMenu::Features {4, "Saboteur"}, {5, "Marksman"} }; - static ListCommand _CayoPericoHeistWeapon{"cayopericoheistweapon", "Weapon", "Weapon category", cayoPericoHeistWeapon, 2}; + static ListCommand _CayoPericoHeistWeapon{"cayopericoheistweapon", "Weapon", "Weapon category", cayoPericoHeistWeapon, 1}; class Setup : public Command { @@ -115,7 +121,7 @@ namespace YimMenu::Features ScriptMgr::Yield(500ms); - ScriptLocal("heist_island_planning"_J, 1566).SetValue(2); // Reload Planning Screen + *ScriptLocal("heist_island_planning"_J, 1566).As() = 2; } }; @@ -127,11 +133,17 @@ namespace YimMenu::Features virtual void OnCall() override { - int primary_target = Stats::GetInt("MPX_H4CNF_TARGET"); + auto primary_target = Stats::GetInt("MPX_H4CNF_TARGET"); - if (0 <= primary_target && primary_target <= 5) + switch (primary_target) { - ScriptGlobal(262145 + 29496 + primary_target).SetValue(_CayoPericoHeistPrimaryTargetValue.GetState()); + case 0: *Tunables::GetTunable("IH_PRIMARY_TARGET_VALUE_TEQUILA"_J).As() = _CayoPericoHeistPrimaryTargetValue.GetState(); break; + case 1: *Tunables::GetTunable("IH_PRIMARY_TARGET_VALUE_PEARL_NECKLACE"_J).As() = _CayoPericoHeistPrimaryTargetValue.GetState(); break; + case 2: *Tunables::GetTunable("IH_PRIMARY_TARGET_VALUE_BEARER_BONDS"_J).As() = _CayoPericoHeistPrimaryTargetValue.GetState(); break; + case 3: *Tunables::GetTunable("IH_PRIMARY_TARGET_VALUE_PINK_DIAMOND"_J).As() = _CayoPericoHeistPrimaryTargetValue.GetState(); break; + case 4: *Tunables::GetTunable("IH_PRIMARY_TARGET_VALUE_MADRAZO_FILES"_J).As() = _CayoPericoHeistPrimaryTargetValue.GetState(); break; + case 5: *Tunables::GetTunable("IH_PRIMARY_TARGET_VALUE_SAPPHIRE_PANTHER_STATUE"_J).As() = _CayoPericoHeistPrimaryTargetValue.GetState(); break; + default: break; } } }; @@ -144,19 +156,7 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptLocal("fm_mission_controller_2020"_J, 56033 + 1518 + 53).SetValue(_CayoPericoHeistSecondaryTakeValue.GetState()); - } - }; - - class SkipCooldown : public Command - { - using Command::Command; - - virtual void OnCall() override - { - Stats::SetInt("MPX_H4_TARGET_POSIX", 1); - Stats::SetInt("MPX_H4_COOLDOWN", 1); - Stats::SetInt("MPX_H4_COOLDOWN_HARD", 1); + *ScriptLocal("fm_mission_controller_2020"_J, 56033).At(1518).At(53).As() = _CayoPericoHeistSecondaryTakeValue.GetState(); } }; @@ -166,7 +166,7 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptLocal("fm_mission_controller_2020"_J, 25388).SetValue(5); + *ScriptLocal("fm_mission_controller_2020"_J, 25388).As() = 5; } }; @@ -176,7 +176,7 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptLocal("fm_mission_controller_2020"_J, 30212).SetValue(6); + *ScriptLocal("fm_mission_controller_2020"_J, 30212).As() = 6; } }; @@ -186,7 +186,7 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptLocal("fm_mission_controller_2020"_J, 31451 + 3).SetValue(100.0f); + *ScriptLocal("fm_mission_controller_2020"_J, 31451).At(3).As() = 100.0f; } }; @@ -203,14 +203,29 @@ namespace YimMenu::Features auto pos = ped.GetPosition(); auto heading = ped.GetHeading(); + auto primary_target = Stats::GetInt("MPX_H4CNF_TARGET"); TASK::TASK_GO_STRAIGHT_TO_COORD(ped.GetHandle(), 5006.917, -5755.931, 15.484, 1.0, 3, 15, 5); - ScriptLocal("fm_mission_controller_2020"_J, 31450).SetValue(5); - ScriptLocal("fm_mission_controller_2020"_J, 31451).SetValue(3); + + switch (primary_target) + { + case 0: + case 1: + case 3: + case 5: + *ScriptLocal("fm_mission_controller_2020"_J, 31450).As() = 5; + *ScriptLocal("fm_mission_controller_2020"_J, 31451).As() = 3; + break; + case 2: + case 4: + *ScriptLocal("fm_mission_controller_2020"_J, 31426).As() = 7; + break; + default: break; + } ScriptMgr::Yield(4000ms); - TASK::TASK_GO_STRAIGHT_TO_COORD(ped.GetHandle(), pos.x, pos.y, pos.z, 1.0, 3, heading, 5); + TASK::TASK_GO_STRAIGHT_TO_COORD(ped.GetHandle(), pos.x, pos.y, pos.z, 1.0, 3, heading, 5); } }; @@ -223,8 +238,8 @@ namespace YimMenu::Features Scripts::ForceScriptHost(Scripts::FindScriptThread("fm_mission_controller_2020"_J)); ScriptMgr::Yield(500ms); - ScriptLocal("fm_mission_controller_2020"_J, 52581).SetValue(9); - ScriptLocal("fm_mission_controller_2020"_J, 52581 + 1776 + 1).SetValue(50); + *ScriptLocal("fm_mission_controller_2020"_J, 52581).As() = 9; + *ScriptLocal("fm_mission_controller_2020"_J, 52581).At(1776).At(1).As() = 50; } }; @@ -233,7 +248,6 @@ namespace YimMenu::Features static Setup _CayoPericoHeistSetup{"cayopericoheistsetup", "Setup", "Sets up cayo perico heist"}; static SetPrimaryTargetValue _CayoPericoHeistSetPrimaryTargetValue{"cayopericoheistsetprimarytargetvalue", "Set Primary Target Value", "Updates primary target value"}; static SetSecondaryTakeValue _CayoPericoHeistSetSecondaryTakeValue{"cayopericoheistsetsecondarytakevalue", "Set Secondary Take Value", "Updates secondary take value"}; - static SkipCooldown _CayoPericoHeistSkipCooldown{"cayopericoheistskipcooldown", "Skip Cooldown", "Skips the cooldown between each Cayo Perico heist"}; static SkipHacking _CayoPericoHeistSkipHacking{"cayopericoheistskiphacking", "Skip Hacking", "Skips hacking process"}; static CutSewer _CayoPericoHeistCutSewer{"cayopericoheistcutsewer", "Cut Sewer", "Cuts the sewer"}; static CutGlass _CayoPericoHeistCutGlass{"cayopericoheistcutglass", "Cut Glass", "Cuts the glass"}; diff --git a/src/game/features/recovery/Heist/DiamondCasinoHeist.cpp b/src/game/features/recovery/Heist/DiamondCasinoHeist.cpp index 663b300f..0fa8ac0d 100644 --- a/src/game/features/recovery/Heist/DiamondCasinoHeist.cpp +++ b/src/game/features/recovery/Heist/DiamondCasinoHeist.cpp @@ -2,18 +2,20 @@ #include "core/commands/IntCommand.hpp" #include "core/commands/ListCommand.hpp" #include "game/gta/Stats.hpp" +#include "core/backend/FiberPool.hpp" #include "game/gta/ScriptGlobal.hpp" #include "game/gta/ScriptLocal.hpp" #include "core/backend/ScriptMgr.hpp" +#include "game/backend/Tunables.hpp" namespace YimMenu::Features { namespace DiamondCasinoHeist { static IntCommand _DiamondCasinoHeistCut1{"diamondcasinoheistcut1", "Player 1", "Player 1 cut", std::nullopt, std::nullopt, 0}; - static IntCommand _DiamondCasinoHeistCut2{"diamondcasinoheistcut2", "Player 2", "Player 1 cut", std::nullopt, std::nullopt, 0}; - static IntCommand _DiamondCasinoHeistCut3{"diamondcasinoheistcut3", "Player 3", "Player 1 cut", std::nullopt, std::nullopt, 0}; - static IntCommand _DiamondCasinoHeistCut4{"diamondcasinoheistcut4", "Player 4", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _DiamondCasinoHeistCut2{"diamondcasinoheistcut2", "Player 2", "Player 2 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _DiamondCasinoHeistCut3{"diamondcasinoheistcut3", "Player 3", "Player 3 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _DiamondCasinoHeistCut4{"diamondcasinoheistcut4", "Player 4", "Player 4 cut", std::nullopt, std::nullopt, 0}; class SetCuts : public Command { @@ -21,10 +23,12 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptGlobal(1966898 + 1497 + 736 + 92 + 1).SetValue(_DiamondCasinoHeistCut1.GetState()); - ScriptGlobal(1966898 + 1497 + 736 + 92 + 2).SetValue(_DiamondCasinoHeistCut2.GetState()); - ScriptGlobal(1966898 + 1497 + 736 + 92 + 3).SetValue(_DiamondCasinoHeistCut3.GetState()); - ScriptGlobal(1966898 + 1497 + 736 + 92 + 4).SetValue(_DiamondCasinoHeistCut4.GetState()); + auto base = ScriptGlobal(1966898).At(1497).At(736).At(92); + + *base.At(1).As() = _DiamondCasinoHeistCut1.GetState(); + *base.At(2).As() = _DiamondCasinoHeistCut2.GetState(); + *base.At(3).As() = _DiamondCasinoHeistCut3.GetState(); + *base.At(4).As() = _DiamondCasinoHeistCut4.GetState(); } }; @@ -34,9 +38,12 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptGlobal(1971261 + 1 + (1 * 68) + 8 + 1).SetValue(1); - ScriptGlobal(1971261 + 1 + (2 * 68) + 8 + 2).SetValue(1); - ScriptGlobal(1971261 + 1 + (3 * 68) + 8 + 3).SetValue(1); + auto base = ScriptGlobal(1971261); + + *base.At(0, 68).At(8).At(0).As() = 1; + *base.At(1, 68).At(8).At(1).As() = 1; + *base.At(2, 68).At(8).At(2).As() = 1; + *base.At(3, 68).At(8).At(3).As() = 1; } }; @@ -54,12 +61,42 @@ namespace YimMenu::Features }; static ListCommand _DiamondCasinoHeistPrimaryTarget{"diamondcasinoheistprimarytarget", "Primary Target", "Primary target", diamondCasinoHeistPrimaryTarget, 3}; - static std::vector> diamondCasinoHeistApproach = { - {0, "Silent & Sneaky"}, - {1, "The Big Con"}, - {2, "Aggressive"} + static ListCommand* _DiamondCasinoHeistGunmanPtr = nullptr; + static ListCommand* _DiamondCasinoHeistApproachPtr = nullptr; + + static std::vector>>> diamondCasinoHeistWeapon = { + { + {{0, "MK II Shotgun Loadout"}, {1, "MK II Rifle Loadout"}}, + {{0, "MK II SMG Loadout"}, {1, "MK II Rifle Loadout"}}, + {{0, "MK II Shotgun Loadout"}, {1, "MK II Rifle Loadout"}} + }, + { + {{0, "Rifle Loadout"}, {1, "Shotgun Loadout"}}, + {{0, "Rifle Loadout"}, {1, "Shotgun Loadout"}}, + {{0, "Rifle Loadout"}, {1, "Shotgun Loadout"}} + }, + { + {{0, "Combat PDW Loadout"}, {1, "Rifle Loadout"}}, + {{0, "Shotgun Loadout"}, {1, "Rifle Loadout"}}, + {{0, "Shotgun Loadout"}, {1, "Combat MG Loadout"}} + }, + { + {{0, "SMG Loadout"}, {1, "Shotgun Loadout"}}, + {{0, "Machine Pistol Loadout"}, {1, "Shotgun Loadout"}}, + {{0, "SMG Loadout"}, {1, "Shotgun Loadout"}} + }, + { + {{0, "Micro SMG Loadout"}, {1, "Machine Pistol Loadout"}}, + {{0, "Micro SMG Loadout"}, {1, "Shotgun Loadout"}}, + {{0, "Shotgun Loadout"}, {1, "Revolver Loadout"}} + }, + { + {{0, " "}, {1, ""}}, + {{0, ""}, {1, ""}}, + {{0, ""}, {1, ""}} + } }; - static ListCommand _DiamondCasinoHeistApproach{"diamondcasinoheistapproach", "Approach", "Heist approach", diamondCasinoHeistApproach, 0}; + static ListCommand _DiamondCasinoHeistWeapon{"diamondcasinoheistweapon", "Weapon", "Weapon", diamondCasinoHeistWeapon[5][0], 0}; static std::vector> diamondCasinoHeistGunman = { {0, "Chester McCoy"}, @@ -69,13 +106,55 @@ namespace YimMenu::Features {4, "Karl Abolaji"}, {5, "Remove Gunman"} }; - static ListCommand _DiamondCasinoHeistGunman{"diamondcasinoheistgunman", "Gunman", "Gunman", diamondCasinoHeistGunman, 0}; - static std::vector> diamondCasinoHeistWeapons = { - {0, "Weapon 1"}, - {1, "Weapon 2"} + class Gunman : public ListCommand + { + using ListCommand::ListCommand; + + virtual void OnChange() override + { + _DiamondCasinoHeistWeapon.SetList(diamondCasinoHeistWeapon[this->GetState()][_DiamondCasinoHeistApproachPtr->GetState()]); + _DiamondCasinoHeistWeapon.SetState(0); + } + }; + static Gunman _DiamondCasinoHeistGunman{"diamondcasinoheistgunman", "Gunman", "Gunman", diamondCasinoHeistGunman, 5}; + + static std::vector> diamondCasinoHeistApproach = { + {0, "Silent & Sneaky"}, + {1, "The Big Con"}, + {2, "Aggressive"} + }; + + class Approach : public ListCommand + { + using ListCommand::ListCommand; + + virtual void OnChange() override + { + _DiamondCasinoHeistWeapon.SetList(diamondCasinoHeistWeapon[_DiamondCasinoHeistGunmanPtr->GetState()][this->GetState()]); + _DiamondCasinoHeistWeapon.SetState(0); + } }; - static ListCommand _DiamondCasinoHeistWeapon{"diamondcasinoheistweapon", "Weapon", "Weapon", diamondCasinoHeistWeapons, 0}; + static Approach _DiamondCasinoHeistApproach{"diamondcasinoheistapproach", "Approach", "Heist approach", diamondCasinoHeistApproach, 0}; + + static struct InitPtrs + { + InitPtrs() + { + _DiamondCasinoHeistGunmanPtr = &_DiamondCasinoHeistGunman; + _DiamondCasinoHeistApproachPtr = &_DiamondCasinoHeistApproach; + } + } _initPtrs; + + static std::vector>> diamondCasinoHeistVehicle = { + {{0, "Zhaba"}, {1, "Vagrant"}, {2, "Outlaw"}, {3, "Everon"}}, + {{0, "Sultan Classic"}, {1, "Gauntlet Classic"}, {2, "Ellie"}, {3, "Komoda"}}, + {{0, "Retinue MK II"}, {1, "Drifty Yosemite"}, {2, "Sugoi"}, {3, "Jugular"}}, + {{0, "Manchez"}, {1, "Stryder"}, {2, "Defiler"}, {3, "Lectro"}}, + {{0, "Issi Classic"}, {1, "Asbo"}, {2, "Kanjo"}, {3, "Sentinel Classic"}}, + {{0, " "}, {1, ""}, {2, ""}, {3, ""}} + }; + static ListCommand _DiamondCasinoHeistVehicle{"diamondcasinoheistvehicle", "Vehicle", "Vehicle", diamondCasinoHeistVehicle[5], 0}; static std::vector> diamondCasinoHeistDriver = { {0, "Chester McCoy"}, @@ -85,12 +164,18 @@ namespace YimMenu::Features {4, "Karim Denz"}, {5, "Remove Driver"} }; - static ListCommand _DiamondCasinoHeistDriver{"diamondcasinoheistdriver", "Driver", "Driver", diamondCasinoHeistDriver, 0}; - static std::vector> diamondCasinoHeistVehicles = { - {0, "Vehicle 1"}, {1, "Vehicle 2"}, {2, "Vehicle 3"}, {3, "Vehicle 4"} + class Driver : public ListCommand + { + using ListCommand::ListCommand; + + virtual void OnChange() override + { + _DiamondCasinoHeistVehicle.SetList(diamondCasinoHeistVehicle[this->GetState()]); + _DiamondCasinoHeistVehicle.SetState(0); + } }; - static ListCommand _DiamondCasinoHeistVehicle{"diamondcasinoheistvehicle", "Vehicle", "Vehicle", diamondCasinoHeistVehicles, 0}; + static Driver _DiamondCasinoHeistDriver{"diamondcasinoheistdriver", "Driver", "Driver", diamondCasinoHeistDriver, 5}; static std::vector> diamondCasinoHeistHacker = { {4, "Avi Schwartzman"}, @@ -100,7 +185,7 @@ namespace YimMenu::Features {1, "Rickie Lukens"}, {6, "Remove Hacker"} }; - static ListCommand _DiamondCasinoHeistHacker{"diamondcasinoheisthacker", "Hacker", "Hacker", diamondCasinoHeistHacker, 4}; + static ListCommand _DiamondCasinoHeistHacker{"diamondcasinoheisthacker", "Hacker", "Hacker", diamondCasinoHeistHacker, 6}; class Setup : public Command { @@ -174,16 +259,13 @@ namespace YimMenu::Features { int primary_target = Stats::GetInt("MPX_H3OPT_TARGET"); - if (0 <= primary_target && primary_target <= 3) + switch (primary_target) { - switch (primary_target) - { - case 0: ScriptGlobal(262145 + 28347 + 0).SetValue(_DiamondCasinoHeistPotentialTake.GetState()); break; // "Cash" - case 1: ScriptGlobal(262145 + 28347 + 2).SetValue(_DiamondCasinoHeistPotentialTake.GetState()); break; // "Gold" - case 2: ScriptGlobal(262145 + 28347 + 1).SetValue(_DiamondCasinoHeistPotentialTake.GetState()); break; // "Artwork" - case 3: ScriptGlobal(262145 + 28347 + 3).SetValue(_DiamondCasinoHeistPotentialTake.GetState()); break; // "Diamond" - default: break; - } + case 0: *Tunables::GetTunable(static_cast(-1638885821)).As() = _DiamondCasinoHeistPotentialTake.GetState(); break; // "Cash" + case 1: *Tunables::GetTunable(static_cast(-582734553)).As() = _DiamondCasinoHeistPotentialTake.GetState(); break; // "Gold" + case 2: *Tunables::GetTunable(static_cast(1934398910)).As() = _DiamondCasinoHeistPotentialTake.GetState(); break; // "Artwork" + case 3: *Tunables::GetTunable(static_cast(1277889925)).As() = _DiamondCasinoHeistPotentialTake.GetState(); break; // "Diamond" + default: break; } } }; @@ -196,7 +278,7 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptLocal("fm_mission_controller"_J, 20387 + 2686).SetValue(_DiamondCasinoHeistActualTake.GetState()); + *ScriptLocal("fm_mission_controller"_J, 20387).At(2686).As() = _DiamondCasinoHeistActualTake.GetState(); } }; @@ -206,11 +288,8 @@ namespace YimMenu::Features virtual void OnCall() override { - if (ScriptLocal("fm_mission_controller"_J, 53999).GetValue() != 1) - ScriptLocal("fm_mission_controller"_J, 53999).SetValue(5); // Fingerprint - - if (ScriptLocal("fm_mission_controller"_J, 55065).GetValue() != 1) - ScriptLocal("fm_mission_controller"_J, 55065).SetValue(5); // Keypad + *ScriptLocal("fm_mission_controller"_J, 53999).As() = 5; + *ScriptLocal("fm_mission_controller"_J, 55065).As() = 5; } }; @@ -220,7 +299,7 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptLocal("fm_mission_controller"_J, 10547 + 7).SetValue(ScriptLocal("fm_mission_controller"_J, 10547 + 37).GetValue()); + *ScriptLocal("fm_mission_controller"_J, 10547).At(7).As() = *ScriptLocal("fm_mission_controller"_J, 10547).At(37).As(); } }; @@ -233,12 +312,12 @@ namespace YimMenu::Features Scripts::ForceScriptHost(Scripts::FindScriptThread("fm_mission_controller"_J)); ScriptMgr::Yield(500ms); - ScriptLocal("fm_mission_controller"_J, 20387 + 1740 + 1).SetValue(80); - ScriptLocal("fm_mission_controller"_J, 20387 + 2686).SetValue(4443220); - ScriptLocal("fm_mission_controller"_J, 20387 + 1062).SetValue(5); - ScriptLocal("fm_mission_controller"_J, 20387).SetValue(12); - ScriptLocal("fm_mission_controller"_J, 29006 + 1).SetValue(99999); - ScriptLocal("fm_mission_controller"_J, 32462 + 1 + 68).SetValue(99999); + *ScriptLocal("fm_mission_controller"_J, 20387).At(1740).At(1).As() = 80; + *ScriptLocal("fm_mission_controller"_J, 20387).At(2686).As() = 4443220; + *ScriptLocal("fm_mission_controller"_J, 20387).At(1062).As() = 5; + *ScriptLocal("fm_mission_controller"_J, 20387).As() = 12; + *ScriptLocal("fm_mission_controller"_J, 29006).At(1).As() = 99999; + *ScriptLocal("fm_mission_controller"_J, 32462).At(1).At(68).As() = 99999; } }; diff --git a/src/game/features/recovery/Heist/DoomsdayHeist.cpp b/src/game/features/recovery/Heist/DoomsdayHeist.cpp index 0884f412..2431dd31 100644 --- a/src/game/features/recovery/Heist/DoomsdayHeist.cpp +++ b/src/game/features/recovery/Heist/DoomsdayHeist.cpp @@ -11,9 +11,9 @@ namespace YimMenu::Features namespace DoomsdayHeist { static IntCommand _DoomsdayHeistCut1{"doomsdayheistcut1", "Player 1", "Player 1 cut", std::nullopt, std::nullopt, 0}; - static IntCommand _DoomsdayHeistCut2{"doomsdayheistcut2", "Player 2", "Player 1 cut", std::nullopt, std::nullopt, 0}; - static IntCommand _DoomsdayHeistCut3{"doomsdayheistcut3", "Player 3", "Player 1 cut", std::nullopt, std::nullopt, 0}; - static IntCommand _DoomsdayHeistCut4{"doomsdayheistcut4", "Player 4", "Player 1 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _DoomsdayHeistCut2{"doomsdayheistcut2", "Player 2", "Player 2 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _DoomsdayHeistCut3{"doomsdayheistcut3", "Player 3", "Player 3 cut", std::nullopt, std::nullopt, 0}; + static IntCommand _DoomsdayHeistCut4{"doomsdayheistcut4", "Player 4", "Player 4 cut", std::nullopt, std::nullopt, 0}; class SetCuts : public Command { @@ -21,10 +21,12 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptGlobal(1962078 + 812 + 50 + 1).SetValue(_DoomsdayHeistCut1.GetState()); - ScriptGlobal(1962078 + 812 + 50 + 2).SetValue(_DoomsdayHeistCut2.GetState()); - ScriptGlobal(1962078 + 812 + 50 + 3).SetValue(_DoomsdayHeistCut3.GetState()); - ScriptGlobal(1962078 + 812 + 50 + 4).SetValue(_DoomsdayHeistCut4.GetState()); + auto base = ScriptGlobal(1962078).At(812).At(50); + + *base.At(1).As() = _DoomsdayHeistCut1.GetState(); + *base.At(2).As() = _DoomsdayHeistCut2.GetState(); + *base.At(3).As() = _DoomsdayHeistCut3.GetState(); + *base.At(4).As() = _DoomsdayHeistCut4.GetState(); } }; @@ -34,9 +36,12 @@ namespace YimMenu::Features virtual void OnCall() override { - ScriptGlobal(1882925 + 1 + (1 * 149) + 43 + 1 + 4 + 8).SetValue(1); - ScriptGlobal(1882925 + 1 + (2 * 149) + 43 + 2 + 4 + 8).SetValue(1); - ScriptGlobal(1882925 + 1 + (3 * 149) + 43 + 3 + 4 + 8).SetValue(1); + auto base = ScriptGlobal(1882925); + + *base.At(0, 149).At(43).At(0).At(4).At(8).As() = 1; + *base.At(1, 149).At(43).At(1).At(4).At(8).As() = 1; + *base.At(2, 149).At(43).At(2).At(4).At(8).As() = 1; + *base.At(3, 149).At(43).At(3).At(4).At(8).As() = 1; } }; @@ -75,7 +80,7 @@ namespace YimMenu::Features ScriptMgr::Yield(500ms); - ScriptLocal("gb_gang_ops_planning"_J, 207).SetValue(6); // Reload planning screen + *ScriptLocal("gb_gang_ops_planning"_J, 207).As() = 6; // Reload planning screen } }; @@ -84,10 +89,10 @@ namespace YimMenu::Features using Command::Command; virtual void OnCall() override - { - ScriptLocal("fm_mission_controller"_J, 1538).SetValue(3); - ScriptLocal("fm_mission_controller"_J, 1569).SetValue(2); - ScriptLocal("fm_mission_controller"_J, 1294 + 135).SetValue(3); + { + *ScriptLocal("fm_mission_controller"_J, 1538).As() = 3; + *ScriptLocal("fm_mission_controller"_J, 1569).As() = 2; + *ScriptLocal("fm_mission_controller"_J, 1294).At(135).As() = 3; } }; @@ -100,12 +105,12 @@ namespace YimMenu::Features Scripts::ForceScriptHost(Scripts::FindScriptThread("fm_mission_controller"_J)); ScriptMgr::Yield(500ms); - ScriptLocal("fm_mission_controller"_J, 20387 + 1725 + 1).SetValue(80); - ScriptLocal("fm_mission_controller"_J, 20387).SetValue(12); - ScriptLocal("fm_mission_controller"_J, 29006 + 1).SetValue(99999); - ScriptLocal("fm_mission_controller"_J, 32462 + 1 + 68).SetValue(99999); + *ScriptLocal("fm_mission_controller"_J, 20387).At(1725).At(1).As() = 80; + *ScriptLocal("fm_mission_controller"_J, 20387).As() = 12; + *ScriptLocal("fm_mission_controller"_J, 29006).At(1).As() = 99999; + *ScriptLocal("fm_mission_controller"_J, 32462).At(1).At(68).As() = 99999; - // TODO: find a way og getting current heist info so that InstantFinishAct3 can be implemented here conditionally. + // TODO: find a way of getting current heist info so that InstantFinishAct3 can be implemented here conditionally. } }; @@ -117,12 +122,12 @@ namespace YimMenu::Features { Scripts::ForceScriptHost(Scripts::FindScriptThread("fm_mission_controller"_J)); ScriptMgr::Yield(500ms); - - ScriptLocal("fm_mission_controller"_J, 20387).SetValue(12); - ScriptLocal("fm_mission_controller"_J, 20387 + 1740 + 1).SetValue(150); - ScriptLocal("fm_mission_controller"_J, 20387 + 1062).SetValue(5); - ScriptLocal("fm_mission_controller"_J, 29006 + 1).SetValue(99999); - ScriptLocal("fm_mission_controller"_J, 32462 + 1 + 68).SetValue(99999); + + *ScriptLocal("fm_mission_controller"_J, 20387).As() = 12; + *ScriptLocal("fm_mission_controller"_J, 20387).At(1740).At(1).As() = 150; + *ScriptLocal("fm_mission_controller"_J, 20387).At(1062).As() = 5; + *ScriptLocal("fm_mission_controller"_J, 29006).At(1).As() = 99999; + *ScriptLocal("fm_mission_controller"_J, 32462).At(1).At(68).As() = 99999; } }; @@ -131,6 +136,6 @@ namespace YimMenu::Features static Setup _DoomsdayHeistSetup{"doomsdayheistsetup", "Setup", "Sets up doomsday heist"}; static SkipHacking _DoomsdayHeistSkipHacking{"doomsdayheistskiphacking", "Skip Hacking", "Skips hacking process"}; static InstantFinish _DoomsdayHeistInstantFinish{"doomsdayheistinstantfinish", "Instant Finish", "Instantly passes the heist"}; - static InstantFinishAct3 _DoomsdayHeistInstantFinishAct3{"doomsdayheistinstantfinishact3", "Instant Finish (Act: III)", "Instantly passes the heist"}; + static InstantFinishAct3 _DoomsdayHeistInstantFinishAct3{"doomsdayheistinstantfinishact3", "Instant Finish (Act: III)", "Instantly passes Doomsday Scenario Act: III"}; } } \ No newline at end of file diff --git a/src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.cpp b/src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.cpp index 9091e3b5..471059f1 100644 --- a/src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.cpp +++ b/src/game/frontend/submenus/Recovery/Heist/CayoPericoHeist.cpp @@ -8,7 +8,7 @@ namespace YimMenu::Submenus auto cuts = std::make_shared("Heist Cuts", 2); auto setups = std::make_shared("Heist Setups"); - auto sep = std::make_shared(""); + auto loots = std::make_shared("Loots"); auto misc = std::make_shared("Misc", 1); cuts->AddItem(std::make_shared("cayopericoheistcut1"_J)); @@ -19,28 +19,21 @@ namespace YimMenu::Submenus cuts->AddItem(std::make_shared("cayopericoheistsetcuts"_J)); setups->AddItem(std::make_shared("cayopericoheistdifficulty"_J)); - setups->AddItem(std::make_shared([] { - ImGui::SameLine(); - })); setups->AddItem(std::make_shared("cayopericoheistprimarytarget"_J)); - setups->AddItem(std::make_shared([] { - ImGui::SameLine(); - })); setups->AddItem(std::make_shared("cayopericoheistweapon"_J)); setups->AddItem(std::make_shared("cayopericoheistsetup"_J)); - sep->AddItem(std::make_shared("cayopericoheistprimarytargetvalue"_J)); - sep->AddItem(std::make_shared([] { + loots->AddItem(std::make_shared("cayopericoheistprimarytargetvalue"_J)); + loots->AddItem(std::make_shared([] { ImGui::SameLine(); })); - sep->AddItem(std::make_shared("cayopericoheistsetprimarytargetvalue"_J)); - sep->AddItem(std::make_shared("cayopericoheistsecondarytakevalue"_J)); - sep->AddItem(std::make_shared([] { + loots->AddItem(std::make_shared("cayopericoheistsetprimarytargetvalue"_J)); + loots->AddItem(std::make_shared("cayopericoheistsecondarytakevalue"_J)); + loots->AddItem(std::make_shared([] { ImGui::SameLine(); })); - sep->AddItem(std::make_shared("cayopericoheistsetsecondarytakevalue"_J)); + loots->AddItem(std::make_shared("cayopericoheistsetsecondarytakevalue"_J)); - misc->AddItem(std::make_shared("cayopericoheistskipcooldown"_J)); misc->AddItem(std::make_shared("cayopericoheistskiphacking"_J)); misc->AddItem(std::make_shared("cayopericoheistcutsewer"_J)); misc->AddItem(std::make_shared("cayopericoheistcutglass"_J)); @@ -49,7 +42,7 @@ namespace YimMenu::Submenus tab->AddItem(cuts); tab->AddItem(setups); - tab->AddItem(sep); + tab->AddItem(loots); tab->AddItem(misc); return tab; diff --git a/src/game/frontend/submenus/Recovery/Heist/DiamondCasinoHeist.cpp b/src/game/frontend/submenus/Recovery/Heist/DiamondCasinoHeist.cpp index 1f77192e..3ef6b854 100644 --- a/src/game/frontend/submenus/Recovery/Heist/DiamondCasinoHeist.cpp +++ b/src/game/frontend/submenus/Recovery/Heist/DiamondCasinoHeist.cpp @@ -7,10 +7,9 @@ namespace YimMenu::Submenus auto tab = std::make_shared("Diamond Casino Heist"); auto cuts = std::make_shared("Heist Cuts", 2); - auto setups = std::make_shared("Heist Setups", 1); - auto config = std::make_shared(""); - auto config_ = std::make_shared(""); - auto sep = std::make_shared(""); + auto setups1 = std::make_shared("Heist Setups"); + auto setups2 = std::make_shared(""); + auto loots = std::make_shared("Loots"); auto misc = std::make_shared("Misc", 1); cuts->AddItem(std::make_shared("diamondcasinoheistcut1"_J)); @@ -20,44 +19,41 @@ namespace YimMenu::Submenus cuts->AddItem(std::make_shared("diamondcasinoheistforceready"_J)); cuts->AddItem(std::make_shared("diamondcasinoheistsetcuts"_J)); - setups->AddItem(std::make_shared("diamondcasinoheistdifficulty"_J)); - setups->AddItem(std::make_shared("diamondcasinoheistprimarytarget"_J)); - setups->AddItem(std::make_shared("diamondcasinoheistapproach"_J)); - - config->AddItem(std::make_shared("diamondcasinoheistgunman"_J)); - config->AddItem(std::make_shared([] { + setups1->AddItem(std::make_shared("diamondcasinoheistdifficulty"_J)); + setups1->AddItem(std::make_shared("diamondcasinoheistprimarytarget"_J)); + setups1->AddItem(std::make_shared("diamondcasinoheistapproach"_J)); + setups1->AddItem(std::make_shared("diamondcasinoheistgunman"_J)); + setups1->AddItem(std::make_shared([] { ImGui::SameLine(); })); - config->AddItem(std::make_shared("diamondcasinoheistweapon"_J)); - config->AddItem(std::make_shared("diamondcasinoheistdriver"_J)); - config->AddItem(std::make_shared([] { + setups1->AddItem(std::make_shared("diamondcasinoheistweapon"_J)); + setups2->AddItem(std::make_shared("diamondcasinoheistdriver"_J)); + setups2->AddItem(std::make_shared([] { ImGui::SameLine(); })); - config->AddItem(std::make_shared("diamondcasinoheistvehicle"_J)); - config->AddItem(std::make_shared("diamondcasinoheisthacker"_J)); - - config_->AddItem(std::make_shared("diamondcasinoheistsetup"_J)); + setups2->AddItem(std::make_shared("diamondcasinoheistvehicle"_J)); + setups2->AddItem(std::make_shared("diamondcasinoheisthacker"_J)); + setups2->AddItem(std::make_shared("diamondcasinoheistsetup"_J)); - sep->AddItem(std::make_shared("diamondcasinoheistpotentialtake"_J)); - sep->AddItem(std::make_shared([] { + loots->AddItem(std::make_shared("diamondcasinoheistpotentialtake"_J)); + loots->AddItem(std::make_shared([] { ImGui::SameLine(); })); - sep->AddItem(std::make_shared("diamondcasinoheistsetpotentialtake"_J)); - sep->AddItem(std::make_shared("diamondcasinoheistactualtake"_J)); - sep->AddItem(std::make_shared([] { + loots->AddItem(std::make_shared("diamondcasinoheistsetpotentialtake"_J)); + loots->AddItem(std::make_shared("diamondcasinoheistactualtake"_J)); + loots->AddItem(std::make_shared([] { ImGui::SameLine(); })); - sep->AddItem(std::make_shared("diamondcasinoheistsetactualtake"_J)); + loots->AddItem(std::make_shared("diamondcasinoheistsetactualtake"_J)); misc->AddItem(std::make_shared("diamondcasinoheistskiphacking"_J)); misc->AddItem(std::make_shared("diamondcasinoheistskipdrilling"_J)); misc->AddItem(std::make_shared("diamondcasinoheistinstantfinish"_J)); tab->AddItem(cuts); - tab->AddItem(setups); - tab->AddItem(config); - tab->AddItem(config_); - tab->AddItem(sep); + tab->AddItem(setups1); + tab->AddItem(setups2); + tab->AddItem(loots); tab->AddItem(misc); return tab; diff --git a/src/game/gta/ScriptGlobal.hpp b/src/game/gta/ScriptGlobal.hpp index 81a2b8e6..b9ec82f8 100644 --- a/src/game/gta/ScriptGlobal.hpp +++ b/src/game/gta/ScriptGlobal.hpp @@ -36,18 +36,6 @@ namespace YimMenu return *static_cast>>(Get()); } - template - constexpr T GetValue() - { - return *this->As(); - } - - template - constexpr void SetValue(T value) - { - *this->As() = value; - } - bool CanAccess() const; private: diff --git a/src/game/gta/ScriptLocal.hpp b/src/game/gta/ScriptLocal.hpp index 580f70be..470b8648 100644 --- a/src/game/gta/ScriptLocal.hpp +++ b/src/game/gta/ScriptLocal.hpp @@ -73,18 +73,6 @@ namespace YimMenu return *static_cast>>(Get()); } - template - constexpr T GetValue() - { - return *this->As(); - } - - template - constexpr void SetValue(T value) - { - *this->As() = value; - } - bool CanAccess() const; private: