From 4e1e3ab028ae1a2809e9e4024804eda2985ad3f7 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 21 Nov 2022 00:11:10 +0300 Subject: [PATCH] Add 'Unlock All' button in SP (#358) * Add 'Unlock All' button in SP * Add 'Unlock All' button in SP * Hide useless 'Leaderboard' button * cleanup and format * fix errors i think * Revert "fix errors i think" This reverts commit bbd0287d6fa7a3fd8b4f487b1331250f39522b28. * Revert "cleanup and format" This reverts commit a0aeced689e10d0855510784d5cc1ba0aa7362ad. Co-authored-by: fed <58637860+fedddddd@users.noreply.github.com> Co-authored-by: m --- data/cdata/ui_scripts/patches/__init__.lua | 3 +- .../cdata/ui_scripts/patches/sp_unlockall.lua | 53 +++++++++++++++++++ data/zonetool/localizedstrings/english.json | 2 + .../localizedstrings/english_safe.json | 2 + data/zonetool/localizedstrings/french.json | 5 +- data/zonetool/localizedstrings/german.json | 4 +- data/zonetool/localizedstrings/italian.json | 3 ++ .../localizedstrings/japanese_partial.json | 5 +- data/zonetool/localizedstrings/korean.json | 5 +- data/zonetool/localizedstrings/polish.json | 5 +- .../zonetool/localizedstrings/portuguese.json | 5 +- data/zonetool/localizedstrings/russian.json | 3 ++ .../localizedstrings/simplified_chinese.json | 5 +- data/zonetool/localizedstrings/spanish.json | 5 +- .../localizedstrings/traditional_chinese.json | 5 +- 15 files changed, 100 insertions(+), 10 deletions(-) create mode 100644 data/cdata/ui_scripts/patches/sp_unlockall.lua diff --git a/data/cdata/ui_scripts/patches/__init__.lua b/data/cdata/ui_scripts/patches/__init__.lua index 0265a4d0..968b04f2 100644 --- a/data/cdata/ui_scripts/patches/__init__.lua +++ b/data/cdata/ui_scripts/patches/__init__.lua @@ -1,5 +1,6 @@ if (game:issingleplayer()) then - return + require("sp_unlockall") + return end if (Engine.InFrontend()) then diff --git a/data/cdata/ui_scripts/patches/sp_unlockall.lua b/data/cdata/ui_scripts/patches/sp_unlockall.lua new file mode 100644 index 00000000..7db05582 --- /dev/null +++ b/data/cdata/ui_scripts/patches/sp_unlockall.lua @@ -0,0 +1,53 @@ +if Engine.InFrontend() then + local levelselectmenu = LUI.sp_menus.LevelSelectMenu + levelselectmenu.SetupInfoBoxRightForArcadeMode = function(f44_arg0, f44_arg1) + return false + end + LUI.LevelSelect.AddLevelListButtons = function(f50_arg0, f50_arg1) + for f50_local0 = 1, #f50_arg1, 1 do + if not Engine.GetDvarBool("arcademode") or not f50_arg1[f50_local0].narativeLevel then + f50_arg0:AddLevelListEntry(f50_local0, f50_arg1[f50_local0]) + end + end + if not Engine.GetDvarBool("arcademode") then + if Engine.GetDvarBool("profileMenuOption_hasUnlockedAll_SP") then + f50_arg0:AddHelp({ + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize("@LUA_MENU_CANCEL_UNLOCK_CAPS"), + side = "right", + clickable = true + }, levelselectmenu.SetUnlockAll) + else + f50_arg0:AddHelp({ + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize("@LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE"), + side = "right", + clickable = true + }, levelselectmenu.UnlockAllPopup) + end + end + end + levelselectmenu.UnlockAllPopup = function(f56_arg0, f56_arg1) + LUI.FlowManager.RequestAddMenu(nil, "request_yesno_popup_generic", true, f56_arg1.controller, nil, { + popup_title = Engine.Localize("@LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE"), + yes_action = levelselectmenu.SetUnlockAll, + message_text = Engine.Localize("@MENU_COMPLETED_CHEAT") .. ". " .. + Engine.Localize("@LUA_MENU_CAMPAIGN_UNLOCKED_ALL_DESC") + }) + end + levelselectmenu.SetUnlockAll = function(f57_arg0, f57_arg1) + Engine.SetDvarBool("profileMenuOption_hasUnlockedAll_SP", + not Engine.GetDvarBool("profileMenuOption_hasUnlockedAll_SP")) + Engine.SetDvarBool("mis_cheat", not Engine.GetDvarBool("mis_cheat")) + Engine.ExecNow("profile_menuDvarsFinish") + Engine.Exec("updategamerprofile") + local f57_local0 = LUI.FlowManager.GetTopOpenAndVisibleMenuName() + LUI.FlowManager.RequestAddMenu(nil, f57_local0, true, f57_arg1.controller, true, + LUI.LevelSelect.FindActData(f57_local0), { + reload = true + }) + end +end + diff --git a/data/zonetool/localizedstrings/english.json b/data/zonetool/localizedstrings/english.json index 915ac1d1..43c4aca0 100644 --- a/data/zonetool/localizedstrings/english.json +++ b/data/zonetool/localizedstrings/english.json @@ -1,4 +1,6 @@ { + "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Unlock All Missions and Intel", + "LUA_MENU_CANCEL_UNLOCK_CAPS": "Cancel Unlock All Missions", "LUA_MENU_CHOOSE_LANGUAGE": "Choose your language", "MENU_APPLY_LANGUAGE_SETTINGS": "Apply language settings?" } \ No newline at end of file diff --git a/data/zonetool/localizedstrings/english_safe.json b/data/zonetool/localizedstrings/english_safe.json index 915ac1d1..43c4aca0 100644 --- a/data/zonetool/localizedstrings/english_safe.json +++ b/data/zonetool/localizedstrings/english_safe.json @@ -1,4 +1,6 @@ { + "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Unlock All Missions and Intel", + "LUA_MENU_CANCEL_UNLOCK_CAPS": "Cancel Unlock All Missions", "LUA_MENU_CHOOSE_LANGUAGE": "Choose your language", "MENU_APPLY_LANGUAGE_SETTINGS": "Apply language settings?" } \ No newline at end of file diff --git a/data/zonetool/localizedstrings/french.json b/data/zonetool/localizedstrings/french.json index 3d5568d3..9957bc48 100644 --- a/data/zonetool/localizedstrings/french.json +++ b/data/zonetool/localizedstrings/french.json @@ -6,6 +6,9 @@ "LUA_MENU_RED_DOT_BRIGHTNESS": "Luminosité du point rouge", "LUA_MENU_RED_DOT_BRIGHTNESS_DESC": "Ajustez la luminosité du point rouge des réticules.", + "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Débloquer toutes les missions", + "LUA_MENU_CANCEL_UNLOCK_CAPS": "Annuler déblocage", + "MENU_MODS": "MODS", "MENU_MODS_DESC": "Charger les mods installés.", "LUA_MENU_MOD_DESC_DEFAULT": "Charger &&1.", @@ -52,7 +55,7 @@ "MPHUD_LATENCY": "Latence: ", "MPHUD_LATENCY_MS": " ms", "LUA_MENU_TELEMETRY": "TÉLÉMÉTRIE", - + "LOCALE_ENGLISH": "Anglais", "LOCALE_ENGLISH_SAFE": "Anglais (sécuritaire)", "LOCALE_FRENCH": "Français", diff --git a/data/zonetool/localizedstrings/german.json b/data/zonetool/localizedstrings/german.json index 8929fb77..d73eb817 100644 --- a/data/zonetool/localizedstrings/german.json +++ b/data/zonetool/localizedstrings/german.json @@ -11,5 +11,7 @@ "LOCALE_RUSSIAN": "Russisch", "LOCALE_SIMPLIFIED_CHINESE": "Vereinfachtes Chinesisch", "LOCALE_SPANISH": "Spanisch", - "LOCALE_TRADITIONAL_CHINESE": "Traditionelles Chinesisch" + "LOCALE_TRADITIONAL_CHINESE": "Traditionelles Chinesisch", + "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Alle Missionen freischalten", + "LUA_MENU_CANCEL_UNLOCK_CAPS": "Freischalten abbrechen" } \ No newline at end of file diff --git a/data/zonetool/localizedstrings/italian.json b/data/zonetool/localizedstrings/italian.json index 5d11cd74..40344f39 100644 --- a/data/zonetool/localizedstrings/italian.json +++ b/data/zonetool/localizedstrings/italian.json @@ -1,4 +1,7 @@ { + "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Sblocca tutte le missioni", + "LUA_MENU_CANCEL_UNLOCK_CAPS": "Annulla sblocco", + "MENU_MODS_DESC": "Abilita mod installate.", "LUA_MENU_MOD_DESC_DEFAULT": "Abilita &&1.", "LUA_MENU_MOD_DESC": "&&1\nAutore: &&2\nVersione: &&3", diff --git a/data/zonetool/localizedstrings/japanese_partial.json b/data/zonetool/localizedstrings/japanese_partial.json index 74623c39..a767592f 100644 --- a/data/zonetool/localizedstrings/japanese_partial.json +++ b/data/zonetool/localizedstrings/japanese_partial.json @@ -11,5 +11,8 @@ "LOCALE_RUSSIAN": "ロシア語", "LOCALE_SIMPLIFIED_CHINESE": "簡体字中国語", "LOCALE_SPANISH": "スペイン語", - "LOCALE_TRADITIONAL_CHINESE": "繁体字中国語" + "LOCALE_TRADITIONAL_CHINESE": "繁体字中国語", + + "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "全ミッションをアンロック", + "LUA_MENU_CANCEL_UNLOCK_CAPS": "アンロックをキャンセル" } \ No newline at end of file diff --git a/data/zonetool/localizedstrings/korean.json b/data/zonetool/localizedstrings/korean.json index cca18fe7..0940d164 100644 --- a/data/zonetool/localizedstrings/korean.json +++ b/data/zonetool/localizedstrings/korean.json @@ -11,5 +11,8 @@ "LOCALE_RUSSIAN": "러시아어", "LOCALE_SIMPLIFIED_CHINESE": "중국어(간체)", "LOCALE_SPANISH": "스페인어", - "LOCALE_TRADITIONAL_CHINESE": "중국어(번체)" + "LOCALE_TRADITIONAL_CHINESE": "중국어(번체)", + + "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "모든 임무 잠금 해제", + "LUA_MENU_CANCEL_UNLOCK_CAPS": "잠금 해제 취소" } \ No newline at end of file diff --git a/data/zonetool/localizedstrings/polish.json b/data/zonetool/localizedstrings/polish.json index 038c7af2..125b44e6 100644 --- a/data/zonetool/localizedstrings/polish.json +++ b/data/zonetool/localizedstrings/polish.json @@ -11,5 +11,8 @@ "LOCALE_RUSSIAN": "Rosyjski", "LOCALE_SIMPLIFIED_CHINESE": "Chiński uproszczony", "LOCALE_SPANISH": "Hiszpański", - "LOCALE_TRADITIONAL_CHINESE": "Chiński tradycyjny" + "LOCALE_TRADITIONAL_CHINESE": "Chiński tradycyjny", + + "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Odblokuj wszystkie misje", + "LUA_MENU_CANCEL_UNLOCK_CAPS": "Anuluj odblokowanie" } \ No newline at end of file diff --git a/data/zonetool/localizedstrings/portuguese.json b/data/zonetool/localizedstrings/portuguese.json index 3d7e4348..388e5837 100644 --- a/data/zonetool/localizedstrings/portuguese.json +++ b/data/zonetool/localizedstrings/portuguese.json @@ -11,5 +11,8 @@ "LOCALE_RUSSIAN": "Russo", "LOCALE_SIMPLIFIED_CHINESE": "Chinês simplificado", "LOCALE_SPANISH": "Español", - "LOCALE_TRADITIONAL_CHINESE": "Chinês tradicional" + "LOCALE_TRADITIONAL_CHINESE": "Chinês tradicional", + + "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Desbloquear todas as missões", + "LUA_MENU_CANCEL_UNLOCK_CAPS": "Cancelar desbloqueio" } \ No newline at end of file diff --git a/data/zonetool/localizedstrings/russian.json b/data/zonetool/localizedstrings/russian.json index f0fd3b89..2f973fc4 100644 --- a/data/zonetool/localizedstrings/russian.json +++ b/data/zonetool/localizedstrings/russian.json @@ -13,6 +13,9 @@ "LUA_MENU_RED_DOT_BRIGHTNESS": "Яркость коллиматора", "LUA_MENU_RED_DOT_BRIGHTNESS_DESC": "Регулировка яркости красной точки коллиматорных прицелов.", + "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Открыть все задания и чит-коды", + "LUA_MENU_CANCEL_UNLOCK_CAPS": "Вернуться к своему прогрессу прохождения", + "MENU_MODS": "МОДЫ", "MENU_MODS_DESC": "Запуск установленных модов.", "LUA_MENU_MOD_DESC_DEFAULT": "Запустить &&1.", diff --git a/data/zonetool/localizedstrings/simplified_chinese.json b/data/zonetool/localizedstrings/simplified_chinese.json index 93eedb9d..07264d09 100644 --- a/data/zonetool/localizedstrings/simplified_chinese.json +++ b/data/zonetool/localizedstrings/simplified_chinese.json @@ -11,5 +11,8 @@ "LOCALE_RUSSIAN": "俄语", "LOCALE_SIMPLIFIED_CHINESE": "简体中文", "LOCALE_SPANISH": "西班牙语", - "LOCALE_TRADITIONAL_CHINESE": "繁体中文" + "LOCALE_TRADITIONAL_CHINESE": "繁体中文", + + "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "解锁全部任务", + "LUA_MENU_CANCEL_UNLOCK_CAPS": "取消解锁" } \ No newline at end of file diff --git a/data/zonetool/localizedstrings/spanish.json b/data/zonetool/localizedstrings/spanish.json index 65549648..4fcdf805 100644 --- a/data/zonetool/localizedstrings/spanish.json +++ b/data/zonetool/localizedstrings/spanish.json @@ -11,5 +11,8 @@ "LOCALE_RUSSIAN": "Ruso", "LOCALE_SIMPLIFIED_CHINESE": "Chino simplificado", "LOCALE_SPANISH": "Español", - "LOCALE_TRADITIONAL_CHINESE": "Chino tradicional" + "LOCALE_TRADITIONAL_CHINESE": "Chino tradicional", + + "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Desbloquear todas las misiones", + "LUA_MENU_CANCEL_UNLOCK_CAPS": "Cancelar desbloqueo" } \ No newline at end of file diff --git a/data/zonetool/localizedstrings/traditional_chinese.json b/data/zonetool/localizedstrings/traditional_chinese.json index 9152cdcc..526ed6da 100644 --- a/data/zonetool/localizedstrings/traditional_chinese.json +++ b/data/zonetool/localizedstrings/traditional_chinese.json @@ -11,5 +11,8 @@ "LOCALE_RUSSIAN": "俄文", "LOCALE_SIMPLIFIED_CHINESE": "簡體中文", "LOCALE_SPANISH": "西班牙文", - "LOCALE_TRADITIONAL_CHINESE": "繁體中文" + "LOCALE_TRADITIONAL_CHINESE": "繁體中文", + + "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "解鎖所有任務", + "LUA_MENU_CANCEL_UNLOCK_CAPS": "取消解鎖" } \ No newline at end of file