From 4437a8d10eb36d91f9081dca5c830bb1da893e4a Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 17 Mar 2023 19:10:24 -0400 Subject: [PATCH] Unlock secret entitlement calling cards. --- src/client/component/loot.cpp | 27 +++++++++++++++++++++++++++ src/client/game/structs.hpp | 4 +++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/client/component/loot.cpp b/src/client/component/loot.cpp index ea9fc0b9..b0f6c519 100644 --- a/src/client/component/loot.cpp +++ b/src/client/component/loot.cpp @@ -28,6 +28,8 @@ namespace loot utils::hook::detour bg_unlockablesitemoptionlocked_hook; utils::hook::detour bg_unlockedgetchallengeunlockedforindex_hook; utils::hook::detour bg_unlockablescharactercustomizationitemlocked_hook; + utils::hook::detour bg_emblemisentitlementbackgroundgranted_hook; + utils::hook::detour liveentitlements_isentitlementactiveforcontroller_hook; int loot_getitemquantity_stub(const game::ControllerIndex_t controller_index, const game::eModes mode, const int item_id) { @@ -135,6 +137,29 @@ namespace loot return bg_unlockablescharactercustomizationitemlocked_hook.invoke(mode, controllerIndex, characterIndex, itemType, itemIndex); } + + bool bg_emblemisentitlementbackgroundgranted_stub(const game::ControllerIndex_t controllerIndex, game::BGEmblemBackgroundID backgroundId) + { + // backgroundId's for blank CWL calling cards + if (dvar_cg_unlockall_calling_cards->current.value.enabled && (backgroundId != 684 && backgroundId != 685 && backgroundId != 687 && backgroundId != 693 && + backgroundId != 695 && backgroundId != 701 && backgroundId != 703 && backgroundId != 707 && backgroundId != 708)) + { + return true; + } + + return bg_emblemisentitlementbackgroundgranted_hook.invoke(controllerIndex, backgroundId); + } + + bool liveentitlements_isentitlementactiveforcontroller_stub(const game::ControllerIndex_t controllerIndex, int incentiveId) + { + // incentiveId for unavailable incentive + if (dvar_cg_unlockall_calling_cards->current.value.enabled && incentiveId != 29) + { + return true; + } + + return liveentitlements_isentitlementactiveforcontroller_hook.invoke(controllerIndex, incentiveId); + } }; struct component final : client_component @@ -158,6 +183,8 @@ namespace loot bg_unlockablesemblemorbackinglockedbychallenge_hook.create(0x1426A3AE0_g, bg_unlockablesemblemorbackinglockedbychallenge_stub); bg_unlockedgetchallengeunlockedforindex_hook.create(0x1426AF5F0_g, bg_unlockedgetchallengeunlockedforindex_stub); bg_unlockablescharactercustomizationitemlocked_hook.create(0x1426A2030_g, bg_unlockablescharactercustomizationitemlocked_stub); + bg_emblemisentitlementbackgroundgranted_hook.create(0x142667520_g, bg_emblemisentitlementbackgroundgranted_stub); + liveentitlements_isentitlementactiveforcontroller_hook.create(0x141E124E0_g, liveentitlements_isentitlementactiveforcontroller_stub); scheduler::once([]() { if (dvar_cg_unlockall_loot->current.value.enabled) diff --git a/src/client/game/structs.hpp b/src/client/game/structs.hpp index bef2872a..cd60213e 100644 --- a/src/client/game/structs.hpp +++ b/src/client/game/structs.hpp @@ -1681,13 +1681,15 @@ namespace game unsigned char itemIndex; }; - enum CharacterItemType : __int32 + enum CharacterItemType { CHARACTER_ITEM_TYPE_BODY = 0x0, CHARACTER_ITEM_TYPE_HELMET = 0x1, CHARACTER_ITEM_TYPE_COUNT = 0x2, }; + typedef __int16 BGEmblemBackgroundID; + union XAssetHeader { /*PhysPreset* physPreset;