From 3e5a445f746f66ecb2a4729eec3cc0766523534e Mon Sep 17 00:00:00 2001 From: WantedDV <122710241+WantedDV@users.noreply.github.com> Date: Mon, 3 Apr 2023 21:50:21 -0230 Subject: [PATCH 1/5] Unlock all create class slots and sets --- data/ui_scripts/cac_options/__init__.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 data/ui_scripts/cac_options/__init__.lua diff --git a/data/ui_scripts/cac_options/__init__.lua b/data/ui_scripts/cac_options/__init__.lua new file mode 100644 index 0000000..8079e04 --- /dev/null +++ b/data/ui_scripts/cac_options/__init__.lua @@ -0,0 +1,21 @@ +Dvar.purchasedClassSetCount:set( 10 ) + +Engine.GetCustomClassCount = function( arg0 ) + return 10 +end + +Engine.GetNumberOfClassSetsOwned = function( arg0 ) + return 10 +end + +Engine.IsClassSetsAvailableForCurrentGameMode = function() + return true +end + +function IsClassSetsAvailableForCurrentGameMode() + return Engine.IsClassSetsAvailableForCurrentGameMode() +end + +function DoesPlayerHaveExtraSlotsItem( arg0 ) + return true +end From af76836254af81d0e0167fe46d80b7f009799759 Mon Sep 17 00:00:00 2001 From: WantedDV <122710241+WantedDV@users.noreply.github.com> Date: Sun, 16 Apr 2023 18:33:31 -0230 Subject: [PATCH 2/5] cg_unlockall_cac_slots dvar --- src/client/component/loot.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/client/component/loot.cpp b/src/client/component/loot.cpp index 291bcdd..b95301d 100644 --- a/src/client/component/loot.cpp +++ b/src/client/component/loot.cpp @@ -17,6 +17,7 @@ namespace loot 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_specialists_outfits; + const game::dvar_t* dvar_cg_unlockall_cac_slots; utils::hook::detour loot_getitemquantity_hook; utils::hook::detour liveinventory_getitemquantity_hook; @@ -30,7 +31,8 @@ namespace loot utils::hook::detour bg_unlockablescharactercustomizationitemlocked_hook; utils::hook::detour bg_emblemisentitlementbackgroundgranted_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) { if (!dvar_cg_unlockall_loot->current.value.enabled) @@ -60,7 +62,7 @@ namespace loot 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; } @@ -160,9 +162,19 @@ namespace loot return liveentitlements_isentitlementactiveforcontroller_hook.invoke(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(mode, controllerIndex); + } }; - struct component final : client_component + struct component final: client_component { 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_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_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); 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_emblemisentitlementbackgroundgranted_hook.create(0x142667520_g, bg_emblemisentitlementbackgroundgranted_stub); liveentitlements_isentitlementactiveforcontroller_hook.create(0x141E124E0_g, liveentitlements_isentitlementactiveforcontroller_stub); + bg_unlockablesgetcustomclasscount_hook.create(0x1426A5900_g, bg_unlockablesgetcustomclasscount_stub); scheduler::once([]() { if (dvar_cg_unlockall_loot->current.value.enabled) From b6bc9e6fa4563231cddaa8357e3f5216cef1ae09 Mon Sep 17 00:00:00 2001 From: WantedDV <122710241+WantedDV@users.noreply.github.com> Date: Sun, 16 Apr 2023 21:02:59 -0230 Subject: [PATCH 3/5] Add unlock class slots togle to stats menu --- data/ui_scripts/cac_options/__init__.lua | 21 --------------------- data/ui_scripts/stats/__init__.lua | 13 ++++++++++++- 2 files changed, 12 insertions(+), 22 deletions(-) delete mode 100644 data/ui_scripts/cac_options/__init__.lua diff --git a/data/ui_scripts/cac_options/__init__.lua b/data/ui_scripts/cac_options/__init__.lua deleted file mode 100644 index 8079e04..0000000 --- a/data/ui_scripts/cac_options/__init__.lua +++ /dev/null @@ -1,21 +0,0 @@ -Dvar.purchasedClassSetCount:set( 10 ) - -Engine.GetCustomClassCount = function( arg0 ) - return 10 -end - -Engine.GetNumberOfClassSetsOwned = function( arg0 ) - return 10 -end - -Engine.IsClassSetsAvailableForCurrentGameMode = function() - return true -end - -function IsClassSetsAvailableForCurrentGameMode() - return Engine.IsClassSetsAvailableForCurrentGameMode() -end - -function DoesPlayerHaveExtraSlotsItem( arg0 ) - return true -end diff --git a/data/ui_scripts/stats/__init__.lua b/data/ui_scripts/stats/__init__.lua index a20f2ea..b9b5a34 100644 --- a/data/ui_scripts/stats/__init__.lua +++ b/data/ui_scripts/stats/__init__.lua @@ -42,7 +42,18 @@ DataSources.MPStatsSettings = DataSourceHelpers.ListSetup( "MPStatsSettings", fu }, }, nil, updateDvar )) end - table.insert( optionsTable, CoD.OptionsUtility.CreateDvarSettings( controller, "Unlock All Attachments", "All attachments on weapons are unlocked.", "MPStatsSettings_unlockall_attachments", "cg_unlockall_attachments", { + table.insert( optionsTable, CoD.OptionsUtility.CreateDvarSettings( controller, "Unlock All Class Slots", "Unlock all create-a-class slots and sets.", "MPStatsSettings_unlockall_cac_slots", "cg_unlockall_cac_slots", { + { + option = "MENU_DISABLED", + value = 0, + default = true + }, + { + option = "MENU_ENABLED", + value = 1 + }, + }, nil, updateDvar )) + table.insert( optionsTable, CoD.OptionsUtility.CreateDvarSettings( controller, "Unlock All Attachments", "All attachments on weapons are unlocked.", "MPStatsSettings_unlockall_attachments", "cg_unlockall_attachments", { { option = "MENU_DISABLED", value = 0, From d069df0c869758a8e40258af4c86c65eb154851c Mon Sep 17 00:00:00 2001 From: WantedDV <122710241+WantedDV@users.noreply.github.com> Date: Sun, 16 Apr 2023 21:04:30 -0230 Subject: [PATCH 4/5] associate cac item_id with cg_unlockall_cac_slots --- 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 b95301d..329439d 100644 --- a/src/client/component/loot.cpp +++ b/src/client/component/loot.cpp @@ -50,13 +50,19 @@ namespace loot int liveinventory_getitemquantity_stub(const game::ControllerIndex_t controller_index, const int item_id) { - // Item id's for extra CaC slots, CWL camo's and paid specialist outfits + // Item id's for CWL camo's and paid specialist outfits if (dvar_cg_unlockall_loot->current.value.enabled && (item_id == 99003 || item_id >= 99018 && item_id <= 99021 || item_id == 99025 || item_id >= 90047 && item_id <= 90064)) { return 1; } + // Item id for extra CaC slots + if (dvar_cg_unlockall_cac_slots->current.value.enabled && (item_id == 99003)) + { + return 1; + } + return liveinventory_getitemquantity_hook.invoke(controller_index, item_id); } @@ -205,7 +211,7 @@ namespace loot { game::Dvar_SetFromStringByName("ui_enableAllHeroes", "1", true); } - }, scheduler::pipeline::dvars_loaded); + }, scheduler::pipeline::dvars_loaded); } }; }; From 420b89451293369e3c15394ad118062224a6bbcf Mon Sep 17 00:00:00 2001 From: WantedDV <122710241+WantedDV@users.noreply.github.com> Date: Tue, 18 Apr 2023 08:12:59 -0230 Subject: [PATCH 5/5] You had one job auto-formatter --- src/client/component/loot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/component/loot.cpp b/src/client/component/loot.cpp index 329439d..39a5449 100644 --- a/src/client/component/loot.cpp +++ b/src/client/component/loot.cpp @@ -58,7 +58,7 @@ namespace loot } // Item id for extra CaC slots - if (dvar_cg_unlockall_cac_slots->current.value.enabled && (item_id == 99003)) + if (dvar_cg_unlockall_cac_slots->current.value.enabled && item_id == 99003) { return 1; } @@ -211,7 +211,7 @@ namespace loot { game::Dvar_SetFromStringByName("ui_enableAllHeroes", "1", true); } - }, scheduler::pipeline::dvars_loaded); + }, scheduler::pipeline::dvars_loaded); } }; };