From a2541b8ca2ae274c2245d3d77087c500242a2acb Mon Sep 17 00:00:00 2001 From: Jari van der Kaap Date: Wed, 17 May 2023 22:57:28 +0200 Subject: [PATCH] fix: fixed gun xp and gun xp progression not working when enable all purchases is enabled --- src/client/component/loot.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/client/component/loot.cpp b/src/client/component/loot.cpp index 39a54490..80a6dbd5 100644 --- a/src/client/component/loot.cpp +++ b/src/client/component/loot.cpp @@ -32,6 +32,7 @@ namespace loot utils::hook::detour bg_emblemisentitlementbackgroundgranted_hook; utils::hook::detour liveentitlements_isentitlementactiveforcontroller_hook; utils::hook::detour bg_unlockablesgetcustomclasscount_hook; + utils::hook::detour gscr_isitempurchasedforclientnum_hook; int loot_getitemquantity_stub(const game::ControllerIndex_t controller_index, const game::eModes mode, const int item_id) { @@ -178,12 +179,25 @@ namespace loot return bg_unlockablesgetcustomclasscount_hook.invoke(mode, controllerIndex); } + + bool gscr_isitempurchasedforclientnum_stub([[maybe_unused]] unsigned int clientNum, + [[maybe_unused]] int itemIndex) + { + return true; + } }; - struct component final: client_component + struct component final : generic_component { void post_unpack() override { + gscr_isitempurchasedforclientnum_hook.create(game::select(0x1415F1490, 0x140252A20), gscr_isitempurchasedforclientnum_stub); + + if (game::is_server()) + { + return; + } + dvar_cg_unlockall_loot = game::register_dvar_bool("cg_unlockall_loot", false, game::DVAR_ARCHIVE, "Unlocks blackmarket loot"); dvar_cg_unlockall_purchases = game::register_dvar_bool("cg_unlockall_purchases", false, game::DVAR_ARCHIVE, "Unlock all purchases with tokens"); dvar_cg_unlockall_attachments = game::register_dvar_bool("cg_unlockall_attachments", false, game::DVAR_ARCHIVE, "Unlocks all attachments"); @@ -211,7 +225,7 @@ namespace loot { game::Dvar_SetFromStringByName("ui_enableAllHeroes", "1", true); } - }, scheduler::pipeline::dvars_loaded); + }, scheduler::pipeline::dvars_loaded); } }; };