feat(politics): add new political office benefits and enhance database migration
All checks were successful
Deploy to production / deploy (push) Successful in 2m54s

- Introduced new benefits including 'reputation_periodic', 'appoint_politicians', 'set_regional_tax', 'free_lover_slots', 'guard_protection', and 'court_immunity' to the political office system.
- Updated database migration to add and remove the 'last_political_daily_salary_on' column using SQL queries for better performance.
- Enhanced localization files for multiple languages to support new benefits, improving user experience across the application.
- Updated UI components to display new benefits correctly in the PoliticsView, ensuring accurate representation of political office functionalities.
This commit is contained in:
Torsten Schulz (local)
2026-04-02 15:27:05 +02:00
parent 49713d957d
commit 5d06d97737
10 changed files with 303 additions and 19 deletions

View File

@@ -198,6 +198,19 @@ export default {
return t !== path ? t : k;
},
formatPoliticsAppointOfficeLabels(officeTrs) {
if (!Array.isArray(officeTrs) || !officeTrs.length) {
return '';
}
return officeTrs
.map((tr) => {
const path = `falukant.politics.offices.${tr}`;
const t = this.$t(path);
return t !== path ? t : String(tr);
})
.join(', ');
},
formatPoliticsBenefitItem(b) {
if (b == null) {
return '';
@@ -216,6 +229,32 @@ export default {
if (b.tr === 'daily_salary') {
return this.$t('falukant.politics.benefits.daily_salary', { amount: b.params?.amount ?? '—' });
}
if (b.tr === 'reputation_periodic') {
return this.$t('falukant.politics.benefits.reputation_periodic', {
days: b.params?.intervalDays ?? '—',
gain: b.params?.gain ?? '—'
});
}
if (b.tr === 'appoint_politicians' && Array.isArray(b.params?.officeTrs)) {
const labels = this.formatPoliticsAppointOfficeLabels(b.params.officeTrs);
return this.$t('falukant.politics.benefits.appoint_politicians', { offices: labels });
}
if (b.tr === 'set_regional_tax') {
const sk = String(b.params?.scope || 'local');
const scopePath = `falukant.politics.benefits.tax_scope.${sk}`;
const st = this.$t(scopePath);
const scopeLabel = st !== scopePath ? st : sk;
return this.$t('falukant.politics.benefits.set_regional_tax', { scope: scopeLabel });
}
if (b.tr === 'free_lover_slots') {
return this.$t('falukant.politics.benefits.free_lover_slots', { count: b.params?.count ?? 1 });
}
if (b.tr === 'guard_protection') {
return this.$t('falukant.politics.benefits.guard_protection');
}
if (b.tr === 'court_immunity') {
return this.$t('falukant.politics.benefits.court_immunity');
}
if (b.tr === 'generic_benefit') {
return this.$t('falukant.politics.benefits.generic', { code: b.params?.code || '' });
}