Fix: Enchanting Table taking wrong levels

Was using cost instead of the index of the slot
This commit is contained in:
SevenToaster509 2026-04-13 17:25:19 +01:00
parent 4fe92f9a5a
commit f307d7b0eb
2 changed files with 2 additions and 2 deletions

View file

@ -292,7 +292,7 @@ void IUIScene_AbstractContainerMenu::handleEnchantButton(int slot, int iPad) {
eMinecraftColour colCost = costEnough ? eHTMLColor_7 : eHTMLColor_c;
std::wstring message = costEnough
? std::to_wstring(menu->costs[slot]) + L" Enchantment Levels"
? std::to_wstring(slot + 1) + (slot == 0 ? L" Enchantment Level" : L" Enchantment Levels")
: L"Level Requirement: " + std::to_wstring(menu->costs[slot]);
vector<HtmlString>* lines = new vector<HtmlString>();

View file

@ -196,7 +196,7 @@ bool EnchantmentMenu::clickMenuButton(shared_ptr<Player> player, int i)
if (newEnchantment != nullptr)
{
player->giveExperienceLevels(-costs[i]);
player->giveExperienceLevels(-(i + 1));
if (isBook) item->id = Item::enchantedBook_Id;
int randomIndex = isBook ? random.nextInt(newEnchantment->size()) : -1;