From cbd2a7e5c20aa1cd45fba586fc0e5b1cad80cd3d Mon Sep 17 00:00:00 2001 From: leaftail1880 <110915645+leaftaul1880@users.noreply.github.com> Date: Mon, 6 Jan 2025 21:13:02 +0300 Subject: [PATCH] Fix mage --- src/lib/utils/lang.ts | 9 ++++++++- src/modules/places/village-of-explorers/mage.ts | 13 +++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/lib/utils/lang.ts b/src/lib/utils/lang.ts index a64667b4..ee66a8bc 100644 --- a/src/lib/utils/lang.ts +++ b/src/lib/utils/lang.ts @@ -3,6 +3,7 @@ import { MinecraftEnchantmentTypes } from '@minecraft/vanilla-data' import { inspect } from 'lib/util' import { blockItemsLangJson, langs, Language } from '../assets/lang' import { sprintf } from './sprintf' +import { nmspc } from 'lib' /** * Converts any minecraft type id to human readable format, e.g. removes minecraft: prefix, replaces _ with spaces and @@ -48,7 +49,13 @@ export function langToken(item: { typeId: string } | string) { * another translated RawMessage */ export function translateEnchantment(e: MinecraftEnchantmentTypes | Enchantment): RawText { - const rawtext: RawMessage[] = [{ translate: langToken({ typeId: typeof e === 'string' ? e : e.type.id }) }] + const rawtext: RawMessage[] = [ + { + translate: langToken({ + typeId: typeof e === 'string' ? e.replace('minecraft:', '') : e.type.id.replace('minecraft:', ''), + }), + }, + ] if (typeof e === 'object') { rawtext.push( { text: ' ' }, diff --git a/src/modules/places/village-of-explorers/mage.ts b/src/modules/places/village-of-explorers/mage.ts index ca8fa772..904852fc 100644 --- a/src/modules/places/village-of-explorers/mage.ts +++ b/src/modules/places/village-of-explorers/mage.ts @@ -42,6 +42,19 @@ export class Mage extends ShopNpc { }, ) + form.itemModifierSection( + 'Улучшить лук', + item => item.typeId.endsWith('bow'), + 'любой лук', + (form, slot, item) => { + const ench = this.createEnch(form, item, slot) + const enchs = item.enchantable?.getEnchantments().reduce((p, c) => p + c.level, 1) ?? 1 + + ench(e.Power, level => new MultiCost().money(level * 20).xp(level * enchs)) + ench(e.Flame, level => new MultiCost().money(level * 2000).xp(level * enchs)) + }, + ) + form.itemModifierSection( 'Улучшить броню', item => ['chestplate', 'leggings', 'boots', 'helmet'].some(e => item.typeId.endsWith(e)),