From 7abf66f966de3a163236042d1f57b943fce0ffd5 Mon Sep 17 00:00:00 2001 From: tyackman Date: Mon, 15 Jul 2024 22:25:40 -0500 Subject: [PATCH 01/15] Bump RDR-Classes, Features, Protection Improvements, --- cmake/rdr-classes.cmake | 2 +- src/game/features/players/toxic/EndParlay.cpp | 31 +++++++++++++++++ .../features/players/toxic/IncreaseBounty.cpp | 33 +++++++++++++++++++ .../features/players/toxic/StartParlay.cpp | 31 +++++++++++++++++ src/game/features/self/OffTheRadar.cpp | 6 ++-- src/game/frontend/submenus/Players.cpp | 3 ++ .../frontend/submenus/World/PedSpawner.cpp | 8 ++--- src/game/frontend/submenus/World/Shows.cpp | 20 +++++------ .../Protections/HandleScriptedGameEvent.cpp | 15 +++++++++ .../hooks/Protections/ShouldBlockSync.cpp | 18 +++++----- src/game/rdr/Enums.hpp | 1 + src/game/rdr/invoker/Invoker.hpp | 12 +++---- 12 files changed, 147 insertions(+), 33 deletions(-) create mode 100644 src/game/features/players/toxic/EndParlay.cpp create mode 100644 src/game/features/players/toxic/IncreaseBounty.cpp create mode 100644 src/game/features/players/toxic/StartParlay.cpp diff --git a/cmake/rdr-classes.cmake b/cmake/rdr-classes.cmake index e39b06d1..58afff79 100644 --- a/cmake/rdr-classes.cmake +++ b/cmake/rdr-classes.cmake @@ -3,7 +3,7 @@ include(FetchContent) FetchContent_Declare( rdr_classes GIT_REPOSITORY https://github.com/YimMenu/RDR-Classes.git - GIT_TAG 9ef64d85290f85ddfa6a4b6a8ef1d9acfcb31808 + GIT_TAG 7c78535a483e85fc714525ddce330b2e776e9b8f GIT_PROGRESS TRUE CONFIGURE_COMMAND "" BUILD_COMMAND "" diff --git a/src/game/features/players/toxic/EndParlay.cpp b/src/game/features/players/toxic/EndParlay.cpp new file mode 100644 index 00000000..c9f55579 --- /dev/null +++ b/src/game/features/players/toxic/EndParlay.cpp @@ -0,0 +1,31 @@ +#include "game/backend/ScriptMgr.hpp" +#include "game/backend/Self.hpp" +#include "game/commands/PlayerCommand.hpp" +#include "game/rdr/Enums.hpp" +#include "game/rdr/Scripts.hpp" + +namespace YimMenu::Features +{ + void ParlayEnd(int bits) + { + uint64_t data[7]{}; + data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_PARLEY); + data[1] = Self::GetPlayer().GetId(); + data[4] = 5; + data[5] = 11; + data[6] = 9; + Scripts::SendScriptEvent(data, 9, bits); + } + + class EndParlay : public PlayerCommand + { + using PlayerCommand::PlayerCommand; + + virtual void OnCall(Player player) override + { + ParlayEnd(1 << player.GetId()); + } + }; + + static EndParlay _EndParlay{"endparlay", "End Parlay", "End a parlay with the player", 0, false}; +} \ No newline at end of file diff --git a/src/game/features/players/toxic/IncreaseBounty.cpp b/src/game/features/players/toxic/IncreaseBounty.cpp new file mode 100644 index 00000000..5ec29e25 --- /dev/null +++ b/src/game/features/players/toxic/IncreaseBounty.cpp @@ -0,0 +1,33 @@ +#include "game/backend/ScriptMgr.hpp" +#include "game/backend/Self.hpp" +#include "game/commands/PlayerCommand.hpp" +#include "game/rdr/Enums.hpp" +#include "game/rdr/Scripts.hpp" + +namespace YimMenu::Features +{ + void AddBounty(int bits) + { + uint64_t data[13]{}; + data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_NOTORIETY_PRESS_CHARGES); + data[1] = Self::GetPlayer().GetId(); + data[4] = 2; + data[5] = 5; + data[6] = 9; + data[11] = 1; + data[12] = 1; + Scripts::SendScriptEvent(data, 13, bits); + } + + class IncreaseBounty : public PlayerCommand + { + using PlayerCommand::PlayerCommand; + + virtual void OnCall(Player player) override + { + AddBounty(1 << player.GetId()); + } + }; + + static IncreaseBounty _IncreaseBounty{"increasebounty", "Increase Bounty", "Increase the players bounty", 0, false}; +} \ No newline at end of file diff --git a/src/game/features/players/toxic/StartParlay.cpp b/src/game/features/players/toxic/StartParlay.cpp new file mode 100644 index 00000000..a329195a --- /dev/null +++ b/src/game/features/players/toxic/StartParlay.cpp @@ -0,0 +1,31 @@ +#include "game/backend/ScriptMgr.hpp" +#include "game/backend/Self.hpp" +#include "game/commands/PlayerCommand.hpp" +#include "game/rdr/Enums.hpp" +#include "game/rdr/Scripts.hpp" + +namespace YimMenu::Features +{ + void ParlayStart(int bits) + { + uint64_t data[7]{}; + data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_PARLEY); + data[1] = Self::GetPlayer().GetId(); + data[4] = 3; + data[5] = 11; + data[6] = 9; + Scripts::SendScriptEvent(data, 9, bits); + } + + class StartParlay : public PlayerCommand + { + using PlayerCommand::PlayerCommand; + + virtual void OnCall(Player player) override + { + ParlayStart(1 << player.GetId()); + } + }; + + static StartParlay _StartParlay{"startparlay", "Start Parlay", "Start a parlay with the player", 0, false}; +} \ No newline at end of file diff --git a/src/game/features/self/OffTheRadar.cpp b/src/game/features/self/OffTheRadar.cpp index 0a045742..621c7201 100644 --- a/src/game/features/self/OffTheRadar.cpp +++ b/src/game/features/self/OffTheRadar.cpp @@ -36,12 +36,12 @@ namespace YimMenu::Features // TODO: maybe add support for removing native hooks dynamically? void DECOR_SET_INT(rage::scrNativeCallContext* ctx) { - int flags = ctx->get_arg(2); - if (Joaat(ctx->get_arg(1)) == "MP_HUD_Bits"_J) + int flags = ctx->GetArg(2); + if (Joaat(ctx->GetArg(1)) == "MP_HUD_Bits"_J) { if (_OffTheRadar.GetState()) flags |= 64; } - DECORATOR::DECOR_SET_INT(ctx->get_arg(0), ctx->get_arg(1), flags); + DECORATOR::DECOR_SET_INT(ctx->GetArg(0), ctx->GetArg(1), flags); } } \ No newline at end of file diff --git a/src/game/frontend/submenus/Players.cpp b/src/game/frontend/submenus/Players.cpp index 9d53a40e..115ff48b 100644 --- a/src/game/frontend/submenus/Players.cpp +++ b/src/game/frontend/submenus/Players.cpp @@ -285,6 +285,9 @@ namespace YimMenu::Submenus general->AddItem(std::make_shared("offensive"_J)); general->AddItem(std::make_shared("maxhonor"_J)); general->AddItem(std::make_shared("minhonor"_J)); + general->AddItem(std::make_shared("startparlay"_J)); + general->AddItem(std::make_shared("endparlay"_J)); + general->AddItem(std::make_shared("increasebounty"_J)); auto mount = std::make_shared("Mount"); mount->AddItem(std::make_shared("kickhorse"_J)); diff --git a/src/game/frontend/submenus/World/PedSpawner.cpp b/src/game/frontend/submenus/World/PedSpawner.cpp index d83a4b21..6e2a0b4c 100644 --- a/src/game/frontend/submenus/World/PedSpawner.cpp +++ b/src/game/frontend/submenus/World/PedSpawner.cpp @@ -15,19 +15,19 @@ namespace YimMenu::Submenus { void GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(rage::scrNativeCallContext* ctx) { - if (ctx->get_arg(0) == "mp_intro"_J) + if (ctx->GetArg(0) == "mp_intro"_J) { - ctx->set_return_value(1); + ctx->SetReturnValue(1); } else { - ctx->set_return_value(NETWORK::NETWORK_AWARD_HAS_REACHED_MAXCLAIM(ctx->get_arg(0))); + ctx->SetReturnValue(NETWORK::NETWORK_AWARD_HAS_REACHED_MAXCLAIM(ctx->GetArg(0))); } } void _GET_META_PED_TYPE(rage::scrNativeCallContext* ctx) { - ctx->set_return_value(4); + ctx->SetReturnValue(4); } static bool IsPedModelInList(std::string model) diff --git a/src/game/frontend/submenus/World/Shows.cpp b/src/game/frontend/submenus/World/Shows.cpp index 39d450cc..34e2a534 100644 --- a/src/game/frontend/submenus/World/Shows.cpp +++ b/src/game/frontend/submenus/World/Shows.cpp @@ -197,39 +197,39 @@ namespace YimMenu::Submenus static void CREATE_PED(rage::scrNativeCallContext* ctx) { - auto override = GetOverridePed(SceneTypeFromScript(SCRIPTS::GET_HASH_OF_THIS_SCRIPT_NAME()), ctx->get_arg(0)); + auto override = GetOverridePed(SceneTypeFromScript(SCRIPTS::GET_HASH_OF_THIS_SCRIPT_NAME()), ctx->GetArg(0)); if (override) { - ctx->set_return_value(override.GetHandle()); + ctx->SetReturnValue(override.GetHandle()); return; } - auto ped = PED::CREATE_PED(ctx->get_arg(0), ctx->get_arg(1), ctx->get_arg(2), ctx->get_arg(3), ctx->get_arg(4), ctx->get_arg(5), ctx->get_arg(6), ctx->get_arg(7), ctx->get_arg(8)); + auto ped = PED::CREATE_PED(ctx->GetArg(0), ctx->GetArg(1), ctx->GetArg(2), ctx->GetArg(3), ctx->GetArg(4), ctx->GetArg(5), ctx->GetArg(6), ctx->GetArg(7), ctx->GetArg(8)); g_ShowEntities.push_back(ped); - ctx->set_return_value(std::move(ped)); + ctx->SetReturnValue(std::move(ped)); } static void CREATE_OBJECT(rage::scrNativeCallContext* ctx) { - auto obj = OBJECT::CREATE_OBJECT(ctx->get_arg(0), ctx->get_arg(1), ctx->get_arg(2), ctx->get_arg(3), ctx->get_arg(4), ctx->get_arg(5), ctx->get_arg(6), ctx->get_arg(7), ctx->get_arg(8)); - if (ctx->get_arg(0) == -262339715) + auto obj = OBJECT::CREATE_OBJECT(ctx->GetArg(0), ctx->GetArg(1), ctx->GetArg(2), ctx->GetArg(3), ctx->GetArg(4), ctx->GetArg(5), ctx->GetArg(6), ctx->GetArg(7), ctx->GetArg(8)); + if (ctx->GetArg(0) == -262339715) { // hide curtain ENTITY::SET_ENTITY_VISIBLE(obj, false); ENTITY::SET_ENTITY_COLLISION(obj, false, false); } g_ShowEntities.push_back(obj); - ctx->set_return_value(std::move(obj)); + ctx->SetReturnValue(std::move(obj)); } static void NETWORK_HAS_CONTROL_OF_ENTITY(rage::scrNativeCallContext* ctx) { - ctx->set_return_value(TRUE); + ctx->SetReturnValue(TRUE); } static void CREATE_ANIM_SCENE(rage::scrNativeCallContext* ctx) { - int handle = ANIMSCENE::_CREATE_ANIM_SCENE(ctx->get_arg(0), ctx->get_arg(1), ctx->get_arg(2), ctx->get_arg(3), ctx->get_arg(4)); + int handle = ANIMSCENE::_CREATE_ANIM_SCENE(ctx->GetArg(0), ctx->GetArg(1), ctx->GetArg(2), ctx->GetArg(3), ctx->GetArg(4)); FiberPool::Push([handle] { CAnimScene* scene = nullptr; Pointers.GetAnimSceneFromHandle(&scene, handle); @@ -247,7 +247,7 @@ namespace YimMenu::Submenus } } }); - ctx->set_return_value(std::move(handle)); + ctx->SetReturnValue(std::move(handle)); } inline void RenderActorDef(ActorDefinition& def, const std::string& name) diff --git a/src/game/hooks/Protections/HandleScriptedGameEvent.cpp b/src/game/hooks/Protections/HandleScriptedGameEvent.cpp index 56473b64..0d1b4f72 100644 --- a/src/game/hooks/Protections/HandleScriptedGameEvent.cpp +++ b/src/game/hooks/Protections/HandleScriptedGameEvent.cpp @@ -62,8 +62,23 @@ namespace YimMenu::Hooks { if (event->m_Data[11] && event->m_Data[4] == 2) { + Notifications::Show("Protections", std::format("Blocked press charges from {}", src->GetName()), NotificationType::Warning); return true; // block pressing charges } + break; + } + case ScriptEvent::SCRIPT_EVENT_PARLEY: + { + if (event->m_Data[4] == 3) + { + Notifications::Show("Protections", std::format("Blocked start parlay from {}", src->GetName()), NotificationType::Warning); + return true; + } + if (event->m_Data[4] == 5) + { + Notifications::Show("Protections", std::format("Blocked end parlay from {}", src->GetName()), NotificationType::Warning); + return true; + } } } diff --git a/src/game/hooks/Protections/ShouldBlockSync.cpp b/src/game/hooks/Protections/ShouldBlockSync.cpp index 92c1336b..ee80f4d1 100644 --- a/src/game/hooks/Protections/ShouldBlockSync.cpp +++ b/src/game/hooks/Protections/ShouldBlockSync.cpp @@ -121,17 +121,17 @@ namespace LOG_FIELD(CPedAttachData, m_AttachObjectId); break; case "CVehicleGadgetDataNode"_J: - LOG_FIELD_B(CVehicleGadgetNodeData, m_has_position); - LOG_FIELD(CVehicleGadgetNodeData, m_position[0]); - LOG_FIELD(CVehicleGadgetNodeData, m_position[1]); - LOG_FIELD(CVehicleGadgetNodeData, m_position[2]); - LOG_FIELD(CVehicleGadgetNodeData, m_position[3]); - LOG_FIELD(CVehicleGadgetNodeData, m_num_gadgets); - if (node->GetData().m_num_gadgets <= 2) + LOG_FIELD_B(CVehicleGadgetDataNode, m_HasPosition); + LOG_FIELD(CVehicleGadgetDataNode, m_Position[0]); + LOG_FIELD(CVehicleGadgetDataNode, m_Position[1]); + LOG_FIELD(CVehicleGadgetDataNode, m_Position[2]); + LOG_FIELD(CVehicleGadgetDataNode, m_Position[3]); + LOG_FIELD(CVehicleGadgetDataNode, m_NumGadgets); + if (node->GetData().m_NumGadgets <= 2) { - for (int i = 0; i < node->GetData().m_num_gadgets; i++) + for (int i = 0; i < node->GetData().m_NumGadgets; i++) { - LOG_FIELD(CVehicleGadgetNodeData, m_gadgets[i].m_type); + LOG_FIELD(CVehicleGadgetDataNode, m_Gadgets[i].m_Type); } } break; diff --git a/src/game/rdr/Enums.hpp b/src/game/rdr/Enums.hpp index fa4986a2..324a7b01 100644 --- a/src/game/rdr/Enums.hpp +++ b/src/game/rdr/Enums.hpp @@ -1381,6 +1381,7 @@ enum class eLassoFlags enum class ScriptEvent { + SCRIPT_EVENT_PARLEY = 28, SCRIPT_EVENT_NOTORIETY_PRESS_CHARGES = 35, SCRIPT_EVENT_NOTORIETY_FORCE_PASSIVE = 36, SCRIPT_EVENT_NOTORIETY_FORCE_NOT_PASSIVE_HORSE = 37, diff --git a/src/game/rdr/invoker/Invoker.hpp b/src/game/rdr/invoker/Invoker.hpp index 113829be..751cf9a7 100644 --- a/src/game/rdr/invoker/Invoker.hpp +++ b/src/game/rdr/invoker/Invoker.hpp @@ -13,13 +13,13 @@ namespace YimMenu public: constexpr CustomCallContext() { - m_return_value = &m_return_stack[0]; - m_args = &m_arg_stack[0]; + m_ReturnValue = &m_ReturnStack[0]; + m_Args = &m_ArgStack[0]; } private: - uint64_t m_return_stack[10]; - uint64_t m_arg_stack[40]; + uint64_t m_ReturnStack[10]; + uint64_t m_ArgStack[40]; }; class NativeInvoker @@ -50,13 +50,13 @@ namespace YimMenu template constexpr void PushArg(T&& value) { - m_CallContext.push_arg(std::forward(value)); + m_CallContext.PushArg(std::forward(value)); } template constexpr T& GetReturnValue() { - return *m_CallContext.get_return_value(); + return *m_CallContext.GetReturnValue(); } public: From c6a2b5ad4d457de4e43b5242a8a9985386b2c142 Mon Sep 17 00:00:00 2001 From: tyackman Date: Mon, 15 Jul 2024 22:37:29 -0500 Subject: [PATCH 02/15] Update increase bounty --- src/game/features/players/toxic/IncreaseBounty.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/game/features/players/toxic/IncreaseBounty.cpp b/src/game/features/players/toxic/IncreaseBounty.cpp index 5ec29e25..6b580f58 100644 --- a/src/game/features/players/toxic/IncreaseBounty.cpp +++ b/src/game/features/players/toxic/IncreaseBounty.cpp @@ -16,7 +16,16 @@ namespace YimMenu::Features data[6] = 9; data[11] = 1; data[12] = 1; - Scripts::SendScriptEvent(data, 13, bits); + + for (int i = 0; i < 10; ++i) + { + for (int j = 0; j < 10; ++j) + { + Scripts::SendScriptEvent(data, 13, bits); + } + + ScriptMgr::Yield(); + } } class IncreaseBounty : public PlayerCommand From f81b54b629e5c45264936f0fe88d193e748f5163 Mon Sep 17 00:00:00 2001 From: tyackman Date: Mon, 15 Jul 2024 23:41:18 -0500 Subject: [PATCH 03/15] Update --- src/game/hooks/Protections/HandleScriptedGameEvent.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/hooks/Protections/HandleScriptedGameEvent.cpp b/src/game/hooks/Protections/HandleScriptedGameEvent.cpp index 0d1b4f72..9992e0ca 100644 --- a/src/game/hooks/Protections/HandleScriptedGameEvent.cpp +++ b/src/game/hooks/Protections/HandleScriptedGameEvent.cpp @@ -60,10 +60,10 @@ namespace YimMenu::Hooks } case ScriptEvent::SCRIPT_EVENT_NOTORIETY_PRESS_CHARGES: { - if (event->m_Data[11] && event->m_Data[4] == 2) + if (event->m_Data[11] && event->m_Data[4] == 2 || event->m_Data[4] == 3) { Notifications::Show("Protections", std::format("Blocked press charges from {}", src->GetName()), NotificationType::Warning); - return true; // block pressing charges + return true; } break; } From 752a94aeee23d9508e8bf0c89b67ad596129caa9 Mon Sep 17 00:00:00 2001 From: tyackman Date: Tue, 16 Jul 2024 01:17:47 -0500 Subject: [PATCH 04/15] Casing fixes, removed duplicate autotp command --- src/game/features/Features.cpp | 50 +++++++++---------- src/game/features/mount/KeepHorseClean.cpp | 2 +- .../features/mount/KeepHorseCoresFilled.cpp | 8 +-- src/game/features/self/AntiHogtie.cpp | 4 +- src/game/features/self/AntiLasso.cpp | 16 +++--- src/game/features/self/KeepClean.cpp | 2 +- src/game/features/self/KeepCoresFilled.cpp | 12 ++--- src/game/features/self/Noclip.cpp | 14 +++--- src/game/features/vehicle/SuperBrake.cpp | 2 +- src/game/features/vehicle/SuperDrive.cpp | 2 +- src/game/frontend/ContextMenu.cpp | 16 +++--- src/game/frontend/submenus/Self.cpp | 1 - src/game/hooks/Hooks.hpp | 6 +-- .../Protections/AddObjectToCreationQueue.cpp | 2 +- src/game/hooks/Protections/CanApplyData.cpp | 2 +- .../hooks/Protections/HandleNetGameEvent.cpp | 14 +++--- .../hooks/Protections/HandlePresenceEvent.cpp | 8 +-- .../hooks/Protections/ShouldBlockSync.cpp | 12 ++--- src/game/rdr/Enums.hpp | 38 +++++++++----- src/game/rdr/Nodes.cpp | 6 +-- src/game/rdr/Nodes.hpp | 10 ++-- src/game/rdr/data/Emotes.hpp | 2 +- 22 files changed, 120 insertions(+), 109 deletions(-) diff --git a/src/game/features/Features.cpp b/src/game/features/Features.cpp index dd8ccdea..59abc34e 100644 --- a/src/game/features/Features.cpp +++ b/src/game/features/Features.cpp @@ -106,31 +106,31 @@ namespace YimMenu { if (GUI::IsOpen()) { - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_LOOK_LR, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_LOOK_UD, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_AIM, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_MELEE_ATTACK, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_VEH_DRIVE_LOOK, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_VEH_AIM, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_VEH_ATTACK, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_VEH_ATTACK2, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_HORSE_AIM, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_HORSE_ATTACK, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_HORSE_ATTACK2, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_HORSE_GUN_LR, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_HORSE_GUN_UD, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_VEH_DRIVE_LOOK2, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_ATTACK, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_ATTACK2, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_NEXT_WEAPON, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_PREV_WEAPON, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_VEH_CAR_AIM, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_VEH_CAR_ATTACK, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_VEH_CAR_ATTACK2, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_VEH_CAR_ATTACK2, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_VEH_BOAT_AIM, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_VEH_BOAT_ATTACK, 1); - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_VEH_BOAT_ATTACK2, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_LOOK_LR, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_LOOK_UD, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_AIM, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_MELEE_ATTACK, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_VEH_DRIVE_LOOK, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_VEH_AIM, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_VEH_ATTACK, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_VEH_ATTACK2, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_HORSE_AIM, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_HORSE_ATTACK, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_HORSE_ATTACK2, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_HORSE_GUN_LR, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_HORSE_GUN_UD, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_VEH_DRIVE_LOOK2, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_ATTACK, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_ATTACK2, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_NEXT_WEAPON, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_PREV_WEAPON, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_VEH_CAR_AIM, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_VEH_CAR_ATTACK, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_VEH_CAR_ATTACK2, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_VEH_CAR_ATTACK2, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_VEH_BOAT_AIM, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_VEH_BOAT_ATTACK, 1); + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_VEH_BOAT_ATTACK2, 1); } ScriptMgr::Yield(); diff --git a/src/game/features/mount/KeepHorseClean.cpp b/src/game/features/mount/KeepHorseClean.cpp index 28cb8d51..2b038abc 100644 --- a/src/game/features/mount/KeepHorseClean.cpp +++ b/src/game/features/mount/KeepHorseClean.cpp @@ -13,7 +13,7 @@ namespace YimMenu::Features { if (auto mount = Self::GetMount()) { - PED::_SET_PED_DAMAGE_CLEANLINESS(mount.GetHandle(), (int)ePedDamageCleanliness::PED_DAMAGE_CLEANLINESS_PERFECT); + PED::_SET_PED_DAMAGE_CLEANLINESS(mount.GetHandle(), (int)PedDamageCleanliness::PED_DAMAGE_CLEANLINESS_PERFECT); PED::CLEAR_PED_WETNESS(mount.GetHandle()); PED::CLEAR_PED_ENV_DIRT(mount.GetHandle()); PED::CLEAR_PED_BLOOD_DAMAGE(mount.GetHandle()); diff --git a/src/game/features/mount/KeepHorseCoresFilled.cpp b/src/game/features/mount/KeepHorseCoresFilled.cpp index 0dbb9d82..27a6a5c6 100644 --- a/src/game/features/mount/KeepHorseCoresFilled.cpp +++ b/src/game/features/mount/KeepHorseCoresFilled.cpp @@ -15,13 +15,13 @@ namespace YimMenu::Features if (!mount || mount.IsDead()) return; - auto health_core = ATTRIBUTE::_GET_ATTRIBUTE_CORE_VALUE(mount.GetHandle(), (int)eAttributeCore::ATTRIBUTE_CORE_HEALTH); - auto stamina_care = ATTRIBUTE::_GET_ATTRIBUTE_CORE_VALUE(mount.GetHandle(), (int)eAttributeCore::ATTRIBUTE_CORE_STAMINA); + auto health_core = ATTRIBUTE::_GET_ATTRIBUTE_CORE_VALUE(mount.GetHandle(), (int)AttributeCore::ATTRIBUTE_CORE_HEALTH); + auto stamina_care = ATTRIBUTE::_GET_ATTRIBUTE_CORE_VALUE(mount.GetHandle(), (int)AttributeCore::ATTRIBUTE_CORE_STAMINA); if (health_core < 100) - ATTRIBUTE::_SET_ATTRIBUTE_CORE_VALUE(mount.GetHandle(), (int)eAttributeCore::ATTRIBUTE_CORE_HEALTH, 100); + ATTRIBUTE::_SET_ATTRIBUTE_CORE_VALUE(mount.GetHandle(), (int)AttributeCore::ATTRIBUTE_CORE_HEALTH, 100); if (stamina_care < 100) - ATTRIBUTE::_SET_ATTRIBUTE_CORE_VALUE(mount.GetHandle(), (int)eAttributeCore::ATTRIBUTE_CORE_STAMINA, 100); + ATTRIBUTE::_SET_ATTRIBUTE_CORE_VALUE(mount.GetHandle(), (int)AttributeCore::ATTRIBUTE_CORE_STAMINA, 100); } }; diff --git a/src/game/features/self/AntiHogtie.cpp b/src/game/features/self/AntiHogtie.cpp index 82c97d46..c7f127cc 100644 --- a/src/game/features/self/AntiHogtie.cpp +++ b/src/game/features/self/AntiHogtie.cpp @@ -12,13 +12,13 @@ namespace YimMenu::Features virtual void OnTick() override { - ENTITY::_SET_ENTITY_CARRYING_FLAG(Self::GetPed().GetHandle(), (int)eCarryingFlags::CARRYING_FLAG_CAN_BE_HOGTIED, false); + ENTITY::_SET_ENTITY_CARRYING_FLAG(Self::GetPed().GetHandle(), (int)CarryingFlags::CARRYING_FLAG_CAN_BE_HOGTIED, false); } virtual void OnDisable() override { - ENTITY::_SET_ENTITY_CARRYING_FLAG(Self::GetPed().GetHandle(), (int)eCarryingFlags::CARRYING_FLAG_CAN_BE_HOGTIED, true); + ENTITY::_SET_ENTITY_CARRYING_FLAG(Self::GetPed().GetHandle(), (int)CarryingFlags::CARRYING_FLAG_CAN_BE_HOGTIED, true); } }; diff --git a/src/game/features/self/AntiLasso.cpp b/src/game/features/self/AntiLasso.cpp index 92f0080d..fc8536db 100644 --- a/src/game/features/self/AntiLasso.cpp +++ b/src/game/features/self/AntiLasso.cpp @@ -11,18 +11,18 @@ namespace YimMenu::Features virtual void OnTick() override { - PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)eLassoFlags::LHF_CAN_BE_LASSOED, false); - PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)eLassoFlags::LHF_CAN_BE_LASSOED_BY_FRIENDLY_AI, false); - PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)eLassoFlags::LHF_CAN_BE_LASSOED_BY_FRIENDLY_PLAYERS, false); - PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)eLassoFlags::LHF_DISABLE_IN_MP, true); + PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)LassoFlags::LHF_CAN_BE_LASSOED, false); + PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)LassoFlags::LHF_CAN_BE_LASSOED_BY_FRIENDLY_AI, false); + PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)LassoFlags::LHF_CAN_BE_LASSOED_BY_FRIENDLY_PLAYERS, false); + PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)LassoFlags::LHF_DISABLE_IN_MP, true); } virtual void OnDisable() override { - PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)eLassoFlags::LHF_CAN_BE_LASSOED, true); - PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)eLassoFlags::LHF_CAN_BE_LASSOED_BY_FRIENDLY_AI, true); - PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)eLassoFlags::LHF_CAN_BE_LASSOED_BY_FRIENDLY_PLAYERS, true); - PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)eLassoFlags::LHF_DISABLE_IN_MP, false); + PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)LassoFlags::LHF_CAN_BE_LASSOED, true); + PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)LassoFlags::LHF_CAN_BE_LASSOED_BY_FRIENDLY_AI, true); + PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)LassoFlags::LHF_CAN_BE_LASSOED_BY_FRIENDLY_PLAYERS, true); + PED::SET_PED_LASSO_HOGTIE_FLAG(Self::GetPed().GetHandle(), (int)LassoFlags::LHF_DISABLE_IN_MP, false); } }; diff --git a/src/game/features/self/KeepClean.cpp b/src/game/features/self/KeepClean.cpp index 5546e742..dcdd863d 100644 --- a/src/game/features/self/KeepClean.cpp +++ b/src/game/features/self/KeepClean.cpp @@ -14,7 +14,7 @@ namespace YimMenu::Features if (!ped || ped.IsDead()) return; - PED::_SET_PED_DAMAGE_CLEANLINESS(ped.GetHandle(), (int)ePedDamageCleanliness::PED_DAMAGE_CLEANLINESS_PERFECT); + PED::_SET_PED_DAMAGE_CLEANLINESS(ped.GetHandle(), (int)PedDamageCleanliness::PED_DAMAGE_CLEANLINESS_PERFECT); PED::CLEAR_PED_WETNESS(ped.GetHandle()); PED::CLEAR_PED_ENV_DIRT(ped.GetHandle()); PED::CLEAR_PED_BLOOD_DAMAGE(ped.GetHandle()); diff --git a/src/game/features/self/KeepCoresFilled.cpp b/src/game/features/self/KeepCoresFilled.cpp index 1e585953..5f24375e 100644 --- a/src/game/features/self/KeepCoresFilled.cpp +++ b/src/game/features/self/KeepCoresFilled.cpp @@ -14,17 +14,17 @@ namespace YimMenu::Features if (!ped || ped.IsDead()) return; - auto health_core = ATTRIBUTE::_GET_ATTRIBUTE_CORE_VALUE(ped.GetHandle(), (int)eAttributeCore::ATTRIBUTE_CORE_HEALTH); - auto stamina_care = ATTRIBUTE::_GET_ATTRIBUTE_CORE_VALUE(ped.GetHandle(), (int)eAttributeCore::ATTRIBUTE_CORE_STAMINA); - auto deadeye_core = ATTRIBUTE::_GET_ATTRIBUTE_CORE_VALUE(ped.GetHandle(), (int)eAttributeCore::ATTRIBUTE_CORE_DEADEYE); + auto health_core = ATTRIBUTE::_GET_ATTRIBUTE_CORE_VALUE(ped.GetHandle(), (int)AttributeCore::ATTRIBUTE_CORE_HEALTH); + auto stamina_care = ATTRIBUTE::_GET_ATTRIBUTE_CORE_VALUE(ped.GetHandle(), (int)AttributeCore::ATTRIBUTE_CORE_STAMINA); + auto deadeye_core = ATTRIBUTE::_GET_ATTRIBUTE_CORE_VALUE(ped.GetHandle(), (int)AttributeCore::ATTRIBUTE_CORE_DEADEYE); // TODO: should 100 be hardcoded here? if (health_core < 100) - ATTRIBUTE::_SET_ATTRIBUTE_CORE_VALUE(ped.GetHandle(), (int)eAttributeCore::ATTRIBUTE_CORE_HEALTH, 100); + ATTRIBUTE::_SET_ATTRIBUTE_CORE_VALUE(ped.GetHandle(), (int)AttributeCore::ATTRIBUTE_CORE_HEALTH, 100); if (stamina_care < 100) - ATTRIBUTE::_SET_ATTRIBUTE_CORE_VALUE(ped.GetHandle(), (int)eAttributeCore::ATTRIBUTE_CORE_STAMINA, 100); + ATTRIBUTE::_SET_ATTRIBUTE_CORE_VALUE(ped.GetHandle(), (int)AttributeCore::ATTRIBUTE_CORE_STAMINA, 100); if (deadeye_core < 100) - ATTRIBUTE::_SET_ATTRIBUTE_CORE_VALUE(ped.GetHandle(), (int)eAttributeCore::ATTRIBUTE_CORE_DEADEYE, 100); + ATTRIBUTE::_SET_ATTRIBUTE_CORE_VALUE(ped.GetHandle(), (int)AttributeCore::ATTRIBUTE_CORE_DEADEYE, 100); } }; diff --git a/src/game/features/self/Noclip.cpp b/src/game/features/self/Noclip.cpp index 1ec9489c..26b0ed33 100644 --- a/src/game/features/self/Noclip.cpp +++ b/src/game/features/self/Noclip.cpp @@ -5,7 +5,7 @@ namespace YimMenu::Features { - static constexpr eNativeInputs controls[] = {eNativeInputs::INPUT_SPRINT, eNativeInputs::INPUT_MOVE_UP_ONLY, eNativeInputs::INPUT_MOVE_DOWN_ONLY, eNativeInputs::INPUT_MOVE_LEFT_ONLY, eNativeInputs::INPUT_MOVE_RIGHT_ONLY, eNativeInputs::INPUT_DUCK, eNativeInputs::INPUT_HORSE_STOP}; + static constexpr NativeInputs controls[] = {NativeInputs::INPUT_SPRINT, NativeInputs::INPUT_MOVE_UP_ONLY, NativeInputs::INPUT_MOVE_DOWN_ONLY, NativeInputs::INPUT_MOVE_LEFT_ONLY, NativeInputs::INPUT_MOVE_RIGHT_ONLY, NativeInputs::INPUT_DUCK, NativeInputs::INPUT_HORSE_STOP}; static constexpr float speed = 0.57f; class Noclip : public LoopedCommand @@ -41,22 +41,22 @@ namespace YimMenu::Features rage::fvector3 vel{}; // Left Shift - if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)eNativeInputs::INPUT_SPRINT)) + if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)NativeInputs::INPUT_SPRINT)) vel.z += speed / 2; // Left Control - if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)eNativeInputs::INPUT_DUCK) || PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)eNativeInputs::INPUT_HORSE_STOP)) + if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)NativeInputs::INPUT_DUCK) || PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)NativeInputs::INPUT_HORSE_STOP)) vel.z -= speed / 2; // Forward - if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)eNativeInputs::INPUT_MOVE_UP_ONLY)) + if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)NativeInputs::INPUT_MOVE_UP_ONLY)) vel.y += speed; // Backward - if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)eNativeInputs::INPUT_MOVE_DOWN_ONLY)) + if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)NativeInputs::INPUT_MOVE_DOWN_ONLY)) vel.y -= speed; // Left - if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)eNativeInputs::INPUT_MOVE_LEFT_ONLY)) + if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)NativeInputs::INPUT_MOVE_LEFT_ONLY)) vel.x -= speed; // Right - if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)eNativeInputs::INPUT_MOVE_RIGHT_ONLY)) + if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)NativeInputs::INPUT_MOVE_RIGHT_ONLY)) vel.x += speed; auto rot = CAM::GET_GAMEPLAY_CAM_ROT(2); diff --git a/src/game/features/vehicle/SuperBrake.cpp b/src/game/features/vehicle/SuperBrake.cpp index 14e708ba..b660e91d 100644 --- a/src/game/features/vehicle/SuperBrake.cpp +++ b/src/game/features/vehicle/SuperBrake.cpp @@ -18,7 +18,7 @@ namespace YimMenu::Features return; } - if (PAD::IS_CONTROL_PRESSED(0, (int)eNativeInputs::INPUT_VEH_BRAKE) || PAD::IS_CONTROL_PRESSED(0, (int)eNativeInputs::INPUT_VEH_HANDBRAKE)) + if (PAD::IS_CONTROL_PRESSED(0, (int)NativeInputs::INPUT_VEH_BRAKE) || PAD::IS_CONTROL_PRESSED(0, (int)NativeInputs::INPUT_VEH_HANDBRAKE)) { VEHICLE::SET_VEHICLE_FORWARD_SPEED(YimMenu::Self::GetVehicle().GetHandle(), 0); } diff --git a/src/game/features/vehicle/SuperDrive.cpp b/src/game/features/vehicle/SuperDrive.cpp index 451fff30..740aae58 100644 --- a/src/game/features/vehicle/SuperDrive.cpp +++ b/src/game/features/vehicle/SuperDrive.cpp @@ -19,7 +19,7 @@ namespace YimMenu::Features if (!YimMenu::Self::GetVehicle().IsValid()) return; - if (PAD::IS_CONTROL_PRESSED(0, (int)eNativeInputs::INPUT_VEH_ACCELERATE)) + if (PAD::IS_CONTROL_PRESSED(0, (int)NativeInputs::INPUT_VEH_ACCELERATE)) { float force = _SuperDriveForce.GetState() / 100.0f; Vector3 direction; diff --git a/src/game/frontend/ContextMenu.cpp b/src/game/frontend/ContextMenu.cpp index 0cb7fe68..ce107a7b 100644 --- a/src/game/frontend/ContextMenu.cpp +++ b/src/game/frontend/ContextMenu.cpp @@ -63,8 +63,8 @@ namespace YimMenu { if (Features::_ContextMenu.GetState()) { - PAD::DISABLE_CONTROL_ACTION(0, (Hash)eNativeInputs::INPUT_SWITCH_SHOULDER, true); - if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (Hash)eNativeInputs::INPUT_SWITCH_SHOULDER)) + PAD::DISABLE_CONTROL_ACTION(0, (Hash)NativeInputs::INPUT_SWITCH_SHOULDER, true); + if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (Hash)NativeInputs::INPUT_SWITCH_SHOULDER)) m_Enabled = !m_Enabled; if (m_Enabled) @@ -107,17 +107,17 @@ namespace YimMenu m_ScreenPos.x *= Pointers.ScreenResX; m_ScreenPos.y *= Pointers.ScreenResY; - PAD::DISABLE_CONTROL_ACTION(0, (int)eNativeInputs::INPUT_NEXT_WEAPON, true); - PAD::DISABLE_CONTROL_ACTION(0, (int)eNativeInputs::INPUT_PREV_WEAPON, true); - PAD::DISABLE_CONTROL_ACTION(0, (int)eNativeInputs::INPUT_ATTACK, true); + PAD::DISABLE_CONTROL_ACTION(0, (int)NativeInputs::INPUT_NEXT_WEAPON, true); + PAD::DISABLE_CONTROL_ACTION(0, (int)NativeInputs::INPUT_PREV_WEAPON, true); + PAD::DISABLE_CONTROL_ACTION(0, (int)NativeInputs::INPUT_ATTACK, true); - if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)eNativeInputs::INPUT_PREV_WEAPON)) + if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)NativeInputs::INPUT_PREV_WEAPON)) m_CurrentOperationsMenu.SelectPrevious(); - if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)eNativeInputs::INPUT_NEXT_WEAPON)) + if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)NativeInputs::INPUT_NEXT_WEAPON)) m_CurrentOperationsMenu.SelectNext(); - if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)eNativeInputs::INPUT_ATTACK)) + if (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(0, (int)NativeInputs::INPUT_ATTACK)) FiberPool::Push([=] { m_CurrentOperationsMenu.m_SelectedOperation.m_Operation(m_Entity); }); diff --git a/src/game/frontend/submenus/Self.cpp b/src/game/frontend/submenus/Self.cpp index 369547fc..ce7c0fd6 100644 --- a/src/game/frontend/submenus/Self.cpp +++ b/src/game/frontend/submenus/Self.cpp @@ -149,7 +149,6 @@ namespace YimMenu::Submenus globalsGroup->AddItem(std::make_shared("antihogtie"_J)); globalsGroup->AddItem(std::make_shared("antimelee"_J)); globalsGroup->AddItem(std::make_shared("drunk"_J)); - globalsGroup->AddItem(std::make_shared("autotp"_J)); globalsGroup->AddItem(std::make_shared("superjump"_J)); globalsGroup->AddItem(std::make_shared("superpunch"_J)); globalsGroup->AddItem(std::make_shared("quickskin"_J)); diff --git a/src/game/hooks/Hooks.hpp b/src/game/hooks/Hooks.hpp index ba21bc33..ba44710f 100644 --- a/src/game/hooks/Hooks.hpp +++ b/src/game/hooks/Hooks.hpp @@ -27,7 +27,7 @@ enum class NetEventType; class CFoundDevice; class IDirectSoundCapture; class CScriptedGameEvent; -enum class eNetObjType; +enum class NetObjType; class CPlayerHealthData; namespace YimMenu::Hooks @@ -72,7 +72,7 @@ namespace YimMenu::Hooks namespace Protections { - extern bool ShouldBlockSync(rage::netSyncTree* tree, eNetObjType type, rage::netObject* object); // helper function, not a hook + extern bool ShouldBlockSync(rage::netSyncTree* tree, NetObjType type, rage::netObject* object); // helper function, not a hook extern void HandleNetGameEvent(rage::netEventMgr* pEventMgr, CNetGamePlayer* pSourcePlayer, CNetGamePlayer* pTargetPlayer, NetEventType type, int index, int handledBits, std::int16_t unk, rage::datBitBuffer* buffer); extern int HandleCloneCreate(void* mgr, CNetGamePlayer* sender, uint16_t objectType, uint16_t objectId, int flags, void* encryptedMem, rage::datBitBuffer* buffer, int a8, int a9, bool isQueued); @@ -80,7 +80,7 @@ namespace YimMenu::Hooks extern bool CanApplyData(rage::netSyncTree* tree, rage::netObject* object); extern void ResetSyncNodes(); extern bool HandleScriptedGameEvent(CScriptedGameEvent* event, CNetGamePlayer* src, CNetGamePlayer* dst); - extern int AddObjectToCreationQueue(void* mgr, eNetObjType objectType, CNetGamePlayer* src, CNetGamePlayer* dst); + extern int AddObjectToCreationQueue(void* mgr, NetObjType objectType, CNetGamePlayer* src, CNetGamePlayer* dst); extern bool ReceiveNetMessage(void* a1, void* ncm, rage::netConnection::InFrame* frame); extern bool HandlePresenceEvent(uint64_t a1, rage::rlGamerInfo* gamerInfo, unsigned int sender, const char** payload, const char* channel); extern bool PPostMessage(int localGamerIndex, rage::rlGamerInfo* recipients, int numRecipients, const char* msg, unsigned int ttlSeconds); diff --git a/src/game/hooks/Protections/AddObjectToCreationQueue.cpp b/src/game/hooks/Protections/AddObjectToCreationQueue.cpp index 018d00a8..2f576da2 100644 --- a/src/game/hooks/Protections/AddObjectToCreationQueue.cpp +++ b/src/game/hooks/Protections/AddObjectToCreationQueue.cpp @@ -9,7 +9,7 @@ namespace YimMenu::Hooks { - int Protections::AddObjectToCreationQueue(void* mgr, eNetObjType type, CNetGamePlayer* src, CNetGamePlayer* dst) + int Protections::AddObjectToCreationQueue(void* mgr, NetObjType type, CNetGamePlayer* src, CNetGamePlayer* dst) { YimMenu::Protections::SetSyncingPlayer(src); diff --git a/src/game/hooks/Protections/CanApplyData.cpp b/src/game/hooks/Protections/CanApplyData.cpp index 3708cb80..e843b33f 100644 --- a/src/game/hooks/Protections/CanApplyData.cpp +++ b/src/game/hooks/Protections/CanApplyData.cpp @@ -14,7 +14,7 @@ namespace YimMenu::Hooks if (!BaseHook::Get>()->Original()(tree, object)) return false; - if (ShouldBlockSync(tree, (eNetObjType)object->m_ObjectType, object)) + if (ShouldBlockSync(tree, (NetObjType)object->m_ObjectType, object)) return false; return true; diff --git a/src/game/hooks/Protections/HandleNetGameEvent.cpp b/src/game/hooks/Protections/HandleNetGameEvent.cpp index 9920f2dd..4e0c9256 100644 --- a/src/game/hooks/Protections/HandleNetGameEvent.cpp +++ b/src/game/hooks/Protections/HandleNetGameEvent.cpp @@ -14,15 +14,15 @@ namespace { - bool IsVehicleType(eNetObjType type) + bool IsVehicleType(NetObjType type) { switch (type) { - case eNetObjType::Automobile: - case eNetObjType::Bike: - case eNetObjType::Heli: - case eNetObjType::DraftVeh: - case eNetObjType::Boat: return true; + case NetObjType::Automobile: + case NetObjType::Bike: + case NetObjType::Heli: + case NetObjType::DraftVeh: + case NetObjType::Boat: return true; } return false; @@ -105,7 +105,7 @@ namespace YimMenu::Hooks auto net_id = new_buffer.Read(13); if (auto object = Pointers.GetNetObjectById(net_id)) { - if (!IsVehicleType((eNetObjType)object->m_ObjectType)) + if (!IsVehicleType((NetObjType)object->m_ObjectType)) { LOG(WARNING) << "Blocked mismatched NETWORK_DESTROY_VEHICLE_LOCK_EVENT entity from " << sourcePlayer->GetName(); Pointers.SendEventAck(eventMgr, nullptr, sourcePlayer, targetPlayer, index, handledBits); diff --git a/src/game/hooks/Protections/HandlePresenceEvent.cpp b/src/game/hooks/Protections/HandlePresenceEvent.cpp index 1bf434ea..b289eada 100644 --- a/src/game/hooks/Protections/HandlePresenceEvent.cpp +++ b/src/game/hooks/Protections/HandlePresenceEvent.cpp @@ -60,26 +60,26 @@ namespace YimMenu::Hooks switch (presence_hash) { - case (uint32_t)ePresenceEvents::PRESENCE_ADMIN_JOIN_EVENT: + case (uint32_t)PresenceEvents::PRESENCE_ADMIN_JOIN_EVENT: { Notifications::Show("Presence Event", std::string("A Rockstar Games Admin ").append(sender_str).append(" is joining your game!"), NotificationType::Warning); LOG(WARNING) << "A Rockstar Games Admin(" << sender_str << ")" << "is joining your game"; break; } - case (uint32_t)ePresenceEvents::PRESENCE_TEXT_MESSAGE: + case (uint32_t)PresenceEvents::PRESENCE_TEXT_MESSAGE: { Notifications::Show("Presence Event", std::string("Blocked Text Message from ").append(sender_str), NotificationType::Warning); LOG(WARNING) << "Blocked Text Message from " << sender_str; return true; } - case (uint32_t)ePresenceEvents::PRESENCE_JOIN_REQUEST: + case (uint32_t)PresenceEvents::PRESENCE_JOIN_REQUEST: { Notifications::Show("Presence Event", std::string(sender_str).append(" is joining"), NotificationType::Warning); LOG(WARNING) << "Received Join Request from " << sender_str; break; } - case (uint32_t)ePresenceEvents::PRESENCE_STAT_UPDATE: + case (uint32_t)PresenceEvents::PRESENCE_STAT_UPDATE: { Notifications::Show("Presence Event", std::string("Received Stat Update from ").append(sender_str), NotificationType::Warning); LOG(WARNING) << "Received Stat Update from " << sender_str; diff --git a/src/game/hooks/Protections/ShouldBlockSync.cpp b/src/game/hooks/Protections/ShouldBlockSync.cpp index ee80f4d1..d9ab30b8 100644 --- a/src/game/hooks/Protections/ShouldBlockSync.cpp +++ b/src/game/hooks/Protections/ShouldBlockSync.cpp @@ -48,7 +48,7 @@ namespace { using namespace YimMenu; - void LogNode(CProjectBaseSyncDataNode* node, SyncNodeId id, eNetObjType type, rage::netObject* object) + void LogNode(CProjectBaseSyncDataNode* node, SyncNodeId id, NetObjType type, rage::netObject* object) { if (!object) return; // TODO: log creation queue syncs @@ -237,7 +237,7 @@ namespace // note that object can be nullptr here if it hasn't been created yet (i.e. in the creation queue) - bool ShouldBlockNode(CProjectBaseSyncDataNode* node, SyncNodeId id, eNetObjType type, rage::netObject* object) + bool ShouldBlockNode(CProjectBaseSyncDataNode* node, SyncNodeId id, NetObjType type, rage::netObject* object) { switch (id) { @@ -389,7 +389,7 @@ namespace return true; } - if (data.m_IsAttached && object && object->m_ObjectType == (uint16_t)eNetObjType::Trailer) + if (data.m_IsAttached && object && object->m_ObjectType == (uint16_t)NetObjType::Trailer) { LOG(WARNING) << "Blocked physical trailer attachment crash from " << Protections::GetSyncingPlayer().GetName(); Notifications::Show("Protections", @@ -457,7 +457,7 @@ namespace return true; } - if (data.m_IsAttached && object && object->m_ObjectType == (uint16_t)eNetObjType::Trailer) + if (data.m_IsAttached && object && object->m_ObjectType == (uint16_t)NetObjType::Trailer) { LOG(WARNING) << "Blocked trailer ped attachment crash from " << Protections::GetSyncingPlayer().GetName(); Notifications::Show("Protections", @@ -494,7 +494,7 @@ namespace return false; } - bool SyncNodeVisitor(CProjectBaseSyncDataNode* node, eNetObjType type, rage::netObject* object) + bool SyncNodeVisitor(CProjectBaseSyncDataNode* node, NetObjType type, rage::netObject* object) { if (node->IsParentNode()) { @@ -520,7 +520,7 @@ namespace namespace YimMenu::Hooks::Protections { - bool ShouldBlockSync(rage::netSyncTree* tree, eNetObjType type, rage::netObject* object) + bool ShouldBlockSync(rage::netSyncTree* tree, NetObjType type, rage::netObject* object) { Nodes::Init(); diff --git a/src/game/rdr/Enums.hpp b/src/game/rdr/Enums.hpp index 324a7b01..ccadbcb4 100644 --- a/src/game/rdr/Enums.hpp +++ b/src/game/rdr/Enums.hpp @@ -1,6 +1,6 @@ #pragma once -enum class eInputGroup +enum class InputGroup { INPUT_GROUP_UNK1 = 0, INPUT_GROUP_UNK2, @@ -339,7 +339,7 @@ constexpr static auto g_NetEventsToString = std::to_array({ "NETWORK_FORCE_IN_SCOPE_FOR_DUPLICATE_OBJECT_OWNER", }); -enum class eNativeInputs : unsigned +enum class NativeInputs : unsigned { INPUT_NEXT_CAMERA = 0x7f8d09b8, INPUT_LOOK_LR = 0xa987235f, @@ -1115,7 +1115,7 @@ enum class eNativeInputs : unsigned INPUT_SCRIPTED_FLY_ZDOWN = 0x9c5e030c, }; -enum class eAttributeCore +enum class AttributeCore { ATTRIBUTE_CORE_HEALTH, ATTRIBUTE_CORE_STAMINA, @@ -1137,7 +1137,7 @@ enum class MotivationState DRUNK_STATE }; -enum class eCrimeType : unsigned +enum class CrimeType : unsigned { CRIME_ACCOMPLICE = 0xAF074F6D, CRIME_ARSON = 0x68134DC7, @@ -1199,7 +1199,7 @@ enum class eCrimeType : unsigned CRIME_WANTED_LEVEL_UP_DEBUG_LOW = 0xD891890F }; -enum class eLawRegion : unsigned +enum class LawRegion : unsigned { LAW_DISPATCH_REGION_NONE = 0, LAW_REGION_AGUASDULCES = 0x2F573EBE, @@ -1253,14 +1253,14 @@ enum class eLawRegion : unsigned LAW_REGION_WAPITI = 0x7A976E02 }; -enum class ePedDamageCleanliness +enum class PedDamageCleanliness { PED_DAMAGE_CLEANLINESS_POOR, PED_DAMAGE_CLEANLINESS_GOOD, PED_DAMAGE_CLEANLINESS_PERFECT }; -enum class eNetObjType +enum class NetObjType { Animal = 0x0, Automobile = 0x1, @@ -1332,7 +1332,7 @@ enum class ExplosionTypes GLASS_SMASHING_SOUND_TOXIC_GAS_CLOUD }; -enum class eCarryingFlags +enum class CarryingFlags { CARRYING_FLAG_CAN_BE_HOGTIED, CARRYING_FLAG_CAN_BE_CUT_FREE, @@ -1363,7 +1363,7 @@ enum class eCarryingFlags CARRYING_FLAG_FORCE_HIDE_PROMPT_GROUP }; -enum class eLassoFlags +enum class LassoFlags { LHF_CAN_BE_LASSOED, LHF_CAN_BE_LASSOED_WHEN_DEAD, @@ -1494,7 +1494,7 @@ enum class NetMessageType : uint32_t UNK_0x59 = 0x59, }; -enum class eWeaponHash : uint32_t +enum class WeaponHash : uint32_t { WEAPON_BOW = 2292731996, // Bow WEAPON_BOW_CHARLES = 2031861036, // Charles' Bow @@ -1609,7 +1609,7 @@ enum class eWeaponHash : uint32_t WEAPON_UNARMED = 2725352035, // Unarmed }; -enum class ePresenceEvents : uint32_t +enum class PresenceEvents : uint32_t { PRESENCE_STAT_UPDATE = 0xedf54ce2, PRESENCE_FRIEND_CREW_JOINED = 0x12859620, @@ -2305,7 +2305,7 @@ enum class PedConfigFlag _0x640FF990 = 602, }; -enum eEmoteType +enum EmoteType { EMOTE_TYPE_INVALID = -1, EMOTE_TYPE_REACT, @@ -2316,10 +2316,22 @@ enum eEmoteType EMOTE_TYPE_DANCE_FLOOR }; -enum eEmotePlaybackMode +enum EmotePlaybackMode { EMOTE_PM_INVALID = -1, EMOTE_PM_UPPERBODY, EMOTE_PM_UPPERBODY_LOOP, EMOTE_PM_FULLBODY, +}; + +enum class EntityProofs : uint32_t +{ + BULLET = 1 << 0, + FIRE = 1 << 1, + EXPLOSION = 1 << 2, + COLLISION = 1 << 3, + MELEE = 1 << 4, + STEAM = 1 << 5, + SMOKE = 1 << 6, + HEADSHOT = 1 << 7 }; \ No newline at end of file diff --git a/src/game/rdr/Nodes.cpp b/src/game/rdr/Nodes.cpp index e4bf5ea3..d170e1c5 100644 --- a/src/game/rdr/Nodes.cpp +++ b/src/game/rdr/Nodes.cpp @@ -4,19 +4,19 @@ namespace YimMenu { - SyncNodeId& Nodes::FindImpl(eNetObjType obj_type, uintptr_t addr) + SyncNodeId& Nodes::FindImpl(NetObjType obj_type, uintptr_t addr) { return m_Finder.m_SyncTressSyncNodeAddrToIds[(int)obj_type][addr]; } - SyncNodeVftToIds& Nodes::GetNodesForTypeImpl(eNetObjType obj_type) + SyncNodeVftToIds& Nodes::GetNodesForTypeImpl(NetObjType obj_type) { return m_Finder.m_SyncTressSyncNodeAddrToIds[(int)obj_type]; } void Nodes::InitImpl() { - for (int i = (int)eNetObjType::Animal; i < (int)eNetObjType::Max; i++) + for (int i = (int)NetObjType::Animal; i < (int)NetObjType::Max; i++) { rage::netSyncTree* tree = Pointers.GetSyncTreeForType(nullptr, i); diff --git a/src/game/rdr/Nodes.hpp b/src/game/rdr/Nodes.hpp index d37eb664..bab6611f 100644 --- a/src/game/rdr/Nodes.hpp +++ b/src/game/rdr/Nodes.hpp @@ -42,7 +42,7 @@ namespace YimMenu struct SyncNodeFinder { - static constexpr size_t sm_SyncTreeCount = size_t(eNetObjType::Max); + static constexpr size_t sm_SyncTreeCount = size_t(NetObjType::Max); std::array m_SyncTressSyncNodeAddrToIds; std::array m_SyncTreeNodeIdsMap; @@ -57,8 +57,8 @@ namespace YimMenu bool m_Initialized = false; std::mutex m_InitMutex; - SyncNodeId& FindImpl(eNetObjType obj_type, uintptr_t addr); - SyncNodeVftToIds& GetNodesForTypeImpl(eNetObjType obj_type); + SyncNodeId& FindImpl(NetObjType obj_type, uintptr_t addr); + SyncNodeVftToIds& GetNodesForTypeImpl(NetObjType obj_type); void InitImpl(); static Nodes& GetInstance() @@ -82,12 +82,12 @@ namespace YimMenu GetInstance().m_Initialized = false; } - static SyncNodeId& Find(eNetObjType obj_type, uintptr_t addr) + static SyncNodeId& Find(NetObjType obj_type, uintptr_t addr) { return GetInstance().FindImpl(obj_type, addr); } - static SyncNodeVftToIds& GetNodesForType(eNetObjType obj_type) + static SyncNodeVftToIds& GetNodesForType(NetObjType obj_type) { return GetInstance().GetNodesForTypeImpl(obj_type); } diff --git a/src/game/rdr/data/Emotes.hpp b/src/game/rdr/data/Emotes.hpp index 5ea28420..56c60cd5 100644 --- a/src/game/rdr/data/Emotes.hpp +++ b/src/game/rdr/data/Emotes.hpp @@ -21,7 +21,7 @@ namespace YimMenu::Emote { const char* name; uint32_t hash; - eEmoteType type; + EmoteType type; }; // Emote Items From 5514165aba2e68a38b0215c0ed6764265874785b Mon Sep 17 00:00:00 2001 From: tyackman Date: Tue, 16 Jul 2024 13:20:20 -0500 Subject: [PATCH 05/15] Ticker event --- src/game/backend/Players.hpp | 14 ++ .../players/toxic/ActivateDefensiveMode.cpp | 15 +- .../players/toxic/ActivateOffensiveMode.cpp | 13 +- src/game/features/players/toxic/EndParlay.cpp | 4 +- .../features/players/toxic/IncreaseBounty.cpp | 6 +- .../features/players/toxic/MaximumHonor.cpp | 10 +- .../features/players/toxic/MinimumHonor.cpp | 8 +- .../features/players/toxic/SendTicker.cpp | 132 ++++++++++++++++++ .../features/players/toxic/StartParlay.cpp | 10 +- src/game/frontend/submenus/Players.cpp | 3 + .../Protections/HandleScriptedGameEvent.cpp | 3 +- src/game/rdr/Enums.hpp | 3 +- src/game/rdr/Scripts.cpp | 6 +- src/game/rdr/Scripts.hpp | 2 +- 14 files changed, 195 insertions(+), 34 deletions(-) create mode 100644 src/game/features/players/toxic/SendTicker.cpp diff --git a/src/game/backend/Players.hpp b/src/game/backend/Players.hpp index a3ccbb1b..3a050269 100644 --- a/src/game/backend/Players.hpp +++ b/src/game/backend/Players.hpp @@ -46,6 +46,20 @@ namespace YimMenu return GetInstance().m_PlayerDatas[idx]; } + static Player GetRandomPlayer() + { + auto& players = GetPlayers(); + + if (players.empty()) + { + return Player((uint8_t)0); + } + + uint8_t random = static_cast(rand() % players.size()); + auto it = std::next(players.begin(), random); + return it->second; + } + private: static Players& GetInstance() { diff --git a/src/game/features/players/toxic/ActivateDefensiveMode.cpp b/src/game/features/players/toxic/ActivateDefensiveMode.cpp index 86376cb2..86017080 100644 --- a/src/game/features/players/toxic/ActivateDefensiveMode.cpp +++ b/src/game/features/players/toxic/ActivateDefensiveMode.cpp @@ -5,17 +5,22 @@ namespace YimMenu::Features { + void Defensive(Player player) + { + uint64_t data[13]{}; + data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_NOTORIETY_FORCE_PASSIVE); + data[1] = player.GetId(); + data[8] = 2; + Scripts::SendScriptEvent(data, 13, 43, 1 << player.GetId()); + } + class ActivateDefensiveMode : public PlayerCommand { using PlayerCommand::PlayerCommand; virtual void OnCall(Player player) override { - uint64_t data[13]{}; - data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_NOTORIETY_FORCE_PASSIVE); - data[1] = Self::GetPlayer().GetId(); - data[8] = 2; - Scripts::SendScriptEvent(data, 13, 1 << player.GetId()); + Defensive(player); } }; diff --git a/src/game/features/players/toxic/ActivateOffensiveMode.cpp b/src/game/features/players/toxic/ActivateOffensiveMode.cpp index eba2255f..86ae9104 100644 --- a/src/game/features/players/toxic/ActivateOffensiveMode.cpp +++ b/src/game/features/players/toxic/ActivateOffensiveMode.cpp @@ -6,16 +6,21 @@ namespace YimMenu::Features { + void Offensive(Player player) + { + uint64_t data[13]{}; + data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_NOTORIETY_FORCE_NOT_PASSIVE_HORSE); + data[1] = player.GetId(); + Scripts::SendScriptEvent(data, 13, 43, 1 << player.GetId()); + } + class ActivateOffensiveMode : public PlayerCommand { using PlayerCommand::PlayerCommand; virtual void OnCall(Player player) override { - uint64_t data[13]{}; - data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_NOTORIETY_FORCE_NOT_PASSIVE_HORSE); - data[1] = Self::GetPlayer().GetId(); - Scripts::SendScriptEvent(data, 13, 1 << player.GetId()); + Offensive(player); } }; diff --git a/src/game/features/players/toxic/EndParlay.cpp b/src/game/features/players/toxic/EndParlay.cpp index c9f55579..bc5d6926 100644 --- a/src/game/features/players/toxic/EndParlay.cpp +++ b/src/game/features/players/toxic/EndParlay.cpp @@ -9,12 +9,12 @@ namespace YimMenu::Features void ParlayEnd(int bits) { uint64_t data[7]{}; - data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_PARLEY); + data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_PARLAY); data[1] = Self::GetPlayer().GetId(); data[4] = 5; data[5] = 11; data[6] = 9; - Scripts::SendScriptEvent(data, 9, bits); + Scripts::SendScriptEvent(data, 9, 10, bits); } class EndParlay : public PlayerCommand diff --git a/src/game/features/players/toxic/IncreaseBounty.cpp b/src/game/features/players/toxic/IncreaseBounty.cpp index 6b580f58..662ef970 100644 --- a/src/game/features/players/toxic/IncreaseBounty.cpp +++ b/src/game/features/players/toxic/IncreaseBounty.cpp @@ -6,11 +6,11 @@ namespace YimMenu::Features { - void AddBounty(int bits) + void AddBounty(Player player) { uint64_t data[13]{}; data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_NOTORIETY_PRESS_CHARGES); - data[1] = Self::GetPlayer().GetId(); + data[1] = player.GetId(); data[4] = 2; data[5] = 5; data[6] = 9; @@ -21,7 +21,7 @@ namespace YimMenu::Features { for (int j = 0; j < 10; ++j) { - Scripts::SendScriptEvent(data, 13, bits); + Scripts::SendScriptEvent(data, 13, 7, 1 << player.GetId()); } ScriptMgr::Yield(); diff --git a/src/game/features/players/toxic/MaximumHonor.cpp b/src/game/features/players/toxic/MaximumHonor.cpp index 654dda17..0b8423a9 100644 --- a/src/game/features/players/toxic/MaximumHonor.cpp +++ b/src/game/features/players/toxic/MaximumHonor.cpp @@ -17,13 +17,13 @@ namespace YimMenu::Features data[4] = 2; data[5] = "PERSONA_HONOR_ACTION__FME_BOUNTY_RETURNED_ALIVE"_J; data[6] = 1; - Scripts::SendScriptEvent(data, 13, bits); + Scripts::SendScriptEvent(data, 13, 6, bits); data[5] = "PERSONA_HONOR_ACTION__HORSE_CARE"_J; - Scripts::SendScriptEvent(data, 13, bits); + Scripts::SendScriptEvent(data, 13, 6, bits); data[5] = "PERSONA_HONOR_ACTION__NB_KIDNAPPED_RESCUE"_J; - Scripts::SendScriptEvent(data, 13, bits); + Scripts::SendScriptEvent(data, 13, 6, bits); data[5] = "PERSONA_HONOR_ACTION__MISSION_POS_FIFTY"_J; - Scripts::SendScriptEvent(data, 13, bits); + Scripts::SendScriptEvent(data, 13, 6, bits); ScriptMgr::Yield(40ms); } } @@ -44,7 +44,7 @@ namespace YimMenu::Features virtual void OnCall() override { - MaxHonor(-1 & ~(1 << Self::GetPlayer().GetId())); + MaxHonor(-1 & ~(1 << Self::GetPlayer().GetId())); // TODO } }; diff --git a/src/game/features/players/toxic/MinimumHonor.cpp b/src/game/features/players/toxic/MinimumHonor.cpp index 359d49c9..9720cfc9 100644 --- a/src/game/features/players/toxic/MinimumHonor.cpp +++ b/src/game/features/players/toxic/MinimumHonor.cpp @@ -17,13 +17,13 @@ namespace YimMenu::Features data[4] = 2; data[5] = "PERSONA_HONOR_ACTION__MISSION_NEG_FIFTY"_J; data[6] = 1; - Scripts::SendScriptEvent(data, 13, bits); + Scripts::SendScriptEvent(data, 13, 6, bits); data[5] = "PERSONA_HONOR_ACTION__MISSION_NEG_FORTYFIVE"_J; - Scripts::SendScriptEvent(data, 13, bits); + Scripts::SendScriptEvent(data, 13, 6, bits); data[5] = "PERSONA_HONOR_ACTION__MURDER_RAMPAGE"_J; - Scripts::SendScriptEvent(data, 13, bits); + Scripts::SendScriptEvent(data, 13, 6, bits); data[5] = "PERSONA_HONOR_ACTION__MURDER_BUTCHER"_J; - Scripts::SendScriptEvent(data, 13, bits); + Scripts::SendScriptEvent(data, 13, 6, bits); ScriptMgr::Yield(40ms); } } diff --git a/src/game/features/players/toxic/SendTicker.cpp b/src/game/features/players/toxic/SendTicker.cpp new file mode 100644 index 00000000..9748b263 --- /dev/null +++ b/src/game/features/players/toxic/SendTicker.cpp @@ -0,0 +1,132 @@ +#include "game/backend/Self.hpp" +#include "game/backend/Players.hpp" +#include "game/commands/PlayerCommand.hpp" +#include "core/commands/ListCommand.hpp" +#include "core/commands/BoolCommand.hpp" +#include "game/rdr/Enums.hpp" +#include "game/rdr/Scripts.hpp" +#include "game/rdr/Natives.hpp" + +namespace YimMenu::Features +{ + static std::vector> g_TickerEvents = + { + {0, "JOINED_DEFAULT"}, + {2, "VERSUS_NORMAL"}, + {3, "VERSUS_TEAMKILL"}, + {4, "VERSUS_SUICIDE"}, + {6, "VERSUS_INCAPACITATED"}, + {7, "VERSUS_INCAPACITATED_EXECUTION"}, + {8, "INCAPACITATION_REVIVE"}, + {9, "INCAPACITATION_SELF_REVIVE"}, + {10, "MONEYBAG_PICKUP"}, + {11, "MONEYBAG_DROPPED"}, + {12, "INVITE_RECEIVED"}, + {13, "J_SKIP"}, + {14, "P_SKIP"}, + {15, "F_SKIP"}, + {16, "S_SKIP"}, + {17, "MISSION_TIMER_SKIP"}, + {18, "TIME_SKIP"}, + {19, "WEATHER"}, + {20, "INVULNERABLE"}, + {21, "VULNERABLE"}, + {22, "WEAPONS"}, + {23, "CHEAT_XP_PLUS"}, + {24, "CHEAT_XP_MINUS"}, + {25, "CHEAT_MONEY"}, + {26, "CHEAT_HONOR_PLUS"}, + {27, "CHEAT_HONOR_MINUS"}, + {28, "CHEAT_WARP"}, + {29, "CHEAT_DEADEYE"}, + {30, "CHEAT_INFINITE_DEADEYE"}, + {31, "CHEAT_INFINITE_STAMINA"}, + {32, "CHEAT_REFILL_RPG_CORES"}, + {33, "CHEAT_REFILL_RPG_TANKS"}, + {34, "CHEAT_OVERPOWER_RPG_CORES"}, + {35, "CHEAT_DISABLE_INFINITE_STAMINA"}, + {36, "CHEAT_DISABLE_INFINITE_DEADEYE"}, + {37, "CHEAT_DEADEYE_REMOVE_ALL"}, + {38, "CHEAT_HEALTH"}, + {39, "CHEAT_VEHICLE"}, + {44, "NET_UNLOCK"}, + {45, "PERSONA_LEVEL_UP"}, + {46, "GANG_INVITE"}, + {47, "GANG_REQUEST"}, + {48, "GANG_JOINED"}, + {50, "GANG_KICKED"}, + {51, "GANG_LEFT"}, + {52, "GANG_STARTED"}, + {53, "GANG_CAMP_PLACED"}, + {54, "GANG_CAMP_FAIL"}, + {55, "GANG_CAMP_READY"}, + {56, "GANG_CAMP_ATTEMPT"}, + {57, "GANG_CAMP_SEARCH"}, + {58, "GANG_CAMP_SHUTDOWN"}, + {60, "GANG_ON_MISSION"}, + {61, "P_POSSE_START"}, + {62, "P_POSSE_FAIL"}, + {63, "P_POSSE_JOIN"}, + {64, "P_POSSE_LEAVE"}, + {65, "P_POSSE_PROMOTED"}, + {66, "P_POSSE_DEMOTED"}, + {68, "STORY_MISSION_INVITE_RECEIVED"}, + {71, "NET_GANG_BOUNTY_TURNIN"}, + {72, "VS_MISSION_INVITE"}, + {73, "VS_MISSION_FAILED_TO_JOIN"}, + {74, "VS_MISSION_REQUEST_TO_LEADER"}, + {75, "VS_MISSION_FORCE_JOIN"}, + {76, "VS_MISSION_FORCE_LEAVE_FULL"}, + {77, "VS_MISSION_FORCE_REMOVE_INVITE"}, + {78, "IN_WORLD_DEATHMATCH_1V1"}, + {79, "IN_WORLD_DEATHMATCH_POSSE_V_POSSE"}, + {80, "IN_WORLD_DEATHMATCH_POSSE_LEADER_FEUD"}, + {81, "IN_WORLD_DEATHMATCH_POSSE_FEUD"}, + {82, "IN_WORLD_DEATHMATCH_POSSE_INFIGHTING"}, + {83, "IN_WORLD_DEATHMATCH_POSSE_FEUD_MEMBERS"}, + {84, "IN_WORLD_DEATHMATCH_POSSE_LEADER_FEUD_MEMBERS"}, + {92, "HUNTSMEN_PRISTINE_SKIN_FOUND"}, + {93, "CONVOY_ROBBERY_TURN_IN"}, + {94, "PLAYER_FORCE_DEBUG_WARP"}, + {95, "ANIMAL_ATTACK_REWARD"}, + {96, "MINIGAME_INVITE"}, + {101, "SHOP_SPLIT_MONEY_WITH_POSSE"}, + {102, "PASSIVE_MODE_ENDED"}, + {103, "PRESSED_CHARGES"}, + {108, "PLAYER_BOUNTY_PVP_MISSION_FAILED_TO_LAUNCH"}, + {109, "PLAYER_FLAVORED_MOONSHINE"}, + {110, "PLAYER_KILLED_LEGENDARY_ANIMAL"}, + {111, "PLAYER_TRANQUILIZED_LEGENDARY_ANIMAL"}, + {112, "ABANDONED_LOOT_OPENED"} + }; + + static ListCommand _TickerMessage{"tickermessage", "Ticker Message", "The ticker message to send", g_TickerEvents, 0}; + //static BoolCommand _RandomSender{"randomsender", "Random Sender", "Randomize the sending player"}; + + void SendTickerMessage(Player player) + { + auto bits = 1 << player.GetId(); uint64_t data[19]{}; + data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_TICKER_MESSAGE); + data[1] = player.GetId(); + data[2] = NETWORK::GET_NETWORK_TIME_ACCURATE(); + data[4] = _TickerMessage.GetState(); + data[12] = -1; + data[13] = -1; + data[14] = 255; + data[18] = 1; + + Scripts::SendScriptEvent(data, 19, 7, 1 << player.GetId()); + } + + class SendTicker : public PlayerCommand + { + using PlayerCommand::PlayerCommand; + + virtual void OnCall(Player player) override + { + SendTickerMessage(player); + } + }; + + static SendTicker _SendTicker{"sendticker", "Send Ticker Message", "Sends the player a ticker notification", 0, false}; +} \ No newline at end of file diff --git a/src/game/features/players/toxic/StartParlay.cpp b/src/game/features/players/toxic/StartParlay.cpp index a329195a..0cef45b0 100644 --- a/src/game/features/players/toxic/StartParlay.cpp +++ b/src/game/features/players/toxic/StartParlay.cpp @@ -6,15 +6,15 @@ namespace YimMenu::Features { - void ParlayStart(int bits) + void ParlayStart(Player player) { uint64_t data[7]{}; - data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_PARLEY); - data[1] = Self::GetPlayer().GetId(); + data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_PARLAY); + data[1] = player.GetId(); data[4] = 3; data[5] = 11; data[6] = 9; - Scripts::SendScriptEvent(data, 9, bits); + Scripts::SendScriptEvent(data, 9, 10, 1 << player.GetId()); } class StartParlay : public PlayerCommand @@ -23,7 +23,7 @@ namespace YimMenu::Features virtual void OnCall(Player player) override { - ParlayStart(1 << player.GetId()); + ParlayStart(player); } }; diff --git a/src/game/frontend/submenus/Players.cpp b/src/game/frontend/submenus/Players.cpp index 115ff48b..a1744aee 100644 --- a/src/game/frontend/submenus/Players.cpp +++ b/src/game/frontend/submenus/Players.cpp @@ -288,6 +288,9 @@ namespace YimMenu::Submenus general->AddItem(std::make_shared("startparlay"_J)); general->AddItem(std::make_shared("endparlay"_J)); general->AddItem(std::make_shared("increasebounty"_J)); + general->AddItem(std::make_shared("sendticker"_J)); + //general->AddItem(std::make_shared("randomsender"_J)); + general->AddItem(std::make_shared("tickermessage"_J, "Message")); auto mount = std::make_shared("Mount"); mount->AddItem(std::make_shared("kickhorse"_J)); diff --git a/src/game/hooks/Protections/HandleScriptedGameEvent.cpp b/src/game/hooks/Protections/HandleScriptedGameEvent.cpp index 9992e0ca..89a5d3f4 100644 --- a/src/game/hooks/Protections/HandleScriptedGameEvent.cpp +++ b/src/game/hooks/Protections/HandleScriptedGameEvent.cpp @@ -67,7 +67,7 @@ namespace YimMenu::Hooks } break; } - case ScriptEvent::SCRIPT_EVENT_PARLEY: + case ScriptEvent::SCRIPT_EVENT_PARLAY: { if (event->m_Data[4] == 3) { @@ -79,6 +79,7 @@ namespace YimMenu::Hooks Notifications::Show("Protections", std::format("Blocked end parlay from {}", src->GetName()), NotificationType::Warning); return true; } + break; } } diff --git a/src/game/rdr/Enums.hpp b/src/game/rdr/Enums.hpp index ccadbcb4..e817dd1f 100644 --- a/src/game/rdr/Enums.hpp +++ b/src/game/rdr/Enums.hpp @@ -1381,7 +1381,8 @@ enum class LassoFlags enum class ScriptEvent { - SCRIPT_EVENT_PARLEY = 28, + SCRIPT_EVENT_TICKER_MESSAGE = 0, + SCRIPT_EVENT_PARLAY = 28, SCRIPT_EVENT_NOTORIETY_PRESS_CHARGES = 35, SCRIPT_EVENT_NOTORIETY_FORCE_PASSIVE = 36, SCRIPT_EVENT_NOTORIETY_FORCE_NOT_PASSIVE_HORSE = 37, diff --git a/src/game/rdr/Scripts.cpp b/src/game/rdr/Scripts.cpp index fea67b48..fcee436d 100644 --- a/src/game/rdr/Scripts.cpp +++ b/src/game/rdr/Scripts.cpp @@ -33,12 +33,12 @@ namespace YimMenu::Scripts *Pointers.CurrentScriptThread = og_thread; } - void SendScriptEvent(uint64_t* data, int count, int bits) + void SendScriptEvent(uint64_t* data, int count, int metadataIndex, int bits) { if (auto thread = FindScriptThread("net_main_offline"_J)) { - RunAsScript(thread, [data, count, &bits] { - SCRIPTS::TRIGGER_SCRIPT_EVENT(1, data, count, 0, &bits); + RunAsScript(thread, [data, count, metadataIndex, &bits] { + SCRIPTS::TRIGGER_SCRIPT_EVENT(1, data, count, metadataIndex, &bits); }); } } diff --git a/src/game/rdr/Scripts.hpp b/src/game/rdr/Scripts.hpp index fefc8c6f..9f329d98 100644 --- a/src/game/rdr/Scripts.hpp +++ b/src/game/rdr/Scripts.hpp @@ -10,7 +10,7 @@ namespace YimMenu::Scripts { extern rage::scrThread* FindScriptThread(joaat_t hash); extern void RunAsScript(rage::scrThread* thread, std::function callback); - extern void SendScriptEvent(uint64_t* data, int count, int bits); + extern void SendScriptEvent(uint64_t* data, int count, int metadataIndex, int bits); extern const char* GetScriptName(joaat_t hash); extern void ForceScriptHost(rage::scrThread* thread); } \ No newline at end of file From 3b74be486d156443b1480694b906880a9c941dc4 Mon Sep 17 00:00:00 2001 From: tyackman Date: Tue, 16 Jul 2024 22:44:39 -0500 Subject: [PATCH 06/15] Update, not done --- src/core/misc/RateLimiter.hpp | 42 ++++++++ src/game/backend/PlayerData.hpp | 2 + src/game/backend/Players.hpp | 2 +- src/game/features/players/toxic/EndParlay.cpp | 8 +- .../features/players/toxic/IncreaseBounty.cpp | 2 +- .../features/players/toxic/MaximumHonor.cpp | 9 +- .../features/players/toxic/MinimumHonor.cpp | 5 +- .../features/players/toxic/SendTicker.cpp | 97 +------------------ src/game/features/self/Godmode.cpp | 2 +- src/game/frontend/submenus/Players.cpp | 1 - .../Protections/HandleScriptedGameEvent.cpp | 3 + src/game/rdr/Enums.hpp | 9 +- src/game/rdr/data/TickerEvents.hpp | 95 ++++++++++++++++++ 13 files changed, 167 insertions(+), 110 deletions(-) create mode 100644 src/core/misc/RateLimiter.hpp create mode 100644 src/game/rdr/data/TickerEvents.hpp diff --git a/src/core/misc/RateLimiter.hpp b/src/core/misc/RateLimiter.hpp new file mode 100644 index 00000000..9f8ff027 --- /dev/null +++ b/src/core/misc/RateLimiter.hpp @@ -0,0 +1,42 @@ +#pragma once +#include + +namespace YimMenu +{ + class RateLimiter + { + uint32_t m_AttemptsAllowedInTimePeriod; + std::chrono::milliseconds m_TimePeriod; + std::chrono::system_clock::time_point m_LastEventTime{}; + uint32_t m_NumAttemptsAllowed = 0; + + public: + RateLimiter(std::chrono::milliseconds time_period, uint32_t num_allowed_attempts) : + m_AttemptsAllowedInTimePeriod(num_allowed_attempts), + m_TimePeriod(time_period) + { + } + + // Returns true if the rate limit has been exceeded + bool Process() + { + if (std::chrono::system_clock::now() - m_LastEventTime < m_TimePeriod) + { + if (++m_NumAttemptsAllowed > m_AttemptsAllowedInTimePeriod) + return true; + } + else + { + m_LastEventTime = std::chrono::system_clock::now(); + m_NumAttemptsAllowed = 1; + } + return false; + } + + // Check if the rate limit was exceeded by the last process() call. Use this to prevent the player from being flooded with notifications + bool ExceededLastProcess() + { + return (m_NumAttemptsAllowed - 1) == m_AttemptsAllowedInTimePeriod; + } + }; +} \ No newline at end of file diff --git a/src/game/backend/PlayerData.hpp b/src/game/backend/PlayerData.hpp index 9c7f8196..a4c27c75 100644 --- a/src/game/backend/PlayerData.hpp +++ b/src/game/backend/PlayerData.hpp @@ -1,4 +1,5 @@ #pragma once +#include "core/misc/RateLimiter.hpp" namespace YimMenu { @@ -6,5 +7,6 @@ namespace YimMenu { public: bool m_UseSessionSplitKick{}; + RateLimiter m_TickerMessageRateLimit{5s, 3}; }; } \ No newline at end of file diff --git a/src/game/backend/Players.hpp b/src/game/backend/Players.hpp index 3a050269..dd3434bc 100644 --- a/src/game/backend/Players.hpp +++ b/src/game/backend/Players.hpp @@ -46,7 +46,7 @@ namespace YimMenu return GetInstance().m_PlayerDatas[idx]; } - static Player GetRandomPlayer() + static Player GetRandom() { auto& players = GetPlayers(); diff --git a/src/game/features/players/toxic/EndParlay.cpp b/src/game/features/players/toxic/EndParlay.cpp index bc5d6926..945746ab 100644 --- a/src/game/features/players/toxic/EndParlay.cpp +++ b/src/game/features/players/toxic/EndParlay.cpp @@ -6,15 +6,15 @@ namespace YimMenu::Features { - void ParlayEnd(int bits) + void ParlayEnd(Player player) { uint64_t data[7]{}; data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_PARLAY); - data[1] = Self::GetPlayer().GetId(); + data[1] = player.GetId(); data[4] = 5; data[5] = 11; data[6] = 9; - Scripts::SendScriptEvent(data, 9, 10, bits); + Scripts::SendScriptEvent(data, 9, 10, 1 << player.GetId()); } class EndParlay : public PlayerCommand @@ -23,7 +23,7 @@ namespace YimMenu::Features virtual void OnCall(Player player) override { - ParlayEnd(1 << player.GetId()); + ParlayEnd(player); } }; diff --git a/src/game/features/players/toxic/IncreaseBounty.cpp b/src/game/features/players/toxic/IncreaseBounty.cpp index 662ef970..39207ddb 100644 --- a/src/game/features/players/toxic/IncreaseBounty.cpp +++ b/src/game/features/players/toxic/IncreaseBounty.cpp @@ -34,7 +34,7 @@ namespace YimMenu::Features virtual void OnCall(Player player) override { - AddBounty(1 << player.GetId()); + AddBounty(player); } }; diff --git a/src/game/features/players/toxic/MaximumHonor.cpp b/src/game/features/players/toxic/MaximumHonor.cpp index 0b8423a9..6f61c36a 100644 --- a/src/game/features/players/toxic/MaximumHonor.cpp +++ b/src/game/features/players/toxic/MaximumHonor.cpp @@ -1,11 +1,12 @@ -#include "game/commands/PlayerCommand.hpp" -#include "game/backend/Self.hpp" -#include "game/rdr/Scripts.hpp" #include "game/backend/ScriptMgr.hpp" +#include "game/backend/Self.hpp" +#include "game/commands/PlayerCommand.hpp" #include "game/rdr/Enums.hpp" +#include "game/rdr/Scripts.hpp" namespace YimMenu::Features { + // TODO: Refactor sender void MaxHonor(int bits) { uint64_t data[7]{}; @@ -44,7 +45,7 @@ namespace YimMenu::Features virtual void OnCall() override { - MaxHonor(-1 & ~(1 << Self::GetPlayer().GetId())); // TODO + MaxHonor(-1 & ~(1 << Self::GetPlayer().GetId())); } }; diff --git a/src/game/features/players/toxic/MinimumHonor.cpp b/src/game/features/players/toxic/MinimumHonor.cpp index 9720cfc9..18119267 100644 --- a/src/game/features/players/toxic/MinimumHonor.cpp +++ b/src/game/features/players/toxic/MinimumHonor.cpp @@ -1,11 +1,12 @@ #include "game/backend/ScriptMgr.hpp" -#include "game/commands/PlayerCommand.hpp" #include "game/backend/Self.hpp" -#include "game/rdr/Scripts.hpp" +#include "game/commands/PlayerCommand.hpp" #include "game/rdr/Enums.hpp" +#include "game/rdr/Scripts.hpp" namespace YimMenu::Features { + // TODO: Refactor sender void MinHonor(int bits) { uint64_t data[7]{}; diff --git a/src/game/features/players/toxic/SendTicker.cpp b/src/game/features/players/toxic/SendTicker.cpp index 9748b263..d6beb1fe 100644 --- a/src/game/features/players/toxic/SendTicker.cpp +++ b/src/game/features/players/toxic/SendTicker.cpp @@ -6,106 +6,15 @@ #include "game/rdr/Enums.hpp" #include "game/rdr/Scripts.hpp" #include "game/rdr/Natives.hpp" +#include "game/rdr/data/TickerEvents.hpp" namespace YimMenu::Features { - static std::vector> g_TickerEvents = - { - {0, "JOINED_DEFAULT"}, - {2, "VERSUS_NORMAL"}, - {3, "VERSUS_TEAMKILL"}, - {4, "VERSUS_SUICIDE"}, - {6, "VERSUS_INCAPACITATED"}, - {7, "VERSUS_INCAPACITATED_EXECUTION"}, - {8, "INCAPACITATION_REVIVE"}, - {9, "INCAPACITATION_SELF_REVIVE"}, - {10, "MONEYBAG_PICKUP"}, - {11, "MONEYBAG_DROPPED"}, - {12, "INVITE_RECEIVED"}, - {13, "J_SKIP"}, - {14, "P_SKIP"}, - {15, "F_SKIP"}, - {16, "S_SKIP"}, - {17, "MISSION_TIMER_SKIP"}, - {18, "TIME_SKIP"}, - {19, "WEATHER"}, - {20, "INVULNERABLE"}, - {21, "VULNERABLE"}, - {22, "WEAPONS"}, - {23, "CHEAT_XP_PLUS"}, - {24, "CHEAT_XP_MINUS"}, - {25, "CHEAT_MONEY"}, - {26, "CHEAT_HONOR_PLUS"}, - {27, "CHEAT_HONOR_MINUS"}, - {28, "CHEAT_WARP"}, - {29, "CHEAT_DEADEYE"}, - {30, "CHEAT_INFINITE_DEADEYE"}, - {31, "CHEAT_INFINITE_STAMINA"}, - {32, "CHEAT_REFILL_RPG_CORES"}, - {33, "CHEAT_REFILL_RPG_TANKS"}, - {34, "CHEAT_OVERPOWER_RPG_CORES"}, - {35, "CHEAT_DISABLE_INFINITE_STAMINA"}, - {36, "CHEAT_DISABLE_INFINITE_DEADEYE"}, - {37, "CHEAT_DEADEYE_REMOVE_ALL"}, - {38, "CHEAT_HEALTH"}, - {39, "CHEAT_VEHICLE"}, - {44, "NET_UNLOCK"}, - {45, "PERSONA_LEVEL_UP"}, - {46, "GANG_INVITE"}, - {47, "GANG_REQUEST"}, - {48, "GANG_JOINED"}, - {50, "GANG_KICKED"}, - {51, "GANG_LEFT"}, - {52, "GANG_STARTED"}, - {53, "GANG_CAMP_PLACED"}, - {54, "GANG_CAMP_FAIL"}, - {55, "GANG_CAMP_READY"}, - {56, "GANG_CAMP_ATTEMPT"}, - {57, "GANG_CAMP_SEARCH"}, - {58, "GANG_CAMP_SHUTDOWN"}, - {60, "GANG_ON_MISSION"}, - {61, "P_POSSE_START"}, - {62, "P_POSSE_FAIL"}, - {63, "P_POSSE_JOIN"}, - {64, "P_POSSE_LEAVE"}, - {65, "P_POSSE_PROMOTED"}, - {66, "P_POSSE_DEMOTED"}, - {68, "STORY_MISSION_INVITE_RECEIVED"}, - {71, "NET_GANG_BOUNTY_TURNIN"}, - {72, "VS_MISSION_INVITE"}, - {73, "VS_MISSION_FAILED_TO_JOIN"}, - {74, "VS_MISSION_REQUEST_TO_LEADER"}, - {75, "VS_MISSION_FORCE_JOIN"}, - {76, "VS_MISSION_FORCE_LEAVE_FULL"}, - {77, "VS_MISSION_FORCE_REMOVE_INVITE"}, - {78, "IN_WORLD_DEATHMATCH_1V1"}, - {79, "IN_WORLD_DEATHMATCH_POSSE_V_POSSE"}, - {80, "IN_WORLD_DEATHMATCH_POSSE_LEADER_FEUD"}, - {81, "IN_WORLD_DEATHMATCH_POSSE_FEUD"}, - {82, "IN_WORLD_DEATHMATCH_POSSE_INFIGHTING"}, - {83, "IN_WORLD_DEATHMATCH_POSSE_FEUD_MEMBERS"}, - {84, "IN_WORLD_DEATHMATCH_POSSE_LEADER_FEUD_MEMBERS"}, - {92, "HUNTSMEN_PRISTINE_SKIN_FOUND"}, - {93, "CONVOY_ROBBERY_TURN_IN"}, - {94, "PLAYER_FORCE_DEBUG_WARP"}, - {95, "ANIMAL_ATTACK_REWARD"}, - {96, "MINIGAME_INVITE"}, - {101, "SHOP_SPLIT_MONEY_WITH_POSSE"}, - {102, "PASSIVE_MODE_ENDED"}, - {103, "PRESSED_CHARGES"}, - {108, "PLAYER_BOUNTY_PVP_MISSION_FAILED_TO_LAUNCH"}, - {109, "PLAYER_FLAVORED_MOONSHINE"}, - {110, "PLAYER_KILLED_LEGENDARY_ANIMAL"}, - {111, "PLAYER_TRANQUILIZED_LEGENDARY_ANIMAL"}, - {112, "ABANDONED_LOOT_OPENED"} - }; - - static ListCommand _TickerMessage{"tickermessage", "Ticker Message", "The ticker message to send", g_TickerEvents, 0}; - //static BoolCommand _RandomSender{"randomsender", "Random Sender", "Randomize the sending player"}; + static ListCommand _TickerMessage{"tickermessage", "Ticker Message", "The ticker message to send", Data::g_TickerEvents, 0}; void SendTickerMessage(Player player) { - auto bits = 1 << player.GetId(); uint64_t data[19]{}; + uint64_t data[19]{}; data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_TICKER_MESSAGE); data[1] = player.GetId(); data[2] = NETWORK::GET_NETWORK_TIME_ACCURATE(); diff --git a/src/game/features/self/Godmode.cpp b/src/game/features/self/Godmode.cpp index 6703dace..3c19be2b 100644 --- a/src/game/features/self/Godmode.cpp +++ b/src/game/features/self/Godmode.cpp @@ -17,7 +17,7 @@ namespace YimMenu::Features virtual void OnDisable() override { - Self::GetPed().SetInvincible(true); + Self::GetPed().SetInvincible(false); } }; diff --git a/src/game/frontend/submenus/Players.cpp b/src/game/frontend/submenus/Players.cpp index a1744aee..e3bf8e27 100644 --- a/src/game/frontend/submenus/Players.cpp +++ b/src/game/frontend/submenus/Players.cpp @@ -289,7 +289,6 @@ namespace YimMenu::Submenus general->AddItem(std::make_shared("endparlay"_J)); general->AddItem(std::make_shared("increasebounty"_J)); general->AddItem(std::make_shared("sendticker"_J)); - //general->AddItem(std::make_shared("randomsender"_J)); general->AddItem(std::make_shared("tickermessage"_J, "Message")); auto mount = std::make_shared("Mount"); diff --git a/src/game/hooks/Protections/HandleScriptedGameEvent.cpp b/src/game/hooks/Protections/HandleScriptedGameEvent.cpp index 89a5d3f4..dcfb3bb1 100644 --- a/src/game/hooks/Protections/HandleScriptedGameEvent.cpp +++ b/src/game/hooks/Protections/HandleScriptedGameEvent.cpp @@ -1,8 +1,11 @@ #include "core/commands/BoolCommand.hpp" #include "core/hooking/DetourHook.hpp" #include "core/frontend/Notifications.hpp" +#include "core/misc/RateLimiter.hpp" #include "game/backend/Protections.hpp" #include "game/hooks/Hooks.hpp" +#include "game/rdr/data/TickerEvents.hpp" +#include "game/backend/Players.hpp" #include #include diff --git a/src/game/rdr/Enums.hpp b/src/game/rdr/Enums.hpp index e817dd1f..c427a8de 100644 --- a/src/game/rdr/Enums.hpp +++ b/src/game/rdr/Enums.hpp @@ -1381,12 +1381,17 @@ enum class LassoFlags enum class ScriptEvent { - SCRIPT_EVENT_TICKER_MESSAGE = 0, + SCRIPT_EVENT_TICKER_MESSAGE = 0, + SCRIPT_EVENT_AMBIENT_CONTENT_EVALUATOR = 4, + SCRIPT_EVENT_ACE_LAUNCHER = 5, SCRIPT_EVENT_PARLAY = 28, SCRIPT_EVENT_NOTORIETY_PRESS_CHARGES = 35, SCRIPT_EVENT_NOTORIETY_FORCE_PASSIVE = 36, SCRIPT_EVENT_NOTORIETY_FORCE_NOT_PASSIVE_HORSE = 37, - SCRIPT_EVENT_PERSONA_HONOR = 188 + SCRIPT_EVENT_FETCH_MANAGER = 178, + SCRIPT_EVENT_NET_HUD = 186, + SCRIPT_EVENT_PERSONA_HONOR = 188, + SCRIPT_EVENT_PLAYER_CAMP = 201 }; enum class NetMessageType : uint32_t diff --git a/src/game/rdr/data/TickerEvents.hpp b/src/game/rdr/data/TickerEvents.hpp new file mode 100644 index 00000000..5fad58f8 --- /dev/null +++ b/src/game/rdr/data/TickerEvents.hpp @@ -0,0 +1,95 @@ +#pragma once + +namespace YimMenu::Data +{ + static std::vector> g_TickerEvents = + { + {0, "JOINED_DEFAULT"}, + {2, "VERSUS_NORMAL"}, + {3, "VERSUS_TEAMKILL"}, + {4, "VERSUS_SUICIDE"}, + {6, "VERSUS_INCAPACITATED"}, + {7, "VERSUS_INCAPACITATED_EXECUTION"}, + {8, "INCAPACITATION_REVIVE"}, + {9, "INCAPACITATION_SELF_REVIVE"}, + {10, "MONEYBAG_PICKUP"}, + {11, "MONEYBAG_DROPPED"}, + {12, "INVITE_RECEIVED"}, + {13, "J_SKIP"}, + {14, "P_SKIP"}, + {15, "F_SKIP"}, + {16, "S_SKIP"}, + {17, "MISSION_TIMER_SKIP"}, + {18, "TIME_SKIP"}, + {19, "WEATHER"}, + {20, "INVULNERABLE"}, + {21, "VULNERABLE"}, + {22, "WEAPONS"}, + {23, "CHEAT_XP_PLUS"}, + {24, "CHEAT_XP_MINUS"}, + {25, "CHEAT_MONEY"}, + {26, "CHEAT_HONOR_PLUS"}, + {27, "CHEAT_HONOR_MINUS"}, + {28, "CHEAT_WARP"}, + {29, "CHEAT_DEADEYE"}, + {30, "CHEAT_INFINITE_DEADEYE"}, + {31, "CHEAT_INFINITE_STAMINA"}, + {32, "CHEAT_REFILL_RPG_CORES"}, + {33, "CHEAT_REFILL_RPG_TANKS"}, + {34, "CHEAT_OVERPOWER_RPG_CORES"}, + {35, "CHEAT_DISABLE_INFINITE_STAMINA"}, + {36, "CHEAT_DISABLE_INFINITE_DEADEYE"}, + {37, "CHEAT_DEADEYE_REMOVE_ALL"}, + {38, "CHEAT_HEALTH"}, + {39, "CHEAT_VEHICLE"}, + {44, "NET_UNLOCK"}, + {45, "PERSONA_LEVEL_UP"}, + {46, "GANG_INVITE"}, + {47, "GANG_REQUEST"}, + {48, "GANG_JOINED"}, + {50, "GANG_KICKED"}, + {51, "GANG_LEFT"}, + {52, "GANG_STARTED"}, + {53, "GANG_CAMP_PLACED"}, + {54, "GANG_CAMP_FAIL"}, + {55, "GANG_CAMP_READY"}, + {56, "GANG_CAMP_ATTEMPT"}, + {57, "GANG_CAMP_SEARCH"}, + {58, "GANG_CAMP_SHUTDOWN"}, + {60, "GANG_ON_MISSION"}, + {61, "P_POSSE_START"}, + {62, "P_POSSE_FAIL"}, + {63, "P_POSSE_JOIN"}, + {64, "P_POSSE_LEAVE"}, + {65, "P_POSSE_PROMOTED"}, + {66, "P_POSSE_DEMOTED"}, + {68, "STORY_MISSION_INVITE_RECEIVED"}, + {71, "NET_GANG_BOUNTY_TURNIN"}, + {72, "VS_MISSION_INVITE"}, + {73, "VS_MISSION_FAILED_TO_JOIN"}, + {74, "VS_MISSION_REQUEST_TO_LEADER"}, + {75, "VS_MISSION_FORCE_JOIN"}, + {76, "VS_MISSION_FORCE_LEAVE_FULL"}, + {77, "VS_MISSION_FORCE_REMOVE_INVITE"}, + {78, "IN_WORLD_DEATHMATCH_1V1"}, + {79, "IN_WORLD_DEATHMATCH_POSSE_V_POSSE"}, + {80, "IN_WORLD_DEATHMATCH_POSSE_LEADER_FEUD"}, + {81, "IN_WORLD_DEATHMATCH_POSSE_FEUD"}, + {82, "IN_WORLD_DEATHMATCH_POSSE_INFIGHTING"}, + {83, "IN_WORLD_DEATHMATCH_POSSE_FEUD_MEMBERS"}, + {84, "IN_WORLD_DEATHMATCH_POSSE_LEADER_FEUD_MEMBERS"}, + {92, "HUNTSMEN_PRISTINE_SKIN_FOUND"}, + {93, "CONVOY_ROBBERY_TURN_IN"}, + {94, "PLAYER_FORCE_DEBUG_WARP"}, + {95, "ANIMAL_ATTACK_REWARD"}, + {96, "MINIGAME_INVITE"}, + {101, "SHOP_SPLIT_MONEY_WITH_POSSE"}, + {102, "PASSIVE_MODE_ENDED"}, + {103, "PRESSED_CHARGES"}, + {108, "PLAYER_BOUNTY_PVP_MISSION_FAILED_TO_LAUNCH"}, + {109, "PLAYER_FLAVORED_MOONSHINE"}, + {110, "PLAYER_KILLED_LEGENDARY_ANIMAL"}, + {111, "PLAYER_TRANQUILIZED_LEGENDARY_ANIMAL"}, + {112, "ABANDONED_LOOT_OPENED"} + }; +} \ No newline at end of file From fe24230837f6bc5d411ef0fc0baac3df14bc5282 Mon Sep 17 00:00:00 2001 From: tyackman Date: Wed, 17 Jul 2024 02:29:55 -0500 Subject: [PATCH 07/15] Add missing command to menu --- src/game/frontend/submenus/Self.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/game/frontend/submenus/Self.cpp b/src/game/frontend/submenus/Self.cpp index ce7c0fd6..54c8c9e0 100644 --- a/src/game/frontend/submenus/Self.cpp +++ b/src/game/frontend/submenus/Self.cpp @@ -186,6 +186,7 @@ namespace YimMenu::Submenus auto horseGlobalsGroup = std::make_shared("Globals"); horseGlobalsGroup->AddItem(std::make_shared("horsegodmode"_J)); horseGlobalsGroup->AddItem(std::make_shared("horsenoragdoll"_J)); + horseGlobalsGroup->AddItem(std::make_shared("horsesuperrun"_J)); horseGlobalsGroup->AddItem(std::make_shared("keephorseclean"_J)); horseGlobalsGroup->AddItem(std::make_shared("horseclimbsteepslopes"_J)); horseGlobalsGroup->AddItem(std::make_shared("keephorsebarsfilled"_J)); From 22cca49244c7c871618bf4771d21e0805bcb4432 Mon Sep 17 00:00:00 2001 From: tyackman <38179522+tyackman@users.noreply.github.com> Date: Wed, 17 Jul 2024 02:32:33 -0500 Subject: [PATCH 08/15] Fix horrid indention (thank you github) --- src/game/rdr/Enums.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/rdr/Enums.hpp b/src/game/rdr/Enums.hpp index c427a8de..e9bb719b 100644 --- a/src/game/rdr/Enums.hpp +++ b/src/game/rdr/Enums.hpp @@ -1382,13 +1382,13 @@ enum class LassoFlags enum class ScriptEvent { SCRIPT_EVENT_TICKER_MESSAGE = 0, - SCRIPT_EVENT_AMBIENT_CONTENT_EVALUATOR = 4, - SCRIPT_EVENT_ACE_LAUNCHER = 5, + SCRIPT_EVENT_AMBIENT_CONTENT_EVALUATOR = 4, + SCRIPT_EVENT_ACE_LAUNCHER = 5, SCRIPT_EVENT_PARLAY = 28, SCRIPT_EVENT_NOTORIETY_PRESS_CHARGES = 35, SCRIPT_EVENT_NOTORIETY_FORCE_PASSIVE = 36, SCRIPT_EVENT_NOTORIETY_FORCE_NOT_PASSIVE_HORSE = 37, - SCRIPT_EVENT_FETCH_MANAGER = 178, + SCRIPT_EVENT_FETCH_MANAGER = 178, SCRIPT_EVENT_NET_HUD = 186, SCRIPT_EVENT_PERSONA_HONOR = 188, SCRIPT_EVENT_PLAYER_CAMP = 201 @@ -2340,4 +2340,4 @@ enum class EntityProofs : uint32_t STEAM = 1 << 5, SMOKE = 1 << 6, HEADSHOT = 1 << 7 -}; \ No newline at end of file +}; From eda02409ec6bc71f2b87cf0492f00a31b4061b51 Mon Sep 17 00:00:00 2001 From: tyackman Date: Wed, 17 Jul 2024 17:10:58 -0500 Subject: [PATCH 09/15] Added some more stuff --- src/core/misc/RateLimiter.hpp | 6 +- src/game/backend/PlayerData.hpp | 2 - .../players/toxic/SendStableEvent.cpp | 39 +++++++ .../features/players/toxic/SendTicker.cpp | 2 +- src/game/frontend/submenus/Players.cpp | 22 ++-- .../Protections/HandleScriptedGameEvent.cpp | 33 ++++++ src/game/rdr/Enums.hpp | 8 +- src/game/rdr/data/StableEvents.hpp | 34 ++++++ src/game/rdr/data/TickerEvents.hpp | 106 ++++-------------- 9 files changed, 148 insertions(+), 104 deletions(-) create mode 100644 src/game/features/players/toxic/SendStableEvent.cpp create mode 100644 src/game/rdr/data/StableEvents.hpp diff --git a/src/core/misc/RateLimiter.hpp b/src/core/misc/RateLimiter.hpp index 9f8ff027..bcdcdbbc 100644 --- a/src/core/misc/RateLimiter.hpp +++ b/src/core/misc/RateLimiter.hpp @@ -11,9 +11,9 @@ namespace YimMenu uint32_t m_NumAttemptsAllowed = 0; public: - RateLimiter(std::chrono::milliseconds time_period, uint32_t num_allowed_attempts) : - m_AttemptsAllowedInTimePeriod(num_allowed_attempts), - m_TimePeriod(time_period) + RateLimiter(std::chrono::milliseconds period, uint32_t numAllowedAttempts) : + m_AttemptsAllowedInTimePeriod(numAllowedAttempts), + m_TimePeriod(period) { } diff --git a/src/game/backend/PlayerData.hpp b/src/game/backend/PlayerData.hpp index a4c27c75..9c7f8196 100644 --- a/src/game/backend/PlayerData.hpp +++ b/src/game/backend/PlayerData.hpp @@ -1,5 +1,4 @@ #pragma once -#include "core/misc/RateLimiter.hpp" namespace YimMenu { @@ -7,6 +6,5 @@ namespace YimMenu { public: bool m_UseSessionSplitKick{}; - RateLimiter m_TickerMessageRateLimit{5s, 3}; }; } \ No newline at end of file diff --git a/src/game/features/players/toxic/SendStableEvent.cpp b/src/game/features/players/toxic/SendStableEvent.cpp new file mode 100644 index 00000000..f294a198 --- /dev/null +++ b/src/game/features/players/toxic/SendStableEvent.cpp @@ -0,0 +1,39 @@ +#include "core/commands/BoolCommand.hpp" +#include "core/commands/ListCommand.hpp" +#include "game/backend/Players.hpp" +#include "game/backend/Self.hpp" +#include "game/commands/PlayerCommand.hpp" +#include "game/rdr/Enums.hpp" +#include "game/rdr/Natives.hpp" +#include "game/rdr/Scripts.hpp" +#include "game/rdr/data/StableEvents.hpp" + +namespace YimMenu::Features +{ + static ListCommand _MountInstance{"mountinstance", "Mount Instance", "Which type of vehicle/mount to target", Data::g_MountInstance, 0}; + static ListCommand _StableMountEvent{"stablemountevent", "Stable Mount Event", "The event to send", Data::g_StableMountEvent, 0}; + + void SendNetStableMountEvent(Player player) + { + uint64_t data[6]{}; + data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_NET_STABLE_MOUNT); + data[1] = player.GetId(); + data[2] = NETWORK::GET_NETWORK_TIME_ACCURATE(); + data[4] = _StableMountEvent.GetState(); + data[5] = _MountInstance.GetState(); + + Scripts::SendScriptEvent(data, 6, 0, 1 << player.GetId()); + } + + class SendStableMountEvent : public PlayerCommand + { + using PlayerCommand::PlayerCommand; + + virtual void OnCall(Player player) override + { + SendNetStableMountEvent(player); + } + }; + + static SendStableMountEvent _SendStableMountEvent{"sendstablemountevent", "Send Stable Mount Event", "Not known yet", 0, false}; +} \ No newline at end of file diff --git a/src/game/features/players/toxic/SendTicker.cpp b/src/game/features/players/toxic/SendTicker.cpp index d6beb1fe..879b087d 100644 --- a/src/game/features/players/toxic/SendTicker.cpp +++ b/src/game/features/players/toxic/SendTicker.cpp @@ -10,7 +10,7 @@ namespace YimMenu::Features { - static ListCommand _TickerMessage{"tickermessage", "Ticker Message", "The ticker message to send", Data::g_TickerEvents, 0}; + static ListCommand _TickerMessage{"tickermessage", "Ticker Message", "The ticker message to send", Data::g_TickerEvents, 2}; void SendTickerMessage(Player player) { diff --git a/src/game/frontend/submenus/Players.cpp b/src/game/frontend/submenus/Players.cpp index e3bf8e27..a991aa69 100644 --- a/src/game/frontend/submenus/Players.cpp +++ b/src/game/frontend/submenus/Players.cpp @@ -277,24 +277,30 @@ namespace YimMenu::Submenus drawPlayerList(true); })); - auto general = std::make_shared("General"); + auto general = std::make_shared("General"); general->AddItem(std::make_shared("kill"_J)); general->AddItem(std::make_shared("explode"_J)); general->AddItem(std::make_shared("lightning"_J)); general->AddItem(std::make_shared("defensive"_J)); general->AddItem(std::make_shared("offensive"_J)); - general->AddItem(std::make_shared("maxhonor"_J)); - general->AddItem(std::make_shared("minhonor"_J)); - general->AddItem(std::make_shared("startparlay"_J)); - general->AddItem(std::make_shared("endparlay"_J)); - general->AddItem(std::make_shared("increasebounty"_J)); - general->AddItem(std::make_shared("sendticker"_J)); - general->AddItem(std::make_shared("tickermessage"_J, "Message")); + + auto events = std::make_shared("Events"); + events->AddItem(std::make_shared("maxhonor"_J)); + events->AddItem(std::make_shared("minhonor"_J)); + events->AddItem(std::make_shared("startparlay"_J)); + events->AddItem(std::make_shared("endparlay"_J)); + events->AddItem(std::make_shared("increasebounty"_J)); + events->AddItem(std::make_shared("sendticker"_J)); + events->AddItem(std::make_shared("tickermessage"_J, "Message")); + events->AddItem(std::make_shared("sendstablemountevent"_J)); + events->AddItem(std::make_shared("mountinstance"_J, "Instance")); + events->AddItem(std::make_shared("stablemountevent"_J, "Event")); auto mount = std::make_shared("Mount"); mount->AddItem(std::make_shared("kickhorse"_J)); toxic->AddItem(general); + toxic->AddItem(events); toxic->AddItem(mount); AddCategory(std::move(toxic)); diff --git a/src/game/hooks/Protections/HandleScriptedGameEvent.cpp b/src/game/hooks/Protections/HandleScriptedGameEvent.cpp index dcfb3bb1..57593a42 100644 --- a/src/game/hooks/Protections/HandleScriptedGameEvent.cpp +++ b/src/game/hooks/Protections/HandleScriptedGameEvent.cpp @@ -5,7 +5,9 @@ #include "game/backend/Protections.hpp" #include "game/hooks/Hooks.hpp" #include "game/rdr/data/TickerEvents.hpp" +#include "game/rdr/data/StableEvents.hpp" #include "game/backend/Players.hpp" +#include "core/misc/RateLimiter.hpp" #include #include @@ -17,6 +19,8 @@ namespace YimMenu::Features namespace YimMenu::Hooks { + RateLimiter m_TickerMessageRateLimit{5s, 3}; + bool Protections::HandleScriptedGameEvent(CScriptedGameEvent* event, CNetGamePlayer* src, CNetGamePlayer* dst) { if (Features::_LogScriptEvents.GetState()) @@ -84,6 +88,35 @@ namespace YimMenu::Hooks } break; } + case ScriptEvent::SCRIPT_EVENT_TICKER_MESSAGE: + { + if (m_TickerMessageRateLimit.Process()) + { + if (m_TickerMessageRateLimit.ExceededLastProcess()) + { + Notifications::Show("Protections", + std::format("Blocked ticker spam from {} ({})", + src->GetName(), + Data::g_TickerEvents[event->m_Data[4]].second), + NotificationType::Warning); + } + return true; + } + break; + } + case ScriptEvent::SCRIPT_EVENT_NET_STABLE_MOUNT: + { + if (event->m_Data[0]) + { + Notifications::Show("Protections", + std::format("Blocked stable event from {} ({})", + src->GetName(), + Data::g_StableMountEvent[event->m_Data[4]].second), + NotificationType::Warning); + return true; + } + break; + } } return BaseHook::Get>() diff --git a/src/game/rdr/Enums.hpp b/src/game/rdr/Enums.hpp index c427a8de..55dfabc5 100644 --- a/src/game/rdr/Enums.hpp +++ b/src/game/rdr/Enums.hpp @@ -1382,13 +1382,15 @@ enum class LassoFlags enum class ScriptEvent { SCRIPT_EVENT_TICKER_MESSAGE = 0, - SCRIPT_EVENT_AMBIENT_CONTENT_EVALUATOR = 4, - SCRIPT_EVENT_ACE_LAUNCHER = 5, + SCRIPT_EVENT_AMBIENT_CONTENT_EVALUATOR = 4, + SCRIPT_EVENT_ACE_LAUNCHER = 5, SCRIPT_EVENT_PARLAY = 28, SCRIPT_EVENT_NOTORIETY_PRESS_CHARGES = 35, SCRIPT_EVENT_NOTORIETY_FORCE_PASSIVE = 36, SCRIPT_EVENT_NOTORIETY_FORCE_NOT_PASSIVE_HORSE = 37, - SCRIPT_EVENT_FETCH_MANAGER = 178, + SCRIPT_EVENT_NET_STABLE = 46, + SCRIPT_EVENT_NET_STABLE_MOUNT = 47, + SCRIPT_EVENT_FETCH_MANAGER = 178, SCRIPT_EVENT_NET_HUD = 186, SCRIPT_EVENT_PERSONA_HONOR = 188, SCRIPT_EVENT_PLAYER_CAMP = 201 diff --git a/src/game/rdr/data/StableEvents.hpp b/src/game/rdr/data/StableEvents.hpp new file mode 100644 index 00000000..77488b3c --- /dev/null +++ b/src/game/rdr/data/StableEvents.hpp @@ -0,0 +1,34 @@ +#pragma once + +namespace YimMenu::Data +{ + static std::vector> g_MountInstance = { + {0, "Inactive Horses"}, + {1, "Inactive Vehicles"}, + {2, "Active Horse"}, + {3, "Active Vehicle"}, + {4, "All Horses"}, + {5, "All Vehicles"}, + {6, "All Mounts"}, + }; + + static std::vector> g_StableMountEvent = { + {0, "Release Mount"}, + {1, "Delete Mount"}, + {2, "Delete Local Mount"}, + {3, "Release Local Mount"}, + {4, "Set Mission Critical"}, + {5, "Clear Mission Critical"}, + {6, "Summon Vehicle"}, + {7, "Horse Command Backoff"}, + {8, "Horse Command Stay Wait"}, + {9, "Horse Buck Rider"}, + {10, "Horse Buck Any Rider"}, + {11, "Horse Dismount Passenger"}, + {12, "Vehicle Buck Rider"}, + {13, "Vehicle Buck Any Rider"}, + {14, "Vehicle Dismount Passenger"}, + {15, "Vehicle Clear Task"}, + {16, "Vehicle Dismiss"}, + }; +} \ No newline at end of file diff --git a/src/game/rdr/data/TickerEvents.hpp b/src/game/rdr/data/TickerEvents.hpp index 5fad58f8..5c339931 100644 --- a/src/game/rdr/data/TickerEvents.hpp +++ b/src/game/rdr/data/TickerEvents.hpp @@ -4,92 +4,24 @@ namespace YimMenu::Data { static std::vector> g_TickerEvents = { - {0, "JOINED_DEFAULT"}, - {2, "VERSUS_NORMAL"}, - {3, "VERSUS_TEAMKILL"}, - {4, "VERSUS_SUICIDE"}, - {6, "VERSUS_INCAPACITATED"}, - {7, "VERSUS_INCAPACITATED_EXECUTION"}, - {8, "INCAPACITATION_REVIVE"}, - {9, "INCAPACITATION_SELF_REVIVE"}, - {10, "MONEYBAG_PICKUP"}, - {11, "MONEYBAG_DROPPED"}, - {12, "INVITE_RECEIVED"}, - {13, "J_SKIP"}, - {14, "P_SKIP"}, - {15, "F_SKIP"}, - {16, "S_SKIP"}, - {17, "MISSION_TIMER_SKIP"}, - {18, "TIME_SKIP"}, - {19, "WEATHER"}, - {20, "INVULNERABLE"}, - {21, "VULNERABLE"}, - {22, "WEAPONS"}, - {23, "CHEAT_XP_PLUS"}, - {24, "CHEAT_XP_MINUS"}, - {25, "CHEAT_MONEY"}, - {26, "CHEAT_HONOR_PLUS"}, - {27, "CHEAT_HONOR_MINUS"}, - {28, "CHEAT_WARP"}, - {29, "CHEAT_DEADEYE"}, - {30, "CHEAT_INFINITE_DEADEYE"}, - {31, "CHEAT_INFINITE_STAMINA"}, - {32, "CHEAT_REFILL_RPG_CORES"}, - {33, "CHEAT_REFILL_RPG_TANKS"}, - {34, "CHEAT_OVERPOWER_RPG_CORES"}, - {35, "CHEAT_DISABLE_INFINITE_STAMINA"}, - {36, "CHEAT_DISABLE_INFINITE_DEADEYE"}, - {37, "CHEAT_DEADEYE_REMOVE_ALL"}, - {38, "CHEAT_HEALTH"}, - {39, "CHEAT_VEHICLE"}, - {44, "NET_UNLOCK"}, - {45, "PERSONA_LEVEL_UP"}, - {46, "GANG_INVITE"}, - {47, "GANG_REQUEST"}, - {48, "GANG_JOINED"}, - {50, "GANG_KICKED"}, - {51, "GANG_LEFT"}, - {52, "GANG_STARTED"}, - {53, "GANG_CAMP_PLACED"}, - {54, "GANG_CAMP_FAIL"}, - {55, "GANG_CAMP_READY"}, - {56, "GANG_CAMP_ATTEMPT"}, - {57, "GANG_CAMP_SEARCH"}, - {58, "GANG_CAMP_SHUTDOWN"}, - {60, "GANG_ON_MISSION"}, - {61, "P_POSSE_START"}, - {62, "P_POSSE_FAIL"}, - {63, "P_POSSE_JOIN"}, - {64, "P_POSSE_LEAVE"}, - {65, "P_POSSE_PROMOTED"}, - {66, "P_POSSE_DEMOTED"}, - {68, "STORY_MISSION_INVITE_RECEIVED"}, - {71, "NET_GANG_BOUNTY_TURNIN"}, - {72, "VS_MISSION_INVITE"}, - {73, "VS_MISSION_FAILED_TO_JOIN"}, - {74, "VS_MISSION_REQUEST_TO_LEADER"}, - {75, "VS_MISSION_FORCE_JOIN"}, - {76, "VS_MISSION_FORCE_LEAVE_FULL"}, - {77, "VS_MISSION_FORCE_REMOVE_INVITE"}, - {78, "IN_WORLD_DEATHMATCH_1V1"}, - {79, "IN_WORLD_DEATHMATCH_POSSE_V_POSSE"}, - {80, "IN_WORLD_DEATHMATCH_POSSE_LEADER_FEUD"}, - {81, "IN_WORLD_DEATHMATCH_POSSE_FEUD"}, - {82, "IN_WORLD_DEATHMATCH_POSSE_INFIGHTING"}, - {83, "IN_WORLD_DEATHMATCH_POSSE_FEUD_MEMBERS"}, - {84, "IN_WORLD_DEATHMATCH_POSSE_LEADER_FEUD_MEMBERS"}, - {92, "HUNTSMEN_PRISTINE_SKIN_FOUND"}, - {93, "CONVOY_ROBBERY_TURN_IN"}, - {94, "PLAYER_FORCE_DEBUG_WARP"}, - {95, "ANIMAL_ATTACK_REWARD"}, - {96, "MINIGAME_INVITE"}, - {101, "SHOP_SPLIT_MONEY_WITH_POSSE"}, - {102, "PASSIVE_MODE_ENDED"}, - {103, "PRESSED_CHARGES"}, - {108, "PLAYER_BOUNTY_PVP_MISSION_FAILED_TO_LAUNCH"}, - {109, "PLAYER_FLAVORED_MOONSHINE"}, - {110, "PLAYER_KILLED_LEGENDARY_ANIMAL"}, - {111, "PLAYER_TRANQUILIZED_LEGENDARY_ANIMAL"}, - {112, "ABANDONED_LOOT_OPENED"} + {2, "Versus (Normal)"}, + {3, "Versus (Teamkill)"}, + {6, "Versus (Incapacitated)"}, + {7, "Versus (Incapacitated Execution)"}, + {52, "Gang Started"}, + {72, "Versus Mission Start"}, + {73, "Mission Failed To Join"}, + {74, "Mission Request"}, + {75, "Mission Force Join"}, + {76, "Mission Force Leave"}, + {78, "Deathmatch 1V1"}, + {80, "Deathmatch Posse Leader Feud"}, + {81, "Deathmatch Posse Feud"}, + {82, "Deathmatch Posse Fighting"}, + {101, "Split Money With Posse"}, + {102, "Passive Mode Ended"}, + {103, "Pressed Charges"}, + {108, "Bounty Mission Failed To Launch"}, + {109, "Player Has Flavored Moonshine"}, }; } \ No newline at end of file From 0d67e92961748558159bf64b75a1ea791f8864c7 Mon Sep 17 00:00:00 2001 From: tyackman <38179522+tyackman@users.noreply.github.com> Date: Wed, 17 Jul 2024 17:18:06 -0500 Subject: [PATCH 10/15] Removed double include --- src/game/hooks/Protections/HandleScriptedGameEvent.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/game/hooks/Protections/HandleScriptedGameEvent.cpp b/src/game/hooks/Protections/HandleScriptedGameEvent.cpp index 57593a42..dfd1bbef 100644 --- a/src/game/hooks/Protections/HandleScriptedGameEvent.cpp +++ b/src/game/hooks/Protections/HandleScriptedGameEvent.cpp @@ -7,7 +7,6 @@ #include "game/rdr/data/TickerEvents.hpp" #include "game/rdr/data/StableEvents.hpp" #include "game/backend/Players.hpp" -#include "core/misc/RateLimiter.hpp" #include #include @@ -122,4 +121,4 @@ namespace YimMenu::Hooks return BaseHook::Get>() ->Original()(event, src, dst); } -} \ No newline at end of file +} From 35a5632bfd3b18919b464f44577e7a72d47a50d8 Mon Sep 17 00:00:00 2001 From: tyackman <38179522+tyackman@users.noreply.github.com> Date: Wed, 17 Jul 2024 17:18:57 -0500 Subject: [PATCH 11/15] Fix indent --- src/game/features/players/toxic/SendStableEvent.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/features/players/toxic/SendStableEvent.cpp b/src/game/features/players/toxic/SendStableEvent.cpp index f294a198..575033ef 100644 --- a/src/game/features/players/toxic/SendStableEvent.cpp +++ b/src/game/features/players/toxic/SendStableEvent.cpp @@ -20,7 +20,7 @@ namespace YimMenu::Features data[1] = player.GetId(); data[2] = NETWORK::GET_NETWORK_TIME_ACCURATE(); data[4] = _StableMountEvent.GetState(); - data[5] = _MountInstance.GetState(); + data[5] = _MountInstance.GetState(); Scripts::SendScriptEvent(data, 6, 0, 1 << player.GetId()); } @@ -36,4 +36,4 @@ namespace YimMenu::Features }; static SendStableMountEvent _SendStableMountEvent{"sendstablemountevent", "Send Stable Mount Event", "Not known yet", 0, false}; -} \ No newline at end of file +} From cdbfdc741a2959c7751958a030d3c6c2e68e0cd2 Mon Sep 17 00:00:00 2001 From: tyackman Date: Wed, 17 Jul 2024 23:48:57 -0500 Subject: [PATCH 12/15] Untested pool overflow protection --- src/core/hooking/Hooking.cpp | 1 + src/game/frontend/submenus/Self.cpp | 7 ------- src/game/hooks/Hooks.hpp | 5 +++-- src/game/hooks/Protections/CreatePoolItem.cpp | 18 ++++++++++++++++++ src/game/pointers/Pointers.cpp | 5 +++++ src/game/pointers/Pointers.hpp | 1 + src/game/rdr/Enums.hpp | 2 +- src/game/rdr/Pools.hpp | 5 +++++ 8 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 src/game/hooks/Protections/CreatePoolItem.cpp diff --git a/src/core/hooking/Hooking.cpp b/src/core/hooking/Hooking.cpp index 39e004ef..48466509 100644 --- a/src/core/hooking/Hooking.cpp +++ b/src/core/hooking/Hooking.cpp @@ -50,6 +50,7 @@ namespace YimMenu BaseHook::Add(new DetourHook("SerializeServerRPC", Pointers.SerializeServerRPC, Hooks::Protections::SerializeServerRPC)); BaseHook::Add(new DetourHook("ReceiveServerMessage", Pointers.ReceiveServerMessage, Hooks::Protections::ReceiveServerMessage)); BaseHook::Add(new DetourHook("ReceiveArrayUpdate", Pointers.ReceiveArrayUpdate, Hooks::Protections::ReceiveArrayUpdate)); + BaseHook::Add(new DetourHook("CreatePoolItem", Pointers.CreatePoolItem, Hooks::Protections::CreatePoolItem)); BaseHook::Add(new DetourHook("EnumerateAudioDevices", Pointers.EnumerateAudioDevices, Hooks::Voice::EnumerateAudioDevices)); BaseHook::Add(new DetourHook("DirectSoundCaptureCreate", Pointers.DirectSoundCaptureCreate, Hooks::Voice::DirectSoundCaptureCreate)); diff --git a/src/game/frontend/submenus/Self.cpp b/src/game/frontend/submenus/Self.cpp index 54c8c9e0..fb414afe 100644 --- a/src/game/frontend/submenus/Self.cpp +++ b/src/game/frontend/submenus/Self.cpp @@ -155,13 +155,6 @@ namespace YimMenu::Submenus toolsGroup->AddItem(std::make_shared("suicide"_J)); toolsGroup->AddItem(std::make_shared("clearcrimes"_J)); - toolsGroup->AddItem(std::make_shared([] { - if (ImGui::Button("Unfreeze")) - FiberPool::Push([] { - YimMenu::Self::GetPed().SetFrozen(false); - YimMenu::Self::GetPed().SetCollision(true); - }); - })); toolsGroup->AddItem(std::make_shared("npcignore"_J)); toolsGroup->AddItem(std::make_shared("eagleeye"_J)); diff --git a/src/game/hooks/Hooks.hpp b/src/game/hooks/Hooks.hpp index ba44710f..d946761b 100644 --- a/src/game/hooks/Hooks.hpp +++ b/src/game/hooks/Hooks.hpp @@ -1,11 +1,10 @@ #pragma once +#include "game/rdr/Pools.hpp" #include #include #include // has to be imported #include - - namespace rage { class rlMetric; @@ -22,6 +21,7 @@ namespace rage class scrProgram; class scrThreadContext; } + class CNetGamePlayer; enum class NetEventType; class CFoundDevice; @@ -87,6 +87,7 @@ namespace YimMenu::Hooks extern bool SerializeServerRPC(rage::ServerRPCSerializer* ser, void* a2, const char* message, void* def, void* structure, const char* rpc_guid, void* a7); extern bool ReceiveServerMessage(void* a1, rage::ServerMsg* a2); // doesn't receive all messages extern bool ReceiveArrayUpdate(void* array, CNetGamePlayer* sender, rage::datBitBuffer* buffer, int size, int16_t cycle); + extern void* CreatePoolItem(PoolUtils* pool); } namespace Voice diff --git a/src/game/hooks/Protections/CreatePoolItem.cpp b/src/game/hooks/Protections/CreatePoolItem.cpp new file mode 100644 index 00000000..2d6ee0e7 --- /dev/null +++ b/src/game/hooks/Protections/CreatePoolItem.cpp @@ -0,0 +1,18 @@ +#include "game/hooks/Hooks.hpp" +#include "core/hooking/DetourHook.hpp" + +namespace YimMenu::Hooks +{ + void* Protections::CreatePoolItem(PoolUtils* pool) + { + auto item = BaseHook::Get>()->Original()(pool); + + if (!item) + { + auto callerOffset = (__int64)_ReturnAddress() - (__int64)GetModuleHandleA(0); + LOGF(FATAL, "Pool full! Caller: RDR2.exe+0x{:X}, Size: {}", callerOffset, pool->size()); + } + + return item; + } +} \ No newline at end of file diff --git a/src/game/pointers/Pointers.cpp b/src/game/pointers/Pointers.cpp index 10c23038..f32cbfbe 100644 --- a/src/game/pointers/Pointers.cpp +++ b/src/game/pointers/Pointers.cpp @@ -387,6 +387,11 @@ namespace YimMenu ReceiveArrayUpdate = ptr.As(); }); + constexpr auto createPoolItemPtrn = Pattern<"E8 ? ? ? ? 48 85 C0 74 ? 44 8A 4C 24 ? 48 8B C8 44 0F B7 44 24 ? 0F B7 54 24">("CreatePoolItem"); + scanner.Add(createPoolItemPtrn, [this](PointerCalculator ptr) { + CreatePoolItem = ptr.Add(1).Rip().As(); + }); + if (!scanner.Scan()) { LOG(FATAL) << "Some patterns could not be found, unloading."; diff --git a/src/game/pointers/Pointers.hpp b/src/game/pointers/Pointers.hpp index 8fd7ce3f..4a216cc0 100644 --- a/src/game/pointers/Pointers.hpp +++ b/src/game/pointers/Pointers.hpp @@ -122,6 +122,7 @@ namespace YimMenu PVOID ReceiveServerMessage; PVOID SerializeServerRPC; PVOID ReceiveArrayUpdate; + PVOID CreatePoolItem; // Player Stuff PVOID PlayerHasJoined; diff --git a/src/game/rdr/Enums.hpp b/src/game/rdr/Enums.hpp index 5b461f2b..55dfabc5 100644 --- a/src/game/rdr/Enums.hpp +++ b/src/game/rdr/Enums.hpp @@ -2342,4 +2342,4 @@ enum class EntityProofs : uint32_t STEAM = 1 << 5, SMOKE = 1 << 6, HEADSHOT = 1 << 7 -}; +}; \ No newline at end of file diff --git a/src/game/rdr/Pools.hpp b/src/game/rdr/Pools.hpp index 0935e7da..a7b03e36 100644 --- a/src/game/rdr/Pools.hpp +++ b/src/game/rdr/Pools.hpp @@ -70,6 +70,11 @@ namespace YimMenu { return ++PoolIterator(m_Pool, m_Pool->m_Size); } + + auto size() + { + return m_Pool->m_Size; + } }; namespace Pools From 69f2bcc89cca4af1457820157ccdd2c61a99a3fd Mon Sep 17 00:00:00 2001 From: tyackman <38179522+tyackman@users.noreply.github.com> Date: Thu, 18 Jul 2024 00:01:28 -0500 Subject: [PATCH 13/15] fix githubs mistakes --- .../features/players/toxic/SendStableEvent.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/game/features/players/toxic/SendStableEvent.cpp b/src/game/features/players/toxic/SendStableEvent.cpp index 575033ef..e9d205cc 100644 --- a/src/game/features/players/toxic/SendStableEvent.cpp +++ b/src/game/features/players/toxic/SendStableEvent.cpp @@ -15,14 +15,14 @@ namespace YimMenu::Features void SendNetStableMountEvent(Player player) { - uint64_t data[6]{}; - data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_NET_STABLE_MOUNT); - data[1] = player.GetId(); - data[2] = NETWORK::GET_NETWORK_TIME_ACCURATE(); - data[4] = _StableMountEvent.GetState(); - data[5] = _MountInstance.GetState(); - - Scripts::SendScriptEvent(data, 6, 0, 1 << player.GetId()); + uint64_t data[6]{}; + data[0] = static_cast(ScriptEvent::SCRIPT_EVENT_NET_STABLE_MOUNT); + data[1] = player.GetId(); + data[2] = NETWORK::GET_NETWORK_TIME_ACCURATE(); + data[4] = _StableMountEvent.GetState(); + data[5] = _MountInstance.GetState(); + + Scripts::SendScriptEvent(data, 6, 0, 1 << player.GetId()); } class SendStableMountEvent : public PlayerCommand From bd6bfc9a261b292bd510faf623826ac2ce6d17ef Mon Sep 17 00:00:00 2001 From: tyackman Date: Thu, 18 Jul 2024 00:39:16 -0500 Subject: [PATCH 14/15] uh. fix ci? --- src/util/teleport.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/teleport.hpp b/src/util/teleport.hpp index 33476d77..75163e14 100644 --- a/src/util/teleport.hpp +++ b/src/util/teleport.hpp @@ -50,7 +50,7 @@ namespace YimMenu::Teleport return true; } - + // Entity typdef is being ambiguous with Entity class inline bool TeleportEntity(int ent, rage::fvector3 coords, bool loadGround = false) { From d561eee4f3aa05bf8fffadb73406ece9ad2c40e3 Mon Sep 17 00:00:00 2001 From: tyackman Date: Thu, 18 Jul 2024 01:29:18 -0500 Subject: [PATCH 15/15] fix ci --- cmake/async-logger.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/async-logger.cmake b/cmake/async-logger.cmake index b04224d4..647e3632 100644 --- a/cmake/async-logger.cmake +++ b/cmake/async-logger.cmake @@ -1,10 +1,12 @@ include(FetchContent) +add_compile_definitions(CXX_FORMAT_SUPPORT) + message(STATUS "Setting up AsyncLogger") FetchContent_Declare( AsyncLogger GIT_REPOSITORY https://github.com/Yimura/AsyncLogger.git - GIT_TAG v0.0.6 + GIT_TAG 6fcfd90b3f4ca4dae09c4a96e9a506e6aea06472 GIT_PROGRESS TRUE ) FetchContent_MakeAvailable(AsyncLogger)