forked from xziino/ff14-mitigator
small fix
This commit is contained in:
parent
7c6f443a53
commit
14674d2842
@ -129,17 +129,6 @@ const MITIGATION_ABILITIES = [
|
||||
'Addle' => ['dr' => 10, 'buffType' => 'debuff', 'statusId' => 1001203],
|
||||
];
|
||||
|
||||
function localizedMitigationName(string $key, string $language, string $fallback): string {
|
||||
$names = [
|
||||
'de' => [
|
||||
'Reprisal' => 'Reflexion',
|
||||
'Feint' => 'Zermürben',
|
||||
'Addle' => 'Stumpfsinn',
|
||||
],
|
||||
];
|
||||
return $names[$language][$key] ?? $fallback;
|
||||
}
|
||||
|
||||
function resolveMitigations(string $buffStr, array $mitigIdMap): array {
|
||||
if ($buffStr === '') return [];
|
||||
$result = [];
|
||||
@ -219,7 +208,6 @@ foreach ($abilityNames as $gameId => $name) {
|
||||
foreach (MITIGATION_ABILITIES as $name => $meta) {
|
||||
if (isset($meta['statusId']) && !isset($mitigIdMap[$meta['statusId']])) {
|
||||
$displayName = $abilityNames[(int)$meta['statusId']] ?? $name;
|
||||
$displayName = localizedMitigationName($name, $language, $displayName);
|
||||
$mitigIdMap[$meta['statusId']] = array_merge(['key' => $name, 'name' => $displayName], $meta);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,28 +89,8 @@ function fmtNumber(n) {
|
||||
return Number(n).toLocaleString('de-DE');
|
||||
}
|
||||
|
||||
function currentLanguage() {
|
||||
return window.App?.language || localStorage.getItem('ff14-mitigator-language') || 'en';
|
||||
}
|
||||
|
||||
const ABILITY_DISPLAY_NAMES = {
|
||||
de: {
|
||||
'Addle': 'Stumpfsinn',
|
||||
'Feint': 'Zermürben',
|
||||
'Reprisal': 'Reflexion',
|
||||
'Passage of Arms': 'Waffengang',
|
||||
'Heart of Light': 'Herz des Lichts',
|
||||
'Sacred Soil': 'Geweihte Erde',
|
||||
'Tactician': 'Taktiker',
|
||||
'Shake It Off': 'Abschütteln',
|
||||
'Shield Samba': 'Schildsamba',
|
||||
'Magick Barrier': 'Magiebarriere',
|
||||
},
|
||||
};
|
||||
|
||||
function localizedAbilityName(key, fallback = key) {
|
||||
const lang = currentLanguage();
|
||||
return ABILITY_DISPLAY_NAMES[lang]?.[key] ?? fallback ?? key;
|
||||
function assignmentAbilityName(assignment) {
|
||||
return assignment?.abilityName ?? assignment?.ability ?? '';
|
||||
}
|
||||
|
||||
// ── Rendering: Plan List ──────────────────────────────────────────────────────
|
||||
@ -246,7 +226,7 @@ function renderMechanicListHtml(plan) {
|
||||
: 'badge-assign-buff';
|
||||
const isMissing = !!a.job && !activeJobSet.has(a.job);
|
||||
const icon = MITIG_ICONS[a.ability] ?? '';
|
||||
const ability = localizedAbilityName(a.ability, a.abilityName ?? a.ability);
|
||||
const ability = assignmentAbilityName(a);
|
||||
const label = a.job ? `${escHtml(a.job)} · ${escHtml(ability)}` : escHtml(ability);
|
||||
const title = isMissing ? `${escHtml(a.job)} nicht in Jobaufstellung` : '';
|
||||
return `<span class="badge badge-assign ${cls}${isMissing ? ' badge-assign--missing-job' : ''}"${title ? ` title="${title}"` : ''}>
|
||||
@ -795,7 +775,8 @@ function renderAbilityModalContent() {
|
||||
const otherClass = byOtherJob ? ' ability-chip--other-job' : '';
|
||||
const title = byOtherJob ? `Bereits von ${escHtml(assigned.job)} zugewiesen` : '';
|
||||
const icon = MITIG_ICONS[ab.name] ?? '';
|
||||
const label = localizedAbilityName(ab.name, ab.name);
|
||||
const assignedName = assigned ? assignmentAbilityName(assigned) : '';
|
||||
const label = assignedName || ab.name;
|
||||
return `<button class="ability-chip ${cls}${activeClass}${otherClass}"
|
||||
data-ability="${escHtml(ab.name)}"
|
||||
data-job="${escHtml(job)}"
|
||||
@ -828,7 +809,7 @@ function toggleAbilityAssignment(abilityName, job, buffType) {
|
||||
mechanic.assignments[idx].job = job;
|
||||
}
|
||||
} else {
|
||||
mechanic.assignments.push({ ability: abilityName, abilityName: localizedAbilityName(abilityName, abilityName), job, buffType });
|
||||
mechanic.assignments.push({ ability: abilityName, job, buffType });
|
||||
}
|
||||
|
||||
updatePlan(abilityModalPlanId, { mechanics: plan.mechanics });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user