From 6d28029a5f8c9e05e24e306a6a5b43e0c674e9a2 Mon Sep 17 00:00:00 2001 From: Helcostr Date: Thu, 29 Apr 2021 12:10:10 -0700 Subject: [PATCH] Clientside: Block low lvl for high lvl spells - Fixes #12904 (#13135) * Add lvl block on high lvl spell, add i18n for not enough gold/lvl for spell. Add space for invalidClass because of simple lint * Wrap i18n in the msgbox funcion * Remove trailing whitespace (as seen in a comment weblate) * Block level first Change blocking order so that the spell is prevented based on lvl, then mana, then gold * Strip notEnoughLvl pop-up error (and i18n): Button is already visually distinguishable * fix lint (mv comment, return null) --- website/client/src/mixins/spells.js | 4 +++- website/common/locales/en/character.json | 3 ++- website/common/locales/en/spells.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/website/client/src/mixins/spells.js b/website/client/src/mixins/spells.js index 2f62a35b3b..a34b69836e 100644 --- a/website/client/src/mixins/spells.js +++ b/website/client/src/mixins/spells.js @@ -34,10 +34,12 @@ export default { return null; } + // swallow lvl error: visually distinct btn already + if (this.user.stats.lvl < spell.lvl) return null; if (this.user.stats.mp < spell.mana) return this.text(this.$t('notEnoughMana')); if (spell.immediateUse && this.user.stats.gp < spell.value) { - return this.text('Not enough gold.'); + return this.text(this.$t('notEnoughGold')); } this.potionClickMode = true; diff --git a/website/common/locales/en/character.json b/website/common/locales/en/character.json index 30d1a455ff..406ee7dc97 100644 --- a/website/common/locales/en/character.json +++ b/website/common/locales/en/character.json @@ -112,7 +112,7 @@ "changeClass": "Change Class, Refund Stat Points", "lvl10ChangeClass": "To change class you must be at least level 10.", "changeClassConfirmCost": "Are you sure you want to change your class for 3 Gems?", - "invalidClass":"Invalid class. Please specify 'warrior', 'rogue', 'wizard', or 'healer'.", + "invalidClass": "Invalid class. Please specify 'warrior', 'rogue', 'wizard', or 'healer'.", "levelPopover": "Each level earns you one Point to assign to a Stat of your choice. You can do so manually, or let the game decide for you using one of the Automatic Allocation options.", "unallocated": "Unallocated Stat Points", "autoAllocation": "Automatic Allocation", @@ -145,6 +145,7 @@ "purchaseForHourglasses": "Purchase for <%= cost %> Hourglasses?", "purchasePetItemConfirm": "This purchase would exceed the number of items you need to hatch all possible <%= itemText %> pets. Are you sure?", "notEnoughMana": "Not enough mana.", + "notEnoughGold": "Not enough gold.", "invalidTarget": "You can't cast a skill on that.", "youCast": "You cast <%= spell %>.", "youCastTarget": "You cast <%= spell %> on <%= target %>.", diff --git a/website/common/locales/en/spells.json b/website/common/locales/en/spells.json index ba72d037ed..eb05e7b970 100644 --- a/website/common/locales/en/spells.json +++ b/website/common/locales/en/spells.json @@ -9,7 +9,7 @@ "spellWizardEarthNotes": "Your mental power shakes the earth and buffs your Party's Intelligence! (Based on: Unbuffed INT)", "spellWizardFrostText": "Chilling Frost", - "spellWizardFrostNotes": "With one cast, ice freezes all your streaks so they won't reset to zero tomorrow! ", + "spellWizardFrostNotes": "With one cast, ice freezes all your streaks so they won't reset to zero tomorrow!", "spellWarriorSmashText": "Brutal Smash",