Enhance NobilityView with new house position and condition formatting: Introduce methods to format house position labels and house condition descriptions based on numeric values. Update requirement translations to utilize these new methods for improved clarity and localization.
This commit is contained in:
@@ -921,6 +921,9 @@
|
||||
"overview": "Übersicht",
|
||||
"advance": "Erweitern"
|
||||
},
|
||||
"highestPoliticalOffice": "Höchstes politisches Amt",
|
||||
"highestOfficeAny": "Höchstes Amt insgesamt",
|
||||
"none": "keines",
|
||||
"nextTitle": "Nächster möglicher Titel",
|
||||
"requirement": {
|
||||
"money": "Vermögen mindestens {amount}",
|
||||
@@ -930,6 +933,8 @@
|
||||
"house_position": "Hausstand mindestens Stufe {amount}",
|
||||
"house_condition": "Hauszustand mindestens {amount}",
|
||||
"office_rank_any": "Höchstes politisches oder kirchliches Amt mindestens Rang {amount}",
|
||||
"office_rank_political": "Höchstes politisches Amt mindestens Rang {amount}",
|
||||
"lover_count_min": "Mindestens {amount} Liebhaber oder Mätressen",
|
||||
"lover_count_max": "Höchstens {amount} Liebhaber oder Mätressen"
|
||||
},
|
||||
"advance": {
|
||||
|
||||
@@ -331,6 +331,9 @@
|
||||
}
|
||||
},
|
||||
"nobility": {
|
||||
"highestPoliticalOffice": "Highest political office",
|
||||
"highestOfficeAny": "Highest office overall",
|
||||
"none": "none",
|
||||
"requirement": {
|
||||
"money": "Wealth at least {amount}",
|
||||
"cost": "Cost: {amount}",
|
||||
@@ -339,6 +342,8 @@
|
||||
"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}",
|
||||
"office_rank_political": "Highest political office at least rank {amount}",
|
||||
"lover_count_min": "At least {amount} lovers or favorites",
|
||||
"lover_count_max": "At most {amount} lovers or favorites"
|
||||
},
|
||||
"cooldown": "You can only advance again on {date}."
|
||||
|
||||
@@ -887,6 +887,9 @@
|
||||
"overview": "Resumen",
|
||||
"advance": "Ascender"
|
||||
},
|
||||
"highestPoliticalOffice": "Cargo político más alto",
|
||||
"highestOfficeAny": "Cargo más alto en total",
|
||||
"none": "ninguno",
|
||||
"nextTitle": "Siguiente título posible",
|
||||
"requirement": {
|
||||
"money": "Patrimonio mínimo {amount}",
|
||||
@@ -896,6 +899,8 @@
|
||||
"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}",
|
||||
"office_rank_political": "Cargo político más alto al menos rango {amount}",
|
||||
"lover_count_min": "Al menos {amount} amantes o favoritos",
|
||||
"lover_count_max": "Como máximo {amount} amantes o favoritos"
|
||||
},
|
||||
"advance": {
|
||||
|
||||
@@ -13,6 +13,14 @@
|
||||
{{ $t(`falukant.titles.${gender}.${current.labelTr}`) }}
|
||||
</strong>
|
||||
</p>
|
||||
<p>
|
||||
{{ $t('falukant.nobility.highestPoliticalOffice') }}:
|
||||
<strong>{{ formatOfficeInfo(highestPoliticalOffice, 'political') }}</strong>
|
||||
</p>
|
||||
<p>
|
||||
{{ $t('falukant.nobility.highestOfficeAny') }}:
|
||||
<strong>{{ formatOfficeInfo(highestOfficeAny, highestOfficeAny?.source) }}</strong>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -63,6 +71,8 @@
|
||||
],
|
||||
current: { labelTr: '', requirements: [], charactersWithNobleTitle: [] },
|
||||
next: { labelTr: '', requirements: [] },
|
||||
highestPoliticalOffice: null,
|
||||
highestOfficeAny: null,
|
||||
nextAdvanceAt: null,
|
||||
isAdvancing: false
|
||||
};
|
||||
@@ -111,6 +121,8 @@
|
||||
const { data } = await apiClient.get('/api/falukant/nobility');
|
||||
this.current = data.current || { labelTr: '', requirements: [], charactersWithNobleTitle: [] };
|
||||
this.next = data.next || { labelTr: '', requirements: [] };
|
||||
this.highestPoliticalOffice = data.highestPoliticalOffice || null;
|
||||
this.highestOfficeAny = data.highestOfficeAny || null;
|
||||
this.nextAdvanceAt = data.nextAdvanceAt || null;
|
||||
} catch (err) {
|
||||
console.error('Error loading nobility:', err);
|
||||
@@ -161,7 +173,7 @@
|
||||
: rawValue;
|
||||
const key = `falukant.nobility.requirement.${type}`;
|
||||
const translated = this.$t(key, { amount });
|
||||
if (translated && translated !== key) {
|
||||
if (translated && translated !== key && !['house_position', 'house_condition'].includes(type)) {
|
||||
return translated;
|
||||
}
|
||||
switch (type) {
|
||||
@@ -174,17 +186,54 @@
|
||||
case 'reputation':
|
||||
return `Beliebtheit mindestens ${amount}`;
|
||||
case 'house_position':
|
||||
return `Hausstand mindestens Stufe ${amount}`;
|
||||
return `Hausstand mindestens ${this.getHousePositionLabel(numericValue)}`;
|
||||
case 'house_condition':
|
||||
return `Hauszustand mindestens ${amount}`;
|
||||
return `Hauszustand mindestens ${this.formatHouseCondition(numericValue)}`;
|
||||
case 'office_rank_any':
|
||||
return `Höchstes politisches oder kirchliches Amt mindestens Rang ${amount}`;
|
||||
case 'office_rank_political':
|
||||
return `Höchstes politisches Amt mindestens Rang ${amount}`;
|
||||
case 'lover_count_min':
|
||||
return `Mindestens ${amount} Liebhaber oder Mätressen`;
|
||||
case 'lover_count_max':
|
||||
return `Höchstens ${amount} Liebhaber oder Mätressen`;
|
||||
default:
|
||||
return `${type}: ${amount}`;
|
||||
}
|
||||
},
|
||||
formatOfficeInfo(info, source) {
|
||||
if (!info?.name) {
|
||||
return this.$t('falukant.nobility.none');
|
||||
}
|
||||
const baseKey = source === 'church' ? 'falukant.church.offices' : 'falukant.politics.positions';
|
||||
const label = this.$te(`${baseKey}.${info.name}`) ? this.$t(`${baseKey}.${info.name}`) : info.name;
|
||||
return `${label} (Rang ${info.rank})`;
|
||||
},
|
||||
getHousePositionLabel(position) {
|
||||
const labels = {
|
||||
1: 'Unter der Brücke',
|
||||
2: 'eine Strohhütte',
|
||||
3: 'ein Holzhaus',
|
||||
4: 'ein Hinterhofzimmer',
|
||||
5: 'ein kleines Familienhaus',
|
||||
6: 'ein Stadthaus',
|
||||
7: 'eine Villa',
|
||||
8: 'ein Herrenhaus',
|
||||
9: 'ein Schloss'
|
||||
};
|
||||
return labels[position] || `Haus-Stufe ${position}`;
|
||||
},
|
||||
formatHouseCondition(value) {
|
||||
if (Number.isNaN(value)) {
|
||||
return value;
|
||||
}
|
||||
if (value >= 0.95) return 'nahezu makellos';
|
||||
if (value >= 0.9) return 'sehr gut';
|
||||
if (value >= 0.8) return 'gut';
|
||||
if (value >= 0.7) return 'ordentlich';
|
||||
if (value >= 0.6) return 'brauchbar';
|
||||
return `${Math.round(value * 100)} %`;
|
||||
},
|
||||
formatDate(isoString) {
|
||||
const d = new Date(isoString);
|
||||
const now = new Date();
|
||||
|
||||
Reference in New Issue
Block a user