From 608e62c2bd67271181dbbb7100cb7463c518ea50 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Wed, 26 Nov 2025 17:23:54 +0100 Subject: [PATCH] Implement cooldown feature for nobility advancement - Added logic in FalukantService to calculate the next available advancement date based on the user's last advancement. - Updated the frontend to display a cooldown message indicating when the user can next advance in nobility. - Enhanced the NobilityView component to handle and format the next advancement date appropriately. --- backend/services/falukantService.js | 10 +++++++++- frontend/src/i18n/locales/de/falukant.json | 3 ++- frontend/src/i18n/locales/en/falukant.json | 3 +++ frontend/src/views/falukant/NobilityView.vue | 16 ++++++++++++++-- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/backend/services/falukantService.js b/backend/services/falukantService.js index 45e7b55..6671cd6 100644 --- a/backend/services/falukantService.js +++ b/backend/services/falukantService.js @@ -2907,6 +2907,13 @@ class FalukantService extends BaseService { ], attributes: ['labelTr', 'level'] }); + let nextAdvanceAt = null; + if (falukantUser.lastNobilityAdvanceAt) { + const last = new Date(falukantUser.lastNobilityAdvanceAt); + const next = new Date(last.getTime()); + next.setDate(next.getDate() + 7); + nextAdvanceAt = next.toISOString(); + } const currentTitleLevel = nobility.level; const nextTitle = await TitleOfNobility.findOne({ where: { @@ -2922,7 +2929,8 @@ class FalukantService extends BaseService { }); return { current: nobility, - next: nextTitle + next: nextTitle, + nextAdvanceAt }; } diff --git a/frontend/src/i18n/locales/de/falukant.json b/frontend/src/i18n/locales/de/falukant.json index 8e9eed6..bae94e5 100644 --- a/frontend/src/i18n/locales/de/falukant.json +++ b/frontend/src/i18n/locales/de/falukant.json @@ -538,7 +538,8 @@ }, "advance": { "confirm": "Aufsteigen beantragen" - } + }, + "cooldown": "Du kannst frühestens wieder am {date} aufsteigen." }, "reputation": { "title": "Reputation", diff --git a/frontend/src/i18n/locales/en/falukant.json b/frontend/src/i18n/locales/en/falukant.json index b4f1f22..a142aae 100644 --- a/frontend/src/i18n/locales/en/falukant.json +++ b/frontend/src/i18n/locales/en/falukant.json @@ -41,6 +41,9 @@ "raft": "Raft", "sailing_ship": "Sailing ship" } + }, + "nobility": { + "cooldown": "You can only advance again on {date}." } } } \ No newline at end of file diff --git a/frontend/src/views/falukant/NobilityView.vue b/frontend/src/views/falukant/NobilityView.vue index 7137443..b7d96af 100644 --- a/frontend/src/views/falukant/NobilityView.vue +++ b/frontend/src/views/falukant/NobilityView.vue @@ -23,6 +23,9 @@ {{ $t('falukant.nobility.nextTitle') }}: {{ $t(`falukant.titles.${gender}.${next.labelTr}`) }}

+

+ {{ $t('falukant.nobility.cooldown', { date: formatDate(nextAdvanceAt) }) }} +