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

@@ -438,6 +438,18 @@
"daily_salary": "Adlaw-adlaw nga suhol (usa ra kada adlaw): mga {amount}",
"tax_exemption": "Way buhis: {regions}",
"tax_exemption_all": "Way buhis: tanang lebel sa rehiyon",
"reputation_periodic": "+{gain} reputasyon matag {days} ka adlaw (benepisyo sa opisina)",
"appoint_politicians": "Katungod sa pagtudlo: {offices}",
"set_regional_tax": "Maka-set sa mga rate sa buhis ({scope})",
"tax_scope": {
"local": "lokal sa hurisdiksyon",
"shire": "lebel sa shire",
"duchy": "lebel sa duchy",
"national": "tibuok nasud"
},
"free_lover_slots": "{count} dugang relasyon nga walay bulan nga gasto",
"guard_protection": "Opisyal nga panalipod / escort",
"court_immunity": "Limitado nga immune sa korte sa opisina",
"generic": "Benepisyo ({code})"
},
"regionLevels": {

View File

@@ -1357,6 +1357,18 @@
"daily_salary": "Tagesamtshonorar (einmal pro Tag): ca. {amount}",
"tax_exemption": "Steuerbefreiung: {regions}",
"tax_exemption_all": "Steuerbefreiung: alle Regionsebenen",
"reputation_periodic": "+{gain} Ansehen alle {days} Tage (Amtsbonus)",
"appoint_politicians": "Ernennungsrecht für folgende Ämter: {offices}",
"set_regional_tax": "Darf Steuersätze festlegen ({scope})",
"tax_scope": {
"local": "lokal im Amtsgebiet",
"shire": "auf Grafschaftsebene",
"duchy": "auf Herzogtumsebene",
"national": "reichsweit"
},
"free_lover_slots": "{count} zusätzliche Liebschaft(en) ohne monatlichen Unterhalt",
"guard_protection": "Amtsschutz / Eskorte",
"court_immunity": "Eingeschränkte gerichtliche Immunität im Amtsbereich",
"generic": "Vorteil ({code})"
},
"regionLevels": {

View File

@@ -578,6 +578,18 @@
"daily_salary": "Daily office stipend (once per day): about {amount}",
"tax_exemption": "Tax exemption: {regions}",
"tax_exemption_all": "Tax exemption: all regional levels",
"reputation_periodic": "+{gain} reputation every {days} days (office bonus)",
"appoint_politicians": "Power to appoint: {offices}",
"set_regional_tax": "May set tax rates ({scope})",
"tax_scope": {
"local": "locally in jurisdiction",
"shire": "shire level",
"duchy": "duchy level",
"national": "nationwide"
},
"free_lover_slots": "{count} additional affair(s) with no monthly upkeep",
"guard_protection": "Official guard / escort",
"court_immunity": "Limited judicial immunity in office matters",
"generic": "Benefit ({code})"
},
"regionLevels": {

View File

@@ -1265,6 +1265,18 @@
"daily_salary": "Estipendio diario (una vez al día): unos {amount}",
"tax_exemption": "Exención fiscal: {regions}",
"tax_exemption_all": "Exención fiscal: todos los niveles regionales",
"reputation_periodic": "+{gain} reputación cada {days} días (bono de cargo)",
"appoint_politicians": "Derecho a nombrar: {offices}",
"set_regional_tax": "Puede fijar tipos impositivos ({scope})",
"tax_scope": {
"local": "localmente en la jurisdicción",
"shire": "nivel de condado (shire)",
"duchy": "nivel de ducado",
"national": "ámbito nacional"
},
"free_lover_slots": "{count} relación(es) adicional(es) sin mantenimiento mensual",
"guard_protection": "Protección oficial / escolta",
"court_immunity": "Inmunidad judicial limitada en asuntos del cargo",
"generic": "Ventaja ({code})"
},
"regionLevels": {

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 || '' });
}