From 87ba0f58afa1b44eb900e88fee96f4c057d40fc2 Mon Sep 17 00:00:00 2001 From: Jari van der Kaap Date: Mon, 28 Nov 2022 00:30:29 +0100 Subject: [PATCH 1/3] Enabled Blackjack & first test for enabling DLC weapons --- src/client/component/loot.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/client/component/loot.cpp diff --git a/src/client/component/loot.cpp b/src/client/component/loot.cpp new file mode 100644 index 00000000..d5636269 --- /dev/null +++ b/src/client/component/loot.cpp @@ -0,0 +1,34 @@ +#include +#include "loader/component_loader.hpp" + +#include +#include + +#include +#include "game/game.hpp" + +namespace loot +{ + namespace + { + void set_dvars_on_startup() + { + game::Dvar_SetFromStringByName("ui_enableAllHeroes", "1", true); + game::Dvar_SetFromStringByName("allItemsUnlocked", "1", true); + game::Dvar_SetFromStringByName("allItemsPurchased", "1", true); + game::Dvar_SetFromStringByName("ui_allLootUnlocked", "1", true); + } + }; + + class component final : public component_interface + { + public: + void post_unpack() override + { + scheduler::once(set_dvars_on_startup, scheduler::pipeline::main); + } + }; +}; + + +REGISTER_COMPONENT(loot::component) \ No newline at end of file From dd07fbddf7299e43b36786bdeb97db00ba352824 Mon Sep 17 00:00:00 2001 From: Jari van der Kaap Date: Mon, 28 Nov 2022 22:15:58 +0100 Subject: [PATCH 2/3] Fixed class not selectable when dlc weapon is included --- src/client/component/loot.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/client/component/loot.cpp b/src/client/component/loot.cpp index d5636269..c9d52a35 100644 --- a/src/client/component/loot.cpp +++ b/src/client/component/loot.cpp @@ -11,11 +11,16 @@ namespace loot { namespace { + utils::hook::detour loot_getitemquantity_hook; + + int loot_getitemquantity_stub(const game::ControllerIndex_t controllerIndex, const game::eModes mode, const int itemId) + { + return 1; + } + void set_dvars_on_startup() { game::Dvar_SetFromStringByName("ui_enableAllHeroes", "1", true); - game::Dvar_SetFromStringByName("allItemsUnlocked", "1", true); - game::Dvar_SetFromStringByName("allItemsPurchased", "1", true); game::Dvar_SetFromStringByName("ui_allLootUnlocked", "1", true); } }; @@ -26,6 +31,7 @@ namespace loot void post_unpack() override { scheduler::once(set_dvars_on_startup, scheduler::pipeline::main); + loot_getitemquantity_hook.create(0x141E82C90_g, loot_getitemquantity_stub); } }; }; From 9d6c209cf862eed79f75f3e7622e1dae738bded9 Mon Sep 17 00:00:00 2001 From: Jari van der Kaap Date: Tue, 29 Nov 2022 00:09:44 +0100 Subject: [PATCH 3/3] Added extra CaC slots, unlocked CWL camo's, paid specialist outfits and gobblegums --- src/client/component/loot.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/client/component/loot.cpp b/src/client/component/loot.cpp index c9d52a35..49cd010f 100644 --- a/src/client/component/loot.cpp +++ b/src/client/component/loot.cpp @@ -12,12 +12,32 @@ namespace loot namespace { utils::hook::detour loot_getitemquantity_hook; + utils::hook::detour liveinventory_getitemquantity_hook; + utils::hook::detour liveinventory_areextraslotspurchased_hook; int loot_getitemquantity_stub(const game::ControllerIndex_t controllerIndex, const game::eModes mode, const int itemId) { + if (mode == game::eModes::MODE_ZOMBIES) { + return 999; + } return 1; } + int liveinventory_getitemquantity_stub(const game::ControllerIndex_t controllerIndex, const int itemId) + { + // Item id's for extra CaC slots, CWL camo's and paid specialist outfits + if (itemId == 99003 || itemId >= 99018 && itemId <= 99021 || itemId == 99025 || itemId >= 90047 && itemId <= 90064) { + return 1; + } + + return liveinventory_getitemquantity_hook.invoke(controllerIndex, itemId); + } + + bool liveinventory_areextraslotspurchased_stub(const game::ControllerIndex_t controllerIndex) + { + return true; + } + void set_dvars_on_startup() { game::Dvar_SetFromStringByName("ui_enableAllHeroes", "1", true); @@ -32,6 +52,8 @@ namespace loot { scheduler::once(set_dvars_on_startup, scheduler::pipeline::main); loot_getitemquantity_hook.create(0x141E82C90_g, loot_getitemquantity_stub); + liveinventory_getitemquantity_hook.create(0x141E090C0_g, liveinventory_getitemquantity_stub); + liveinventory_areextraslotspurchased_hook.create(0x141E089E0_g, liveinventory_areextraslotspurchased_stub); } }; };