Add new requirements for nobility titles and enhance service logic: Introduce checks for reputation, house position, house condition, office rank, and lover count in the FalukantService. Update title requirements in the initialization script to include these new criteria. Enhance localization for requirements in English, German, and Spanish, ensuring accurate translations for new conditions.

This commit is contained in:
Torsten Schulz (local)
2026-03-23 10:31:32 +01:00
parent b3607849d2
commit 80d8caee88
8 changed files with 763 additions and 33 deletions

View File

@@ -925,7 +925,12 @@
"requirement": {
"money": "Vermögen mindestens {amount}",
"cost": "Kosten: {amount}",
"branches": "Mindestens {amount} Niederlassungen"
"branches": "Mindestens {amount} Niederlassungen",
"reputation": "Beliebtheit mindestens {amount}",
"house_position": "Hausstand mindestens Stufe {amount}",
"house_condition": "Hauszustand mindestens {amount}",
"office_rank_any": "Höchstes politisches oder kirchliches Amt mindestens Rang {amount}",
"lover_count_max": "Höchstens {amount} Liebhaber oder Mätressen"
},
"advance": {
"confirm": "Aufsteigen beantragen"

View File

@@ -331,6 +331,16 @@
}
},
"nobility": {
"requirement": {
"money": "Wealth at least {amount}",
"cost": "Cost: {amount}",
"branches": "At least {amount} branches",
"reputation": "Popularity at least {amount}",
"house_position": "House status at least level {amount}",
"house_condition": "House condition at least {amount}",
"office_rank_any": "Highest political or church office at least rank {amount}",
"lover_count_max": "At most {amount} lovers or favorites"
},
"cooldown": "You can only advance again on {date}."
},
"mood": {

View File

@@ -891,7 +891,12 @@
"requirement": {
"money": "Patrimonio mínimo {amount}",
"cost": "Coste: {amount}",
"branches": "Al menos {amount} sucursales"
"branches": "Al menos {amount} sucursales",
"reputation": "Popularidad mínima {amount}",
"house_position": "Casa al menos nivel {amount}",
"house_condition": "Estado de la casa al menos {amount}",
"office_rank_any": "Cargo político o eclesiástico más alto al menos rango {amount}",
"lover_count_max": "Como máximo {amount} amantes o favoritos"
},
"advance": {
"confirm": "Solicitar ascenso"

View File

@@ -25,7 +25,7 @@
</p>
<ul class="prerequisites" v-if="next.requirements && next.requirements.length > 0">
<li v-for="req in next.requirements" :key="req.titleId">
{{ $t(`falukant.nobility.requirement.${req.requirementType}`, { amount: formatCost(req.requirementValue) }) }}
{{ formatRequirement(req.requirementType, req.requirementValue) }}
</li>
</ul>
<button v-if="canAdvance" @click="applyAdvance" class="button" :disabled="isAdvancing">
@@ -133,12 +133,7 @@
this.$root.$refs.errorDialog?.open(retryStr ? `${msg}${this.$t('falukant.nobility.cooldown', { date: retryStr })}` : msg);
} else if (resp.data?.message === 'nobilityRequirements') {
const unmet = resp.data?.unmet || [];
const items = unmet.map(u => {
if (u.type === 'money') return this.$t('falukant.nobility.requirement.money', { amount: this.formatCost(u.required) });
if (u.type === 'cost') return this.$t('falukant.nobility.requirement.cost', { amount: this.formatCost(u.required) });
if (u.type === 'branches') return this.$t('falukant.nobility.requirement.branches', { amount: u.required });
return `${u.type}: ${u.required}`;
}).join('\n');
const items = unmet.map(u => this.formatRequirement(u.type, u.required)).join('\n');
const base = this.$t('falukant.nobility.errors.unmet');
this.$root.$refs.errorDialog?.open(`${base}\n${items}`);
} else {
@@ -159,6 +154,37 @@
formatCost(val) {
return new Intl.NumberFormat(navigator.language, { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(val);
},
formatRequirement(type, rawValue) {
const numericValue = Number(rawValue);
const amount = ['money', 'cost'].includes(type)
? this.formatCost(numericValue)
: rawValue;
const key = `falukant.nobility.requirement.${type}`;
const translated = this.$t(key, { amount });
if (translated && translated !== key) {
return translated;
}
switch (type) {
case 'money':
return `Vermögen mindestens ${amount}`;
case 'cost':
return `Kosten: ${amount}`;
case 'branches':
return `Mindestens ${amount} Niederlassungen`;
case 'reputation':
return `Beliebtheit mindestens ${amount}`;
case 'house_position':
return `Hausstand mindestens Stufe ${amount}`;
case 'house_condition':
return `Hauszustand mindestens ${amount}`;
case 'office_rank_any':
return `Höchstes politisches oder kirchliches Amt mindestens Rang ${amount}`;
case 'lover_count_max':
return `Höchstens ${amount} Liebhaber oder Mätressen`;
default:
return `${type}: ${amount}`;
}
},
formatDate(isoString) {
const d = new Date(isoString);
const now = new Date();