Skip to content

Commit

Permalink
feat: add in-game modal when Peacock l10n isn't detected
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyFuller committed Aug 27, 2024
1 parent d3722d6 commit 8b09cc5
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 11 deletions.
2 changes: 2 additions & 0 deletions components/configSwizzleManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -211,6 +212,7 @@ const configs = {
MissionRewardsTemplate,
SniperUnlockables,
LegacyStatisticsTemplate,
DynresModal,
}

Object.keys(configs).forEach((cfg) => {
Expand Down
2 changes: 2 additions & 0 deletions components/menus/menuSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 11 additions & 11 deletions resources/locale.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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'а",
Expand Down Expand Up @@ -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": "克兹阴谋",
Expand Down Expand Up @@ -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": "科茨陰謀",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
55 changes: 55 additions & 0 deletions static/DynresModal.json
Original file line number Diff line number Diff line change
@@ -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.<br><br>Visit the wiki page to see how to fix this."
}
]
}
},
"onbutton": [
[
{
"open-url": {
"url": "$.Url"
}
},
{
"set-value": {
"target": "[email protected]",
"value": true
}
}
],
[
{
"set-value": {
"target": "[email protected]",
"value": true
}
}
]
]
}
}
}
}
18 changes: 18 additions & 0 deletions static/EiderDashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
}
}
}
}
20 changes: 20 additions & 0 deletions static/H2DashboardTemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
}
}
}
}
}

1 comment on commit 8b09cc5

@AnthonyFuller
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The modal is intentionally not using localisation lines! It wouldn't be able to find our custom ones since, well, it's not loaded!

Please sign in to comment.