Add raid transport feature and related updates: Introduce new raid transport functionality in FalukantService and FalukantController, including methods for retrieving raid transport regions and handling guard counts. Update frontend components to support guard count input and display related costs. Enhance localization files to include new terms for raid transport and associated metrics in English, German, and Spanish.
This commit is contained in:
@@ -147,6 +147,11 @@
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
{{ $t('falukant.branch.transport.guardCount') }}
|
||||
<input v-model.number="emptyTransportForm.guardCount" type="number" min="0" max="20" @input="loadEmptyTransportRoute">
|
||||
</label>
|
||||
|
||||
<div v-if="emptyTransportForm.costLabel" class="transport-cost">
|
||||
{{ $t('falukant.branch.director.emptyTransport.cost', { cost: emptyTransportForm.costLabel }) }}
|
||||
</div>
|
||||
@@ -200,6 +205,7 @@ export default {
|
||||
emptyTransportForm: {
|
||||
vehicleTypeId: null,
|
||||
targetBranchId: null,
|
||||
guardCount: 0,
|
||||
distance: null,
|
||||
durationHours: null,
|
||||
eta: null,
|
||||
@@ -390,8 +396,8 @@ export default {
|
||||
this.emptyTransportForm.routeNames = (data.regions || []).map(r => r.name);
|
||||
}
|
||||
// Kosten für leeren Transport: 0.1
|
||||
this.emptyTransportForm.cost = 0.1;
|
||||
this.emptyTransportForm.costLabel = this.formatMoney(0.1);
|
||||
this.emptyTransportForm.cost = 0.1 + ((this.emptyTransportForm.guardCount || 0) * 4);
|
||||
this.emptyTransportForm.costLabel = this.formatMoney(this.emptyTransportForm.cost);
|
||||
} catch (error) {
|
||||
console.error('Error loading transport route:', error);
|
||||
this.emptyTransportForm.distance = null;
|
||||
@@ -426,11 +432,13 @@ export default {
|
||||
productId: null,
|
||||
quantity: 0,
|
||||
targetBranchId: this.emptyTransportForm.targetBranchId,
|
||||
guardCount: this.emptyTransportForm.guardCount || 0,
|
||||
});
|
||||
// Formular zurücksetzen
|
||||
this.emptyTransportForm = {
|
||||
vehicleTypeId: null,
|
||||
targetBranchId: null,
|
||||
guardCount: 0,
|
||||
distance: null,
|
||||
durationHours: null,
|
||||
eta: null,
|
||||
|
||||
@@ -90,6 +90,17 @@
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
{{ $t('falukant.branch.transport.guardCount') }}
|
||||
<input
|
||||
type="number"
|
||||
v-model.number="transportForm.guardCount"
|
||||
min="0"
|
||||
max="20"
|
||||
@input="recalcCost"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<div v-if="transportForm.costLabel">
|
||||
{{ $t('falukant.branch.sale.transportCost', { cost: transportForm.costLabel }) }}
|
||||
</div>
|
||||
@@ -138,6 +149,7 @@
|
||||
<th>{{ $t('falukant.branch.sale.runningEta') }}</th>
|
||||
<th>{{ $t('falukant.branch.sale.runningRemaining') }}</th>
|
||||
<th>{{ $t('falukant.branch.sale.runningVehicleCount') }}</th>
|
||||
<th>{{ $t('falukant.branch.sale.runningGuards') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -164,6 +176,7 @@
|
||||
<td>{{ formatEta({ eta: group.eta }) }}</td>
|
||||
<td>{{ formatRemaining({ eta: group.eta }) }}</td>
|
||||
<td>{{ group.vehicleCount }}</td>
|
||||
<td>{{ group.totalGuards || 0 }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -189,6 +202,7 @@
|
||||
vehicleTypeId: null,
|
||||
targetBranchId: null,
|
||||
quantity: 0,
|
||||
guardCount: 0,
|
||||
maxQuantity: 0,
|
||||
distance: null,
|
||||
durationHours: null,
|
||||
@@ -232,12 +246,14 @@
|
||||
eta: transport.eta,
|
||||
vehicleCount: 0,
|
||||
totalQuantity: 0,
|
||||
totalGuards: 0,
|
||||
transports: [],
|
||||
});
|
||||
}
|
||||
|
||||
const group = groups.get(key);
|
||||
group.vehicleCount += 1;
|
||||
group.totalGuards += transport.guardCount || 0;
|
||||
if (transport.product && transport.size > 0) {
|
||||
group.totalQuantity += transport.size || 0;
|
||||
}
|
||||
@@ -414,7 +430,8 @@
|
||||
}
|
||||
const unitValue = item.product.sellCost || 0;
|
||||
const totalValue = unitValue * qty;
|
||||
const cost = Math.max(0.1, totalValue * 0.01);
|
||||
const guardCost = (this.transportForm.guardCount || 0) * 4;
|
||||
const cost = Math.max(0.1, totalValue * 0.01) + guardCost;
|
||||
this.transportForm.cost = cost;
|
||||
this.transportForm.costLabel = this.formatMoney(cost);
|
||||
},
|
||||
@@ -500,6 +517,7 @@
|
||||
productId: source.productId,
|
||||
quantity: this.transportForm.quantity,
|
||||
targetBranchId: this.transportForm.targetBranchId,
|
||||
guardCount: this.transportForm.guardCount || 0,
|
||||
});
|
||||
await this.loadInventory();
|
||||
await this.loadTransports();
|
||||
|
||||
@@ -334,6 +334,7 @@
|
||||
"runningEta": "Ankunft",
|
||||
"runningRemaining": "Restzeit",
|
||||
"runningVehicleCount": "Fahrzeuge",
|
||||
"runningGuards": "Wachen",
|
||||
"runningDirectionOut": "Ausgehend",
|
||||
"runningDirectionIn": "Eingehend"
|
||||
},
|
||||
@@ -408,6 +409,8 @@
|
||||
"transport": {
|
||||
"title": "Transportmittel",
|
||||
"placeholder": "Hier kannst du Transportmittel für deine Region kaufen oder bauen.",
|
||||
"guardCount": "Wachen",
|
||||
"guardHint": "Zusatzkosten für Wachen: {cost}",
|
||||
"vehicleType": "Transportmittel",
|
||||
"mode": "Art",
|
||||
"modeBuy": "Kaufen (sofort verfügbar)",
|
||||
@@ -1335,7 +1338,17 @@
|
||||
"victimPlaceholder": "Benutzername eingeben",
|
||||
"sabotageTarget": "Sabotageziel",
|
||||
"corruptGoal": "Ziel der Korruption",
|
||||
"affairGoal": "Ziel der Untersuchung"
|
||||
"affairGoal": "Ziel der Untersuchung",
|
||||
"raidRegion": "Überfallregion",
|
||||
"raidRegionPlaceholder": "Region wählen",
|
||||
"bandSize": "Bandengröße",
|
||||
"raidSummary": "Bande ({bandSize}) in {region}",
|
||||
"attempts": "Versuche",
|
||||
"successes": "Erfolge",
|
||||
"lastOutcome": "Letztes Ergebnis",
|
||||
"raidResultTitle": "Letzter Überfall",
|
||||
"lastTargetTransport": "Letzter Zieltransport",
|
||||
"loot": "Beute"
|
||||
},
|
||||
"attacks": {
|
||||
"target": "Angreifer",
|
||||
@@ -1349,7 +1362,8 @@
|
||||
"sabotage": "Sabotage",
|
||||
"corrupt_politician": "Korruption",
|
||||
"rob": "Raub",
|
||||
"investigate_affair": "Liebschaft untersuchen"
|
||||
"investigate_affair": "Liebschaft untersuchen",
|
||||
"raid_transport": "Überfälle auf Transporte"
|
||||
},
|
||||
"targets": {
|
||||
"house": "Wohnhaus",
|
||||
@@ -1366,6 +1380,11 @@
|
||||
"pending": "Ausstehend",
|
||||
"resolved": "Abgeschlossen",
|
||||
"failed": "Gescheitert"
|
||||
},
|
||||
"raidOutcomes": {
|
||||
"repelled": "Abgewehrt",
|
||||
"partial_success": "Teilweise erfolgreich",
|
||||
"major_success": "Großer Erfolg"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +294,26 @@
|
||||
},
|
||||
"director": {
|
||||
"income": "Income",
|
||||
"incomeUpdated": "Salary has been successfully updated."
|
||||
"incomeUpdated": "Salary has been successfully updated.",
|
||||
"starttransport": "May start transports",
|
||||
"emptyTransport": {
|
||||
"title": "Transport without products",
|
||||
"description": "Move vehicles from this branch to another to use them better.",
|
||||
"vehicleType": "Vehicle type",
|
||||
"selectVehicle": "Select vehicle type",
|
||||
"targetBranch": "Target branch",
|
||||
"selectTarget": "Select target branch",
|
||||
"cost": "Cost: {cost}",
|
||||
"duration": "Duration: {duration}",
|
||||
"arrival": "Arrival: {datetime}",
|
||||
"route": "Route",
|
||||
"create": "Start transport",
|
||||
"success": "Transport started successfully.",
|
||||
"error": "Error starting the transport."
|
||||
}
|
||||
},
|
||||
"sale": {
|
||||
"runningGuards": "Guards"
|
||||
},
|
||||
"production": {
|
||||
"title": "Production",
|
||||
@@ -328,6 +347,10 @@
|
||||
"raft": "Raft",
|
||||
"sailing_ship": "Sailing ship"
|
||||
},
|
||||
"transport": {
|
||||
"guardCount": "Guards",
|
||||
"guardHint": "Additional cost for guards: {cost}"
|
||||
},
|
||||
"tabs": {
|
||||
"director": "Director",
|
||||
"inventory": "Inventory",
|
||||
@@ -900,7 +923,17 @@
|
||||
"victimPlaceholder": "Enter username",
|
||||
"sabotageTarget": "Sabotage target",
|
||||
"corruptGoal": "Corruption goal",
|
||||
"affairGoal": "Investigation goal"
|
||||
"affairGoal": "Investigation goal",
|
||||
"raidRegion": "Raid region",
|
||||
"raidRegionPlaceholder": "Select region",
|
||||
"bandSize": "Band size",
|
||||
"raidSummary": "Gang ({bandSize}) in {region}",
|
||||
"attempts": "Attempts",
|
||||
"successes": "Successes",
|
||||
"lastOutcome": "Last outcome",
|
||||
"raidResultTitle": "Latest raid",
|
||||
"lastTargetTransport": "Latest target transport",
|
||||
"loot": "Loot"
|
||||
},
|
||||
"attacks": {
|
||||
"target": "Attacker",
|
||||
@@ -914,7 +947,8 @@
|
||||
"sabotage": "Sabotage",
|
||||
"corrupt_politician": "Corruption",
|
||||
"rob": "Robbery",
|
||||
"investigate_affair": "Investigate affair"
|
||||
"investigate_affair": "Investigate affair",
|
||||
"raid_transport": "Raid transports"
|
||||
},
|
||||
"targets": {
|
||||
"house": "House",
|
||||
@@ -931,6 +965,11 @@
|
||||
"pending": "Pending",
|
||||
"resolved": "Resolved",
|
||||
"failed": "Failed"
|
||||
},
|
||||
"raidOutcomes": {
|
||||
"repelled": "Repelled",
|
||||
"partial_success": "Partial success",
|
||||
"major_success": "Major success"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,6 +322,7 @@
|
||||
"runningEta": "Llegada",
|
||||
"runningRemaining": "Tiempo restante",
|
||||
"runningVehicleCount": "Vehículos",
|
||||
"runningGuards": "Guardias",
|
||||
"runningDirectionOut": "Salida",
|
||||
"runningDirectionIn": "Entrada"
|
||||
},
|
||||
@@ -393,6 +394,8 @@
|
||||
"transport": {
|
||||
"title": "Transporte",
|
||||
"placeholder": "Aquí puedes comprar o construir medios de transporte para tu región.",
|
||||
"guardCount": "Guardias",
|
||||
"guardHint": "Coste adicional por guardias: {cost}",
|
||||
"vehicleType": "Medio de transporte",
|
||||
"mode": "Tipo",
|
||||
"modeBuy": "Comprar (disponible de inmediato)",
|
||||
@@ -1259,7 +1262,17 @@
|
||||
"victimPlaceholder": "Introduce el nombre de usuario",
|
||||
"sabotageTarget": "Objetivo del sabotaje",
|
||||
"corruptGoal": "Objetivo de la corrupción",
|
||||
"affairGoal": "Objetivo de la investigación"
|
||||
"affairGoal": "Objetivo de la investigación",
|
||||
"raidRegion": "Región de emboscada",
|
||||
"raidRegionPlaceholder": "Seleccionar región",
|
||||
"bandSize": "Tamaño de la banda",
|
||||
"raidSummary": "Banda ({bandSize}) en {region}",
|
||||
"attempts": "Intentos",
|
||||
"successes": "Éxitos",
|
||||
"lastOutcome": "Último resultado",
|
||||
"raidResultTitle": "Último asalto",
|
||||
"lastTargetTransport": "Último transporte objetivo",
|
||||
"loot": "Botín"
|
||||
},
|
||||
"attacks": {
|
||||
"target": "Atacante",
|
||||
@@ -1273,7 +1286,8 @@
|
||||
"sabotage": "Sabotaje",
|
||||
"corrupt_politician": "Corrupción",
|
||||
"rob": "Robo",
|
||||
"investigate_affair": "Investigar relación"
|
||||
"investigate_affair": "Investigar relación",
|
||||
"raid_transport": "Asaltos a transportes"
|
||||
},
|
||||
"targets": {
|
||||
"house": "Vivienda",
|
||||
@@ -1290,6 +1304,11 @@
|
||||
"pending": "Pendiente",
|
||||
"resolved": "Resuelto",
|
||||
"failed": "Fallido"
|
||||
},
|
||||
"raidOutcomes": {
|
||||
"repelled": "Rechazado",
|
||||
"partial_success": "Éxito parcial",
|
||||
"major_success": "Gran éxito"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,6 +258,13 @@
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
{{ $t('falukant.branch.transport.guardCount') }}
|
||||
<input v-model.number="sendVehicleDialog.guardCount" type="number" min="0" max="20" />
|
||||
</label>
|
||||
<p class="transport-guards-hint">
|
||||
{{ $t('falukant.branch.transport.guardHint', { cost: formatMoney((sendVehicleDialog.guardCount || 0) * 4) }) }}
|
||||
</p>
|
||||
<div class="modal-buttons">
|
||||
<button @click="sendVehicles" :disabled="!sendVehicleDialog.targetBranchId">
|
||||
{{ $t('falukant.branch.transport.send') }}
|
||||
@@ -407,6 +414,7 @@ export default {
|
||||
vehicleTypeId: null,
|
||||
targetBranchId: null,
|
||||
success: false,
|
||||
guardCount: 0,
|
||||
},
|
||||
repairVehicleDialog: {
|
||||
show: false,
|
||||
@@ -991,6 +999,7 @@ export default {
|
||||
vehicleTypeId: null,
|
||||
targetBranchId: null,
|
||||
success: false,
|
||||
guardCount: 0,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -1002,6 +1011,7 @@ export default {
|
||||
vehicleTypeId: vehicleTypeId,
|
||||
targetBranchId: null,
|
||||
success: false,
|
||||
guardCount: 0,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -1013,6 +1023,7 @@ export default {
|
||||
vehicleTypeId: null,
|
||||
targetBranchId: null,
|
||||
success: false,
|
||||
guardCount: 0,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -1038,6 +1049,7 @@ export default {
|
||||
targetBranchId: this.sendVehicleDialog.targetBranchId,
|
||||
productId: null,
|
||||
quantity: 0,
|
||||
guardCount: this.sendVehicleDialog.guardCount || 0,
|
||||
};
|
||||
|
||||
if (this.sendVehicleDialog.vehicleIds && this.sendVehicleDialog.vehicleIds.length > 0) {
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
<label class="form-label">
|
||||
{{ $t('falukant.underground.activities.victim') }}
|
||||
<input v-model="newVictimUsername" @input="onVictimInput" type="text" class="form-control"
|
||||
:placeholder="$t('falukant.underground.activities.victimPlaceholder')" />
|
||||
:placeholder="$t('falukant.underground.activities.victimPlaceholder')"
|
||||
:disabled="selectedType && selectedType.tr === 'raid_transport'" />
|
||||
</label>
|
||||
<div v-if="victimSuggestions.length" class="suggestions">
|
||||
<ul>
|
||||
@@ -92,6 +93,27 @@
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label v-if="selectedType && selectedType.tr === 'raid_transport'" class="form-label">
|
||||
{{ $t('falukant.underground.activities.raidRegion') }}
|
||||
<select v-model.number="newRaidRegionId" class="form-control">
|
||||
<option :value="null" disabled>{{ $t('falukant.underground.activities.raidRegionPlaceholder') }}</option>
|
||||
<option v-for="region in raidRegions" :key="region.id" :value="region.id">
|
||||
{{ region.name }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label v-if="selectedType && selectedType.tr === 'raid_transport'" class="form-label">
|
||||
{{ $t('falukant.underground.activities.bandSize') }}
|
||||
<input
|
||||
v-model.number="newRaidBandSize"
|
||||
type="number"
|
||||
min="1"
|
||||
max="20"
|
||||
class="form-control"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<button class="btn-create-activity" :disabled="!canCreate" @click="createActivity">
|
||||
{{ $t('falukant.underground.activities.create') }}
|
||||
</button>
|
||||
@@ -136,6 +158,12 @@
|
||||
<template v-else-if="act.type === 'investigate_affair'">
|
||||
{{ $t(`falukant.underground.goals.${act.goal}`) }}
|
||||
</template>
|
||||
<template v-else-if="act.type === 'raid_transport'">
|
||||
{{ $t('falukant.underground.activities.raidSummary', {
|
||||
region: act.regionName || '—',
|
||||
bandSize: act.additionalInfo?.bandSize || 0
|
||||
}) }}
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<template v-if="act.type === 'investigate_affair' && hasAffairDetails(act)">
|
||||
@@ -180,6 +208,50 @@
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-if="act.type === 'raid_transport'">
|
||||
<div
|
||||
v-if="act.additionalInfo?.lastOutcome || act.additionalInfo?.lastTargetTransportId || hasLootDetails(act)"
|
||||
class="activity-details__block"
|
||||
>
|
||||
<div class="activity-details__label">
|
||||
{{ $t('falukant.underground.activities.raidResultTitle') }}
|
||||
</div>
|
||||
<div class="activity-details__metrics">
|
||||
<span v-if="act.additionalInfo?.lastOutcome" class="activity-metric">
|
||||
{{ $t('falukant.underground.activities.lastOutcome') }}:
|
||||
{{ $t(`falukant.underground.raidOutcomes.${act.additionalInfo.lastOutcome}`) }}
|
||||
</span>
|
||||
<span v-if="act.additionalInfo?.lastTargetTransportId" class="activity-metric">
|
||||
{{ $t('falukant.underground.activities.lastTargetTransport') }}:
|
||||
#{{ act.additionalInfo.lastTargetTransportId }}
|
||||
</span>
|
||||
</div>
|
||||
<ul v-if="getLootDetails(act).length" class="activity-details__list">
|
||||
<li v-for="entry in getLootDetails(act)" :key="entry">
|
||||
{{ entry }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="activity-details__block activity-details__metrics">
|
||||
<span class="activity-metric">
|
||||
{{ $t('falukant.underground.activities.bandSize') }}:
|
||||
{{ act.additionalInfo?.bandSize || 0 }}
|
||||
</span>
|
||||
<span v-if="hasNumericValue(act.additionalInfo?.attempts)" class="activity-metric">
|
||||
{{ $t('falukant.underground.activities.attempts') }}:
|
||||
{{ act.additionalInfo.attempts }}
|
||||
</span>
|
||||
<span v-if="hasNumericValue(act.additionalInfo?.successes)" class="activity-metric">
|
||||
{{ $t('falukant.underground.activities.successes') }}:
|
||||
{{ act.additionalInfo.successes }}
|
||||
</span>
|
||||
<span v-if="act.additionalInfo?.lastOutcome" class="activity-metric">
|
||||
{{ $t('falukant.underground.activities.lastOutcome') }}:
|
||||
{{ $t(`falukant.underground.raidOutcomes.${act.additionalInfo.lastOutcome}`) }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -250,7 +322,10 @@ export default {
|
||||
newPoliticalTargets: [],
|
||||
newSabotageTarget: 'house',
|
||||
newCorruptGoal: 'elect',
|
||||
newAffairGoal: 'expose'
|
||||
newAffairGoal: 'expose',
|
||||
raidRegions: [],
|
||||
newRaidRegionId: null,
|
||||
newRaidBandSize: 3
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -261,6 +336,9 @@ export default {
|
||||
},
|
||||
canCreate() {
|
||||
if (!this.newActivityTypeId) return false;
|
||||
if (this.selectedType?.tr === 'raid_transport') {
|
||||
return !!this.newRaidRegionId && !!this.newRaidBandSize;
|
||||
}
|
||||
const hasUser = this.newVictimUsername.trim().length > 0;
|
||||
const hasPol = this.newPoliticalTargets.length > 0;
|
||||
if (!hasUser && !hasPol) return false;
|
||||
@@ -284,6 +362,7 @@ export default {
|
||||
},
|
||||
async mounted() {
|
||||
await this.loadUndergroundTypes();
|
||||
await this.loadRaidRegions();
|
||||
if (this.undergroundTypes.length) {
|
||||
this.newActivityTypeId = this.undergroundTypes[0].id;
|
||||
}
|
||||
@@ -343,6 +422,11 @@ export default {
|
||||
if (this.selectedType.tr === 'investigate_affair') {
|
||||
payload.goal = this.newAffairGoal;
|
||||
}
|
||||
if (this.selectedType.tr === 'raid_transport') {
|
||||
payload.victimUsername = null;
|
||||
payload.regionId = this.newRaidRegionId;
|
||||
payload.bandSize = this.newRaidBandSize;
|
||||
}
|
||||
try {
|
||||
await apiClient.post(
|
||||
'/api/falukant/underground/activities',
|
||||
@@ -353,6 +437,8 @@ export default {
|
||||
this.newSabotageTarget = 'house';
|
||||
this.newCorruptGoal = 'elect';
|
||||
this.newAffairGoal = 'expose';
|
||||
this.newRaidRegionId = null;
|
||||
this.newRaidBandSize = 3;
|
||||
await this.loadActivities();
|
||||
} catch (err) {
|
||||
console.error('Error creating activity', err);
|
||||
@@ -366,6 +452,11 @@ export default {
|
||||
this.undergroundTypes = data;
|
||||
},
|
||||
|
||||
async loadRaidRegions() {
|
||||
const { data } = await apiClient.get('/api/falukant/underground/raid-regions');
|
||||
this.raidRegions = Array.isArray(data) ? data : [];
|
||||
},
|
||||
|
||||
async loadActivities() {
|
||||
this.loading.activities = true;
|
||||
try {
|
||||
@@ -407,6 +498,35 @@ export default {
|
||||
}).format(v);
|
||||
},
|
||||
|
||||
hasLootDetails(activity) {
|
||||
return this.getLootDetails(activity).length > 0;
|
||||
},
|
||||
|
||||
getLootDetails(activity) {
|
||||
const loot = activity?.additionalInfo?.lastLoot;
|
||||
if (!loot) {
|
||||
return [];
|
||||
}
|
||||
if (Array.isArray(loot)) {
|
||||
return loot
|
||||
.map((entry) => {
|
||||
if (!entry) return null;
|
||||
if (typeof entry === 'string') return entry;
|
||||
if (typeof entry === 'object') {
|
||||
const name = entry.productName || entry.product || entry.label || this.$t('falukant.underground.activities.loot');
|
||||
const amount = entry.amount ?? entry.quantity ?? entry.count ?? null;
|
||||
return amount != null ? `${name}: ${amount}` : String(name);
|
||||
}
|
||||
return String(entry);
|
||||
})
|
||||
.filter(Boolean);
|
||||
}
|
||||
if (typeof loot === 'object') {
|
||||
return Object.entries(loot).map(([key, value]) => `${key}: ${value}`);
|
||||
}
|
||||
return [String(loot)];
|
||||
},
|
||||
|
||||
hasNumericValue(value) {
|
||||
return typeof value === 'number' && !Number.isNaN(value);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user