Add reputation attribute to FalukantCharacter model and update related services and views

- Introduced a new 'reputation' attribute in the FalukantCharacter model with a default value and validation.
- Updated FalukantService to include 'reputation' in character attributes for API responses.
- Enhanced ReputationView component to display current reputation and load it from the API.
- Added translations for reputation in both German and English locales.
This commit is contained in:
Torsten Schulz (local)
2025-12-20 23:00:31 +01:00
parent f9ea4715d7
commit 6cf8fa8a9c
6 changed files with 125 additions and 5 deletions

View File

@@ -742,7 +742,8 @@
"reputation": {
"title": "Reputation",
"overview": {
"title": "Übersicht"
"title": "Übersicht",
"current": "Deine aktuelle Reputation"
},
"party": {
"title": "Feste",

View File

@@ -198,6 +198,16 @@
"nobility": {
"cooldown": "You can only advance again on {date}."
},
"reputation": {
"title": "Reputation",
"overview": {
"title": "Overview",
"current": "Your current reputation"
},
"party": {
"title": "Parties"
}
},
"branchProduction": {
"storageAvailable": "Free storage"
},

View File

@@ -12,7 +12,10 @@
<div class="tab-content">
<div v-if="activeTab === 'overview'">
<p>Deine aktuelle Reputation: </p>
<p>
{{ $t('falukant.reputation.overview.current') }}:
<strong>{{ reputationDisplay }}</strong>
</p>
</div>
<div v-else-if="activeTab === 'party'">
@@ -169,7 +172,8 @@ export default {
selectedNobilityIds: [],
servantRatio: 50,
inProgressParties: [],
completedParties: []
completedParties: [],
reputation: null,
}
},
methods: {
@@ -198,6 +202,15 @@ export default {
return partyDate <= twentyFourHoursAgo;
});
},
async loadReputation() {
try {
const { data } = await apiClient.get('/api/falukant/info');
this.reputation = data?.character?.reputation ?? null;
} catch (e) {
console.error('Failed to load reputation', e);
this.reputation = null;
}
},
async loadNobilityTitles() {
this.nobilityTitles = await apiClient.get('/api/falukant/nobility/titels').then(r => r.data)
},
@@ -219,6 +232,10 @@ export default {
}
},
computed: {
reputationDisplay() {
if (this.reputation == null) return '—';
return String(this.reputation);
},
formattedCost() {
const type = this.partyTypes.find(t => t.id === this.newPartyTypeId) || {};
const music = this.musicTypes.find(m => m.id === this.musicId) || {};
@@ -245,6 +262,7 @@ export default {
await this.loadPartyTypes();
await this.loadNobilityTitles();
await this.loadParties();
await this.loadReputation();
}
}
</script>