- Introduced FalukantCharacterVisual component to display character portraits and 3D figures based on user settings. - Updated DirectorInfo, ChurchView, PoliticsView, and other components to utilize the new character visual component. - Added visual settings management for users, allowing selection between portrait styles and display modes (portraits, 3D, or both). - Implemented age rules for engagement and marriage in the backend, ensuring compliance with specified age limits. - Created a new settings view for Falukant to manage visual preferences. - Added new images for medieval character portraits. - Updated translations for new settings and features in multiple languages.
61 lines
2.0 KiB
JavaScript
61 lines
2.0 KiB
JavaScript
import apiClient from '@/utils/axios.js';
|
|
|
|
export const FALUKANT_VISUAL_DEFAULTS = Object.freeze({
|
|
portraitStyle: 'classic',
|
|
figureMode: 'both',
|
|
});
|
|
|
|
export function showFalukantPortraits(figureMode) {
|
|
return figureMode === 'portraits' || figureMode === 'both';
|
|
}
|
|
|
|
export function showFalukant3dFigures(figureMode) {
|
|
return figureMode === '3d' || figureMode === 'both';
|
|
}
|
|
|
|
export function resolveFalukantPortraitAtlas(genderRaw, portraitStyle) {
|
|
const gender = String(genderRaw || 'male').toLowerCase() === 'female' ? 'female' : 'male';
|
|
|
|
if (portraitStyle === 'medieval') {
|
|
// Falukant liefert hier noch keine Haarfarbe; bis dahin geschlechtsbasierter Atlas-Fallback.
|
|
return gender === 'female'
|
|
? '/images/falukant/avatar/female00-medieval.png'
|
|
: '/images/falukant/avatar/male02-medieval.png';
|
|
}
|
|
|
|
return `/images/falukant/avatar/${gender}.png`;
|
|
}
|
|
|
|
export async function loadFalukantVisualSettings(userId) {
|
|
if (!userId) {
|
|
return { ...FALUKANT_VISUAL_DEFAULTS };
|
|
}
|
|
|
|
try {
|
|
const { data } = await apiClient.post('/api/settings/filter', {
|
|
userid: userId,
|
|
type: 'falukant'
|
|
});
|
|
|
|
const values = { ...FALUKANT_VISUAL_DEFAULTS };
|
|
for (const setting of Array.isArray(data) ? data : []) {
|
|
const selected = Array.isArray(setting.options)
|
|
? setting.options.find((option) => String(option.id) === String(setting.value))
|
|
: null;
|
|
const normalizedValue = selected?.value || null;
|
|
|
|
if (setting.name === 'falukantPortraitStyle' && normalizedValue) {
|
|
values.portraitStyle = normalizedValue;
|
|
}
|
|
if (setting.name === 'falukantFigureMode' && normalizedValue) {
|
|
values.figureMode = normalizedValue;
|
|
}
|
|
}
|
|
|
|
return values;
|
|
} catch (error) {
|
|
console.error('Error loading Falukant visual settings:', error);
|
|
return { ...FALUKANT_VISUAL_DEFAULTS };
|
|
}
|
|
}
|