feat(political-benefits): implement political powers and benefits system
All checks were successful
Deploy to production / deploy (push) Successful in 3m3s

- Added new political powers and benefits functionalities, including reputation ticks, tax jurisdiction management, and appointment capabilities.
- Introduced a new job for periodic reputation updates and created necessary database tables for tracking political benefits.
- Enhanced the FalukantController and services to support new endpoints for managing political powers and appointments.
- Updated localization files to reflect new features and improve user experience across multiple languages.
- Modified the UI to display new political powers and benefits, ensuring accurate representation in the PoliticsView.
This commit is contained in:
Torsten Schulz (local)
2026-04-02 16:00:29 +02:00
parent 5d06d97737
commit 56be4b76c0
19 changed files with 1572 additions and 2 deletions

View File

@@ -85,6 +85,7 @@ import {
KNOWLEDGE_PRICE_FLOOR,
calcRegionalSellPriceSync,
} from '../utils/falukant/falukantProductEconomy.js';
import { sumFreePoliticalLoverSlotsForCharacter } from './falukantPoliticalPowersService.js';
function calcAge(birthdate) {
const b = new Date(birthdate); b.setHours(0, 0);
@@ -3591,6 +3592,13 @@ class FalukantService extends BaseService {
state,
};
});
const politicalFreeLoverSlots = await sumFreePoliticalLoverSlotsForCharacter(character.id);
lovers.sort((a, b) => (a.relationshipId || 0) - (b.relationshipId || 0));
lovers.forEach((lover, idx) => {
const base = Number(lover.monthlyBaseCost || 0);
lover.politicalFreeMaintenance = idx < politicalFreeLoverSlots;
lover.monthlyCost = lover.politicalFreeMaintenance ? 0 : base;
});
const derivedHouseholdTension = this.calculateHouseholdTension({
lovers,
marriageSatisfaction,
@@ -3614,6 +3622,7 @@ class FalukantService extends BaseService {
householdTensionScore: householdTension.score,
householdTensionReasons: householdTension.reasons,
debtorsPrison: await this.getDebtorsPrisonStateForUser(user),
politicalFreeLoverSlots,
lovers,
deathPartners: relationships.filter(r => r.relationshipType === 'widowed'),
children: children.map(({ _createdAt, ...rest }) => rest),
@@ -7256,6 +7265,7 @@ ORDER BY r.id`,
const mapped = chars
.map(c => ({
characterId: c.id,
username: c.user?.user?.username || null,
firstname: c.definedFirstName?.name || null,
lastname: c.definedLastName?.name || null,