From 8b09cc53e8f54db9e10fb7afcf550e2a049b6cec Mon Sep 17 00:00:00 2001
From: AnthonyFuller <24512050+AnthonyFuller@users.noreply.github.com>
Date: Tue, 27 Aug 2024 23:03:55 +0100
Subject: [PATCH] feat: add in-game modal when Peacock l10n isn't detected
---
components/configSwizzleManager.ts | 2 ++
components/menus/menuSystem.ts | 2 ++
resources/locale.json | 22 ++++++------
static/DynresModal.json | 55 ++++++++++++++++++++++++++++++
static/EiderDashboard.json | 18 ++++++++++
static/H2DashboardTemplate.json | 20 +++++++++++
6 files changed, 108 insertions(+), 11 deletions(-)
create mode 100644 static/DynresModal.json
diff --git a/components/configSwizzleManager.ts b/components/configSwizzleManager.ts
index 9091c5751..f5ac4113f 100644
--- a/components/configSwizzleManager.ts
+++ b/components/configSwizzleManager.ts
@@ -110,6 +110,7 @@ import HitsCategoryContractAttackTemplate from "../static/HitsCategoryContractAt
import MissionRewardsTemplate from "../static/MissionRewardsTemplate.json"
import SniperUnlockables from "../static/SniperUnlockables.json"
import LegacyStatisticsTemplate from "../static/LegacyStatisticsTemplate.json"
+import DynresModal from "../static/DynresModal.json"
import type { GameVersion } from "./types/types"
import { fastClone } from "./utils"
@@ -211,6 +212,7 @@ const configs = {
MissionRewardsTemplate,
SniperUnlockables,
LegacyStatisticsTemplate,
+ DynresModal,
}
Object.keys(configs).forEach((cfg) => {
diff --git a/components/menus/menuSystem.ts b/components/menus/menuSystem.ts
index 742728590..de57bb767 100644
--- a/components/menus/menuSystem.ts
+++ b/components/menus/menuSystem.ts
@@ -344,6 +344,8 @@ export class MenuSystemDatabase {
$else: true,
},
}
+ case "/pages/hub/modals/peacock/dynresmodal.json":
+ return getConfig("DynresModal", false)
// This will only get hit by H2
case "/pages/hub/career.json":
return getConfig("H2CareerTemplate", false)
diff --git a/resources/locale.json b/resources/locale.json
index 3fe0f6008..eb577dade 100644
--- a/resources/locale.json
+++ b/resources/locale.json
@@ -1,6 +1,6 @@
{
"english": {
- "UI_DRP_001": "UI_DRP_001",
+ "UI_PEACOCK_STRINGS_PRESENT": "yes",
"UI_CONTRACT_NEGRONI_TITLE": "The Brothers",
"UI_CONTRACT_NEGRONI_DESC": "The Brothers",
"UI_PEACOCK_KOATS_CONSPIRACY": "The KOats Conspiracy",
@@ -275,7 +275,7 @@
"UI_MENU_PAGE_STORY_CUTSCENE_SEASON2_STORY_BLOCK_10_TITLE": "A Trip to Paradise"
},
"french": {
- "UI_DRP_001": "UI_DRP_001",
+ "UI_PEACOCK_STRINGS_PRESENT": "yes",
"UI_CONTRACT_NEGRONI_TITLE": "Les Frères",
"UI_CONTRACT_NEGRONI_DESC": "Les Frères",
"UI_PEACOCK_KOATS_CONSPIRACY": "La Conspiration de KOats",
@@ -551,7 +551,7 @@
"UI_MENU_PAGE_STORY_CUTSCENE_SEASON2_STORY_BLOCK_10_TITLE": "A Trip to Paradise"
},
"italian": {
- "UI_DRP_001": "UI_DRP_001",
+ "UI_PEACOCK_STRINGS_PRESENT": "yes",
"UI_CONTRACT_NEGRONI_TITLE": "The Brothers",
"UI_CONTRACT_NEGRONI_DESC": "The Brothers",
"UI_PEACOCK_KOATS_CONSPIRACY": "The KOats Conspiracy",
@@ -1107,7 +1107,7 @@
"UI_MENU_PAGE_STORY_CUTSCENE_SEASON2_STORY_BLOCK_10_TITLE": "A Trip to Paradise"
},
"spanish": {
- "UI_DRP_001": "UI_DRP_001",
+ "UI_PEACOCK_STRINGS_PRESENT": "yes",
"UI_CONTRACT_NEGRONI_TITLE": "Los Hermanos",
"UI_CONTRACT_NEGRONI_DESC": "Los Hermanos",
"UI_PEACOCK_KOATS_CONSPIRACY": "La Conspiración de KOats",
@@ -1383,7 +1383,7 @@
"UI_MENU_PAGE_STORY_CUTSCENE_SEASON2_STORY_BLOCK_10_TITLE": "A Trip to Paradise"
},
"russian": {
- "UI_DRP_001": "UI_DRP_001",
+ "UI_PEACOCK_STRINGS_PRESENT": "yes",
"UI_CONTRACT_NEGRONI_TITLE": "Братья",
"UI_CONTRACT_NEGRONI_DESC": "Братья",
"UI_PEACOCK_KOATS_CONSPIRACY": "Конспирация KOats'а",
@@ -1658,7 +1658,7 @@
"UI_MENU_PAGE_STORY_CUTSCENE_SEASON2_STORY_BLOCK_10_TITLE": "A Trip to Paradise"
},
"chineseSimplified": {
- "UI_DRP_001": "UI_DRP_001",
+ "UI_PEACOCK_STRINGS_PRESENT": "yes",
"UI_CONTRACT_NEGRONI_TITLE": "兄弟",
"UI_CONTRACT_NEGRONI_DESC": "兄弟",
"UI_PEACOCK_KOATS_CONSPIRACY": "克兹阴谋",
@@ -1933,7 +1933,7 @@
"UI_MENU_PAGE_STORY_CUTSCENE_SEASON2_STORY_BLOCK_10_TITLE": "A Trip to Paradise"
},
"chineseTraditional": {
- "UI_DRP_001": "UI_DRP_001",
+ "UI_PEACOCK_STRINGS_PRESENT": "yes",
"UI_CONTRACT_NEGRONI_TITLE": "兄弟",
"UI_CONTRACT_NEGRONI_DESC": "兄弟",
"UI_PEACOCK_KOATS_CONSPIRACY": "科茨陰謀",
@@ -2208,7 +2208,7 @@
"UI_MENU_PAGE_STORY_CUTSCENE_SEASON2_STORY_BLOCK_10_TITLE": "A Trip to Paradise"
},
"japanese": {
- "UI_DRP_001": "UI_DRP_001",
+ "UI_PEACOCK_STRINGS_PRESENT": "yes",
"UI_CONTRACT_NEGRONI_TITLE": "The Brothers",
"UI_CONTRACT_NEGRONI_DESC": "The Brothers",
"UI_PEACOCK_KOATS_CONSPIRACY": "The KOats Conspiracy",
@@ -2483,7 +2483,7 @@
"UI_MENU_PAGE_STORY_CUTSCENE_SEASON2_STORY_BLOCK_10_TITLE": "A Trip to Paradise"
},
"spanishMexican": {
- "UI_DRP_001": "UI_DRP_001",
+ "UI_PEACOCK_STRINGS_PRESENT": "yes",
"UI_CONTRACT_NEGRONI_TITLE": "The Brothers",
"UI_CONTRACT_NEGRONI_DESC": "The Brothers",
"UI_PEACOCK_KOATS_CONSPIRACY": "The KOats Conspiracy",
@@ -2759,7 +2759,7 @@
"UI_MENU_PAGE_STORY_CUTSCENE_SEASON2_STORY_BLOCK_10_TITLE": "A Trip to Paradise"
},
"portugueseBrazil": {
- "UI_DRP_001": "UI_DRP_001",
+ "UI_PEACOCK_STRINGS_PRESENT": "yes",
"UI_CONTRACT_NEGRONI_TITLE": "Os Irmãos",
"UI_CONTRACT_NEGRONI_DESC": "Os Irmãos",
"UI_PEACOCK_KOATS_CONSPIRACY": "A Conspiração KOats",
@@ -2993,7 +2993,7 @@
"UI_MENU_PAGE_STORY_CUTSCENE_SEASON2_STORY_BLOCK_10_TITLE": "A Trip to Paradise"
},
"polish": {
- "UI_DRP_001": "UI_DRP_001",
+ "UI_PEACOCK_STRINGS_PRESENT": "yes",
"UI_CONTRACT_NEGRONI_TITLE": "Bracia",
"UI_CONTRACT_NEGRONI_DESC": "Bracia",
"UI_PEACOCK_KOATS_CONSPIRACY": "Konspiracja KOats",
diff --git a/static/DynresModal.json b/static/DynresModal.json
new file mode 100644
index 000000000..f646ac4bc
--- /dev/null
+++ b/static/DynresModal.json
@@ -0,0 +1,55 @@
+{
+ "$datacontext": {
+ "in": "$.",
+ "datavalues": {
+ "_comment": "this is shown if the user does not have the dynamic resources package",
+ "Url": "https://thepeacockproject.org/wiki/troubleshooting/missing-strings"
+ },
+ "do": {
+ "show-modal": {
+ "config": {
+ "view": "menu3.modal.ModalDialogGeneric",
+ "buttons": [
+ "Open the Peacock wiki",
+ {
+ "label": "$loc UI_DIALOG_CANCEL",
+ "type": "cancel"
+ }
+ ],
+ "data": {
+ "dialogWidth": 768,
+ "frameheightmax": 600,
+ "information": [
+ {
+ "description": "Peacock's dynamic resource package has not been loaded. This will affect localisation across all of Peacock's changes.
Visit the wiki page to see how to fix this."
+ }
+ ]
+ }
+ },
+ "onbutton": [
+ [
+ {
+ "open-url": {
+ "url": "$.Url"
+ }
+ },
+ {
+ "set-value": {
+ "target": "$.@global.OtherModalWasShown",
+ "value": true
+ }
+ }
+ ],
+ [
+ {
+ "set-value": {
+ "target": "$.@global.OtherModalWasShown",
+ "value": true
+ }
+ }
+ ]
+ ]
+ }
+ }
+ }
+}
diff --git a/static/EiderDashboard.json b/static/EiderDashboard.json
index fb2ffc333..ad570e90c 100644
--- a/static/EiderDashboard.json
+++ b/static/EiderDashboard.json
@@ -414,5 +414,23 @@
}
}
]
+ },
+ "actions": {
+ "activated": {
+ "$datacontext": {
+ "in": "$.",
+ "datavalues": {
+ "peacockstrings": "$loc UI_PEACOCK_STRINGS_PRESENT"
+ },
+ "do": {
+ "$if $eq($.peacockstrings,yes)": {
+ "$then": {},
+ "$else": {
+ "$include": "menusystem/pages/hub/modals/peacock/dynresmodal.json"
+ }
+ }
+ }
+ }
+ }
}
}
diff --git a/static/H2DashboardTemplate.json b/static/H2DashboardTemplate.json
index 6d1101392..183832d99 100644
--- a/static/H2DashboardTemplate.json
+++ b/static/H2DashboardTemplate.json
@@ -317,5 +317,25 @@
}
}
]
+ },
+ "actions": {
+ "activated": {
+ "$datacontext": {
+ "in": "$.",
+ "datavalues": {
+ "peacockstrings": "$loc UI_PEACOCK_STRINGS_PRESENT"
+ },
+ "do": {
+ "$if $eq($.peacockstrings,yes)": {
+ "$then": {},
+ "$else": {
+ "$include": {
+ "$path": "menusystem/pages/hub/modals/peacock/dynresmodal.json"
+ }
+ }
+ }
+ }
+ }
+ }
}
}