Some fixes and additions
This commit is contained in:
@@ -43,12 +43,13 @@
|
||||
</tr>
|
||||
<tr v-if="relationships[0].relationshipType === 'engaged'" colspan="2">
|
||||
<button @click="jumpToPartyForm">{{ $t('falukant.family.spouse.jumpToPartyForm')
|
||||
}}</button>
|
||||
}}</button>
|
||||
</tr>
|
||||
</table>
|
||||
<ul>
|
||||
<li v-for="characteristic in relationships[0].character2.characterTrait"
|
||||
:key="characteristic.id">{{ $t(`falukant.character.${characteristic.tr}`) }}</li>
|
||||
<li v-for="trait in relationships[0].character2.traits" :key="trait.id">
|
||||
{{ $t(`falukant.character.${trait.tr}`) }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div v-if="relationships[0].relationshipType === 'wooing'">
|
||||
@@ -64,16 +65,18 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="gift in gifts" :key="gift.id">
|
||||
<td><input type="radio" name="gift" :value="gift.id" v-model="selectedGiftId"></td>
|
||||
<td>
|
||||
<input type="radio" name="gift" :value="gift.id" v-model="selectedGiftId" />
|
||||
</td>
|
||||
<td>{{ $t(`falukant.gifts.${gift.name}`) }}</td>
|
||||
<td>{{ $t(`falukant.family.spouse.giftAffect.${getEffect(gift)}`) }}</td>
|
||||
<td>{{ getEffect(gift) }}</td>
|
||||
<td>{{ formatCost(gift.cost) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div>
|
||||
<button @click="sendGift" class="button">{{ $t('falukant.family.spouse.wooing.sendGift')
|
||||
}}</button>
|
||||
}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -93,7 +96,7 @@
|
||||
v-model="selectedProposalId"></td>
|
||||
<td>{{
|
||||
$t(`falukant.titles.${proposal.proposedCharacterGender}.${proposal.proposedCharacterNobleTitle}`)
|
||||
}} {{ proposal.proposedCharacterName }}</td>
|
||||
}} {{ proposal.proposedCharacterName }}</td>
|
||||
<td>{{ proposal.proposedCharacterAge }}</td>
|
||||
<td>{{ formatCost(proposal.cost) }}</td>
|
||||
</tr>
|
||||
@@ -123,7 +126,8 @@
|
||||
{{ child.name }}
|
||||
</td>
|
||||
<td v-else>
|
||||
<button @click="jumpToChurchForm">{{ $t('falukant.family.children.baptism') }}</button>
|
||||
<button @click="jumpToChurchForm">{{ $t('falukant.family.children.baptism')
|
||||
}}</button>
|
||||
</td>
|
||||
<td>{{ child.age }}</td>
|
||||
<td>
|
||||
@@ -308,12 +312,38 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
handleDaemonMessage() {
|
||||
handleDaemonMessage(event) {
|
||||
if (event.data === 'ping') {
|
||||
return;
|
||||
}
|
||||
const message = JSON.parse(event.data);
|
||||
if (message.event === 'children_update') {
|
||||
this.loadFamilyData();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getEffect(gift) {
|
||||
// aktueller Partner
|
||||
const partner = this.relationships[0].character2;
|
||||
// seine aktuelle Mood-ID
|
||||
const moodId = partner.mood?.id ?? partner.mood_id;
|
||||
|
||||
// 1) Mood-Eintrag finden
|
||||
const moodEntry = gift.moodsAffects.find(ma => ma.mood_id === moodId);
|
||||
const moodValue = moodEntry ? moodEntry.suitability : 0;
|
||||
|
||||
// 2) Trait-Einträge matchen
|
||||
let highestTraitValue = 0;
|
||||
for (const trait of partner.traits) {
|
||||
const charEntry = gift.charactersAffects.find(ca => ca.trait_id === trait.id);
|
||||
if (charEntry && charEntry.suitability > highestTraitValue) {
|
||||
highestTraitValue = charEntry.suitability;
|
||||
}
|
||||
}
|
||||
|
||||
// Durchschnitt, gerundet
|
||||
return Math.round((moodValue + highestTraitValue) / 2);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user