diff options
Diffstat (limited to 'resources/js/ui.js')
-rw-r--r-- | resources/js/ui.js | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/resources/js/ui.js b/resources/js/ui.js index 3aa0c98..04186f5 100644 --- a/resources/js/ui.js +++ b/resources/js/ui.js @@ -283,7 +283,7 @@ const UI = { createElementTypeIcon (type) { const img = document.createElement('img'); img.src = `/modules/tuxemon/mods/tuxemon/gfx/ui/icons/element/${type}_type.png`; - img.title = translate(type) || slugToName(type); + img.title = translate(type); return img; }, @@ -301,14 +301,14 @@ const UI = { if (statusEffect.slug === 'faint') { const node = document.createElement('b'); node.innerHTML = 'X'; - node.title = translate(`status_${statusEffect.slug}`) || statusEffect.name; + node.title = translate(`status_${statusEffect.slug}`); return node; } const img = document.createElement('img'); img.src = `/modules/tuxemon/mods/tuxemon/gfx/ui/icons/status/icon_${statusEffect.slug}.png`; - img.title = translate(`status_${statusEffect.slug}`) || statusEffect.name; + img.title = translate(`status_${statusEffect.slug}`); return img; }, @@ -389,7 +389,7 @@ const UI = { techniqueNode.querySelector('[data-template-slot="name"]').textContent = technique.name; techniqueNode.querySelector('[data-template-slot="recharge"]').textContent = technique.rechargeLength; techniqueNode.querySelector('[data-template-slot="types"]').innerHTML = technique.types.map((type) => UI.createElementTypeIcon(type).outerHTML).join(''); - techniqueNode.querySelector('[data-template-slot="range"]').textContent = translate(technique.range) || slugToName(technique.range); + techniqueNode.querySelector('[data-template-slot="range"]').textContent = translate(technique.range); techniqueNode.querySelector('[data-template-slot="power"]').textContent = technique.power; techniqueNode.querySelector('[data-template-slot="accuracy"]').textContent = technique.accuracy; @@ -792,7 +792,7 @@ const UI = { }); if (applicableMonsters.length === 0) { - alert(translate('ui:no_applicable_monsters', true)); + alert(translate('ui:no_applicable_monsters')); return; } @@ -823,11 +823,11 @@ const UI = { template.querySelector('[data-template-slot="box.withdraw"]').addEventListener('click', UI.wrapCallback(() => { if (Memory.state.monsters.length === 0) { - alert(translate('ui:healing_center:box:withdraw:no_tuxemon_in_box', true)); + alert(translate('ui:healing_center:box:withdraw:no_tuxemon_in_box')); return; } if (Memory.state.player.monsters.length === 6) { - alert(translate('ui:healing_center:box:withdraw:no_space_in_party', true)); + alert(translate('ui:healing_center:box:withdraw:no_space_in_party')); return; } @@ -849,7 +849,7 @@ const UI = { template.querySelector('[data-template-slot="box.deposit"]').addEventListener('click', UI.wrapCallback(() => { if (Memory.state.player.monsters.length === 1) { - alert(translate('ui:healing_center:box:deposit:last_tuxemon', true)); + alert(translate('ui:healing_center:box:deposit:last_tuxemon')); return; } @@ -871,7 +871,7 @@ const UI = { template.querySelector('[data-template-slot="box.view"]').addEventListener('click', UI.wrapCallback(() => { if (Memory.state.monsters.length === 0) { - alert(translate('ui:healing_center:box:view:no_tuxemon_in_box', true)); + alert(translate('ui:healing_center:box:view:no_tuxemon_in_box')); return; } @@ -1175,8 +1175,7 @@ const UI = { const connection = currentArea.connections[connectionSlug]; const connectionNode = UI.createTemplate(Template.areaSelectionItem); - connectionNode.querySelector('[data-template-slot="text"]').textContent = - translate(connection['modules/tuxemon.slug']) || slugToName(connection['modules/tuxemon.slug']); + connectionNode.querySelector('[data-template-slot="text"]').textContent = translate(connection['modules/tuxemon.slug']); let canGo = true; for (const condition of connection.conditions) { @@ -1455,11 +1454,11 @@ const UI = { template.querySelector('[data-template-slot="exp"]').innerHTML = `${monster.exp} / ${monster.getExperienceRequired(1)}`; - template.querySelector('[data-template-slot="stats.melee.name"]').textContent = translate(StatType.melee) || slugToName(StatType.melee); - template.querySelector('[data-template-slot="stats.armour.name"]').textContent = translate(StatType.armour) || slugToName(StatType.armour); - template.querySelector('[data-template-slot="stats.ranged.name"]').textContent = translate(StatType.ranged) || slugToName(StatType.ranged); - template.querySelector('[data-template-slot="stats.dodge.name"]').textContent = translate(StatType.dodge) || slugToName(StatType.dodge); - template.querySelector('[data-template-slot="stats.speed.name"]').textContent = translate(StatType.speed) || slugToName(StatType.speed); + template.querySelector('[data-template-slot="stats.melee.name"]').textContent = translate(StatType.melee); + template.querySelector('[data-template-slot="stats.armour.name"]').textContent = translate(StatType.armour); + template.querySelector('[data-template-slot="stats.ranged.name"]').textContent = translate(StatType.ranged); + template.querySelector('[data-template-slot="stats.dodge.name"]').textContent = translate(StatType.dodge); + template.querySelector('[data-template-slot="stats.speed.name"]').textContent = translate(StatType.speed); template.querySelector('[data-template-slot="stats.melee.value"]').textContent = monster.stats.melee; template.querySelector('[data-template-slot="stats.armour.value"]').textContent = monster.stats.armour; @@ -1671,7 +1670,7 @@ const UI = { template.classList.add('inventory__monster-selection'); if (template.children.length === 0) { - alert(translate('ui:no_applicable_monsters', true)); + alert(translate('ui:no_applicable_monsters')); return; } @@ -1917,7 +1916,7 @@ const UI = { // Clear save data template.querySelector('[data-template-slot="clearLocalSaveData"]').addEventListener('click', UI.wrapCallback(() => { - if (confirm(translate('ui:settings:clear_local_save_data:confirm', true))) { + if (confirm(translate('ui:settings:clear_local_save_data:confirm'))) { localStorage.removeItem('state'); window.location.reload(); } @@ -1940,6 +1939,9 @@ const UI = { /** * @param {HTMLElement} popup + * @param {Object} data + * @param {Npc} data.speaker + * @param {string} data.text * * @returns {HTMLElement} */ @@ -1961,7 +1963,7 @@ const UI = { /** * @param {HTMLElement} popup * - * @returns {Promise<any>} + * @returns {Promise<void>} */ drawStoryPopup (popup) { UI.drawPopup(popup); @@ -1979,6 +1981,10 @@ const UI = { }, /** + * @param {Object} data + * @param {Npc} data.speaker + * @param {string} data.text + * * @returns {Promise<any>} */ async buildAndShowStoryPopup ({ speaker, text }) { |