From 5abecf9fad465caf5f806216f4926cc0566e145d Mon Sep 17 00:00:00 2001 From: m Date: Sun, 21 Jan 2024 12:45:42 -0600 Subject: [PATCH] fix director_cut cheat + easter egg stats closes #60 #42 #47 --- src/client/component/command.cpp | 14 - src/client/component/stats.cpp | 428 ++++++++++++++++++------------- 2 files changed, 248 insertions(+), 194 deletions(-) diff --git a/src/client/component/command.cpp b/src/client/component/command.cpp index 42385642..e08d44f1 100644 --- a/src/client/component/command.cpp +++ b/src/client/component/command.cpp @@ -472,20 +472,6 @@ namespace command game::Com_GameMode_SetDesiredGameMode(game::GAME_MODE_CP); }); - add("director_cut", [](const params& params) - { - if (params.size() == 2) - { - const auto value = static_cast(atoi(params.get(1))); - utils::hook::set(0x5ECB830_b, value); - } - else - { - const auto command = params.get(0); - console::error("Incorrect number of arguments for \"%s\".\n", command); - } - }); - add_sv("god", [](const int client_num, const params_sv&) { if (!game::shared::cheats_ok(client_num, true)) diff --git a/src/client/component/stats.cpp b/src/client/component/stats.cpp index 2486661f..3323be04 100644 --- a/src/client/component/stats.cpp +++ b/src/client/component/stats.cpp @@ -14,186 +14,6 @@ namespace stats { - void unlock_stats() - { - if (game::CL_IsGameClientActive(0)) - { - console::info("Not allowed while ingame."); - return; - } - - if (game::Com_GameMode_GetActiveGameMode() != game::GAME_MODE_MP && game::Com_GameMode_GetActiveGameMode() != game::GAME_MODE_CP) - { - console::info("Must be in multiplayer or coop."); - return; - } - - // experience & prestige - command::execute("setRankedPlayerData progression playerLevel xp 1457200", true); - command::execute("setRankedPlayerData progression playerLevel prestige 30", true); - - command::execute("setCoopPlayerData progression playerLevel xp 95297348", true); - command::execute("setCoopPlayerData progression playerLevel prestige 20", true); - - // weapon experience - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_nrg mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_g18 mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_emc mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_revolver mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_erad mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_crb mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ripper mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ump45 mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_fhr mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ar57 mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ake mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m4 mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_aracc mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_fmg mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sdfar mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_kbs mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_cheytac mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m8 mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m1 mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_devastator mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_spas mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sonic mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sdfshotty mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mauler mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sdflmg mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_lmg03 mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_g18c mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ump45c mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_cheytacc mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m1c mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_spasc mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_arclassic mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_rvn mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_udm45 mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_crdb mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_vr mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mp28 mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_minilmg mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mod2187 mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ba50cal mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_gauss mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_longshot mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mag mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_unsalmg mpXP 54299", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_tacburst mpXP 54299", true); - - // weapon prestige - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_nrg prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_g18 prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_emc prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_revolver prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_erad prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_crb prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ripper prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ump45 prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_fhr prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ar57 prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ake prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m4 prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_aracc prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_fmg prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sdfar prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_kbs prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_cheytac prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m8 prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m1 prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_devastator prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_spas prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sonic prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sdfshotty prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mauler prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sdflmg prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_lmg03 prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_g18c prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ump45c prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_cheytacc prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m1c prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_spasc prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_arclassic prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_rvn prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_udm45 prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_crdb prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_vr prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mp28 prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_minilmg prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mod2187 prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ba50cal prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_gauss prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_longshot prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mag prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_unsalmg prestige 3", true); - command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_tacburst prestige 3", true); - - // classic weapons - command::execute("setCommonPlayerData sharedProgression classicWeapons iw7_g18c 1", true); - command::execute("setCommonPlayerData sharedProgression classicWeapons iw7_ump45c 1", true); - command::execute("setCommonPlayerData sharedProgression classicWeapons iw7_cheytacc 1", true); - command::execute("setCommonPlayerData sharedProgression classicWeapons iw7_spasc 1", true); - command::execute("setCommonPlayerData sharedProgression classicWeapons iw7_m1c 1", true); - - // Unlock challenges - game::StringTable* challenge_table = game::DB_FindXAssetHeader(game::XAssetType::ASSET_TYPE_STRINGTABLE, "mp/allchallengestable.csv", false).stringTable; - if (challenge_table) - { - for (int i = 0; i < challenge_table->rowCount; i++) - { - // Find challenge - const char* challenge = game::StringTable_GetColumnValueForRow(challenge_table, i, 0); - - int max_state = 0; - int max_progress = 0; - - // Find correct tier and progress - for (int j = 0; j < 10; j++) // iterate through states (max 10) - { - // progress, xp_reward, challenge_score - - int progress = atoi(game::StringTable_GetColumnValueForRow(challenge_table, i, 10 + (j * 3))); - if (!progress) break; - - max_state = j + 1; - max_progress = progress; - } - - command::execute(utils::string::va("setRankedPlayerData challengeState %s %d", challenge, max_state), true); - command::execute(utils::string::va("setRankedPlayerData challengeProgress %s %d", challenge, max_progress), true); - } - } - - game::StringTable* merit_table = game::DB_FindXAssetHeader(game::XAssetType::ASSET_TYPE_STRINGTABLE, "cp/allmeritstable.csv", false).stringTable; - if (merit_table) - { - for (int i = 0; i < merit_table->rowCount; i++) - { - // Find challenge - const char* challenge = game::StringTable_GetColumnValueForRow(merit_table, i, 0); - - int max_state = 0; - int max_progress = 0; - - // Find correct tier and progress - for (int j = 0; j < 10; j++) // iterate through states (max 10) - { - // progress, xp_reward, challenge_score - - int progress = atoi(game::StringTable_GetColumnValueForRow(merit_table, i, 10 + (j * 3))); - if (!progress) break; - - max_state = j + 1; - max_progress = progress; - } - - command::execute(utils::string::va("setCoopPlayerData meritState %s %d", challenge, max_state), true); - command::execute(utils::string::va("setCoopPlayerData meritProgress %s %d", challenge, max_progress), true); - } - } - } - namespace { utils::hook::detour is_item_unlocked_hook; @@ -269,6 +89,250 @@ namespace stats console::info("non leaf node named \"%s\"\n", state->member->name); } } + + bool can_run_command() + { + if (game::CL_IsGameClientActive(0)) + { + console::error("Not allowed while ingame."); + return false; + } + + if (game::Com_GameMode_GetActiveGameMode() != game::GAME_MODE_MP && game::Com_GameMode_GetActiveGameMode() != game::GAME_MODE_CP) + { + console::error("Must be in multiplayer or coop."); + return false; + } + + return true; + } + + void unlock_stats() + { + if (!can_run_command()) + { + return; + } + + // experience & prestige + command::execute("setRankedPlayerData progression playerLevel xp 1457200", true); + command::execute("setRankedPlayerData progression playerLevel prestige 30", true); + + command::execute("setCoopPlayerData progression playerLevel xp 95297348", true); + command::execute("setCoopPlayerData progression playerLevel prestige 20", true); + + // weapon experience + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_nrg mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_g18 mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_emc mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_revolver mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_erad mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_crb mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ripper mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ump45 mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_fhr mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ar57 mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ake mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m4 mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_aracc mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_fmg mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sdfar mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_kbs mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_cheytac mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m8 mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m1 mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_devastator mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_spas mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sonic mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sdfshotty mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mauler mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sdflmg mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_lmg03 mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_g18c mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ump45c mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_cheytacc mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m1c mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_spasc mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_arclassic mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_rvn mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_udm45 mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_crdb mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_vr mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mp28 mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_minilmg mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mod2187 mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ba50cal mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_gauss mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_longshot mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mag mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_unsalmg mpXP 54299", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_tacburst mpXP 54299", true); + + // weapon prestige + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_nrg prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_g18 prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_emc prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_revolver prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_erad prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_crb prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ripper prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ump45 prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_fhr prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ar57 prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ake prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m4 prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_aracc prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_fmg prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sdfar prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_kbs prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_cheytac prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m8 prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m1 prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_devastator prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_spas prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sonic prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sdfshotty prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mauler prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_sdflmg prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_lmg03 prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_g18c prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ump45c prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_cheytacc prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_m1c prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_spasc prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_arclassic prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_rvn prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_udm45 prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_crdb prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_vr prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mp28 prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_minilmg prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mod2187 prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_ba50cal prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_gauss prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_longshot prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_mag prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_unsalmg prestige 3", true); + command::execute("setCommonPlayerData sharedProgression weaponLevel iw7_tacburst prestige 3", true); + + // classic weapons + command::execute("setCommonPlayerData sharedProgression classicWeapons iw7_g18c 1", true); + command::execute("setCommonPlayerData sharedProgression classicWeapons iw7_ump45c 1", true); + command::execute("setCommonPlayerData sharedProgression classicWeapons iw7_cheytacc 1", true); + command::execute("setCommonPlayerData sharedProgression classicWeapons iw7_spasc 1", true); + command::execute("setCommonPlayerData sharedProgression classicWeapons iw7_m1c 1", true); + + // Unlock challenges + game::StringTable* challenge_table = game::DB_FindXAssetHeader(game::XAssetType::ASSET_TYPE_STRINGTABLE, "mp/allchallengestable.csv", false).stringTable; + if (challenge_table) + { + for (int i = 0; i < challenge_table->rowCount; i++) + { + // Find challenge + const char* challenge = game::StringTable_GetColumnValueForRow(challenge_table, i, 0); + + int max_state = 0; + int max_progress = 0; + + // Find correct tier and progress + for (int j = 0; j < 10; j++) // iterate through states (max 10) + { + // progress, xp_reward, challenge_score + + int progress = atoi(game::StringTable_GetColumnValueForRow(challenge_table, i, 10 + (j * 3))); + if (!progress) break; + + max_state = j + 1; + max_progress = progress; + } + + command::execute(utils::string::va("setRankedPlayerData challengeState %s %d", challenge, max_state), true); + command::execute(utils::string::va("setRankedPlayerData challengeProgress %s %d", challenge, max_progress), true); + } + } + + game::StringTable* merit_table = game::DB_FindXAssetHeader(game::XAssetType::ASSET_TYPE_STRINGTABLE, "cp/allmeritstable.csv", false).stringTable; + if (merit_table) + { + for (int i = 0; i < merit_table->rowCount; i++) + { + // Find challenge + const char* challenge = game::StringTable_GetColumnValueForRow(merit_table, i, 0); + + int max_state = 0; + int max_progress = 0; + + // Find correct tier and progress + for (int j = 0; j < 10; j++) // iterate through states (max 10) + { + // progress, xp_reward, challenge_score + + int progress = atoi(game::StringTable_GetColumnValueForRow(merit_table, i, 10 + (j * 3))); + if (!progress) break; + + max_state = j + 1; + max_progress = progress; + } + + command::execute(utils::string::va("setCoopPlayerData meritState %s %d", challenge, max_state), true); + command::execute(utils::string::va("setCoopPlayerData meritProgress %s %d", challenge, max_progress), true); + } + } + + command::execute("uploadstats", true); // needed to update stats i think + console::debug("unlocked all normal stats!\n"); + } + + void unlock_stats_ee() + { + if (!can_run_command()) + { + return; + } + + // soul keys (secret characters) + command::execute("setCoopPlayerData haveSoulKeys any_soul_key 1", true); // useless stat? + command::execute("setCoopPlayerData haveSoulKeys soul_key_1 1", true); + command::execute("setCoopPlayerData haveSoulKeys soul_key_2 1", true); + command::execute("setCoopPlayerData haveSoulKeys soul_key_3 1", true); + command::execute("setCoopPlayerData haveSoulKeys soul_key_4 1", true); + command::execute("setCoopPlayerData haveSoulKeys soul_key_5 1", true); + + // secret character 5 on cp_zmb + command::execute("setCoopPlayerData meritState mt_dlc4_troll2 1", true); // Conditions.HasBeatenMeph + command::execute("setCoopPlayerData meritState mt_dc_camo 1", true); + + // lobby songs unlocked + command::execute("setCoopPlayerData hasSongsUnlocked any_song 1", true); + for (int index = 1; index < 11; index++) + { + command::execute(utils::string::va("setCoopPlayerData hasSongsUnlocked song_%d 1", index), true); + } + + command::execute("uploadstats", true); // needed to update stats i think + console::debug("unlocked all easter egg stats!\n"); + } + + void director_cut(const command::params& params) + { + if (!can_run_command()) + { + return; + } + + if (params.size() < 2) + { + console::info("usage: \"/director_cut 0/1\"\n"); + return; + } + + const auto is_enabled = params.get(1); + command::execute(utils::string::va("setCoopPlayerData dc %s", is_enabled), true); + command::execute(utils::string::va("setCoopPlayerData dc_available %s", is_enabled), true); + + command::execute("uploadstats", true); // needed to update stats i think + console::debug("directors cut set to %s\n", is_enabled); + } } class component final : public component_interface @@ -282,6 +346,10 @@ namespace stats } command::add("unlockstats", unlock_stats); + command::add("unlockall", unlock_stats); + command::add("unlockstatsEE", unlock_stats_ee); + command::add("unlockallEE", unlock_stats_ee); + command::add("director_cut", director_cut); // register dvars scheduler::once([]()