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)
This commit is contained in:
Helcostr 2021-04-29 12:10:10 -07:00 committed by GitHub
parent 40fd977a0e
commit 6d28029a5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View file

@ -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;

View file

@ -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 %>.",

View file

@ -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",