cg_unlockall_cac_slots dvar

This commit is contained in:
WantedDV 2023-04-16 18:33:31 -02:30
parent 3e5a445f74
commit af76836254

View File

@ -17,6 +17,7 @@ namespace loot
const game::dvar_t* dvar_cg_unlockall_camos_and_reticles; const game::dvar_t* dvar_cg_unlockall_camos_and_reticles;
const game::dvar_t* dvar_cg_unlockall_calling_cards; const game::dvar_t* dvar_cg_unlockall_calling_cards;
const game::dvar_t* dvar_cg_unlockall_specialists_outfits; const game::dvar_t* dvar_cg_unlockall_specialists_outfits;
const game::dvar_t* dvar_cg_unlockall_cac_slots;
utils::hook::detour loot_getitemquantity_hook; utils::hook::detour loot_getitemquantity_hook;
utils::hook::detour liveinventory_getitemquantity_hook; utils::hook::detour liveinventory_getitemquantity_hook;
@ -30,6 +31,7 @@ namespace loot
utils::hook::detour bg_unlockablescharactercustomizationitemlocked_hook; utils::hook::detour bg_unlockablescharactercustomizationitemlocked_hook;
utils::hook::detour bg_emblemisentitlementbackgroundgranted_hook; utils::hook::detour bg_emblemisentitlementbackgroundgranted_hook;
utils::hook::detour liveentitlements_isentitlementactiveforcontroller_hook; utils::hook::detour liveentitlements_isentitlementactiveforcontroller_hook;
utils::hook::detour bg_unlockablesgetcustomclasscount_hook;
int loot_getitemquantity_stub(const game::ControllerIndex_t controller_index, const game::eModes mode, const int item_id) int loot_getitemquantity_stub(const game::ControllerIndex_t controller_index, const game::eModes mode, const int item_id)
{ {
@ -60,7 +62,7 @@ namespace loot
bool liveinventory_areextraslotspurchased_stub(const game::ControllerIndex_t controller_index) bool liveinventory_areextraslotspurchased_stub(const game::ControllerIndex_t controller_index)
{ {
if (dvar_cg_unlockall_loot->current.value.enabled) if (dvar_cg_unlockall_cac_slots->current.value.enabled)
{ {
return true; return true;
} }
@ -160,9 +162,19 @@ namespace loot
return liveentitlements_isentitlementactiveforcontroller_hook.invoke<bool>(controllerIndex, incentiveId); return liveentitlements_isentitlementactiveforcontroller_hook.invoke<bool>(controllerIndex, incentiveId);
} }
int bg_unlockablesgetcustomclasscount_stub(game::eModes mode, const game::ControllerIndex_t controllerIndex)
{
if (dvar_cg_unlockall_cac_slots->current.value.enabled)
{
return 10;
}
return bg_unlockablesgetcustomclasscount_hook.invoke<int>(mode, controllerIndex);
}
}; };
struct component final : client_component struct component final: client_component
{ {
void post_unpack() override void post_unpack() override
{ {
@ -172,6 +184,7 @@ namespace loot
dvar_cg_unlockall_camos_and_reticles = game::register_dvar_bool("cg_unlockall_camos_and_reticles", false, game::DVAR_ARCHIVE, "Unlocks all camos and reticles"); dvar_cg_unlockall_camos_and_reticles = game::register_dvar_bool("cg_unlockall_camos_and_reticles", false, game::DVAR_ARCHIVE, "Unlocks all camos and reticles");
dvar_cg_unlockall_calling_cards = game::register_dvar_bool("cg_unlockall_calling_cards", false, game::DVAR_ARCHIVE, "Unlocks all calling cards"); dvar_cg_unlockall_calling_cards = game::register_dvar_bool("cg_unlockall_calling_cards", false, game::DVAR_ARCHIVE, "Unlocks all calling cards");
dvar_cg_unlockall_specialists_outfits = game::register_dvar_bool("cg_unlockall_specialists_outfits", false, game::DVAR_ARCHIVE, "Unlocks all specialists outfits"); dvar_cg_unlockall_specialists_outfits = game::register_dvar_bool("cg_unlockall_specialists_outfits", false, game::DVAR_ARCHIVE, "Unlocks all specialists outfits");
dvar_cg_unlockall_cac_slots = game::register_dvar_bool("cg_unlockall_cac_slots", false, game::DVAR_ARCHIVE, "Unlocks all Create a Class Slots");
loot_getitemquantity_hook.create(0x141E82C00_g, loot_getitemquantity_stub); loot_getitemquantity_hook.create(0x141E82C00_g, loot_getitemquantity_stub);
liveinventory_getitemquantity_hook.create(0x141E09030_g, liveinventory_getitemquantity_stub); liveinventory_getitemquantity_hook.create(0x141E09030_g, liveinventory_getitemquantity_stub);
@ -185,6 +198,7 @@ namespace loot
bg_unlockablescharactercustomizationitemlocked_hook.create(0x1426A2030_g, bg_unlockablescharactercustomizationitemlocked_stub); bg_unlockablescharactercustomizationitemlocked_hook.create(0x1426A2030_g, bg_unlockablescharactercustomizationitemlocked_stub);
bg_emblemisentitlementbackgroundgranted_hook.create(0x142667520_g, bg_emblemisentitlementbackgroundgranted_stub); bg_emblemisentitlementbackgroundgranted_hook.create(0x142667520_g, bg_emblemisentitlementbackgroundgranted_stub);
liveentitlements_isentitlementactiveforcontroller_hook.create(0x141E124E0_g, liveentitlements_isentitlementactiveforcontroller_stub); liveentitlements_isentitlementactiveforcontroller_hook.create(0x141E124E0_g, liveentitlements_isentitlementactiveforcontroller_stub);
bg_unlockablesgetcustomclasscount_hook.create(0x1426A5900_g, bg_unlockablesgetcustomclasscount_stub);
scheduler::once([]() { scheduler::once([]() {
if (dvar_cg_unlockall_loot->current.value.enabled) if (dvar_cg_unlockall_loot->current.value.enabled)