From b3feddfef372618c8a9d7a0abcaf18cfad866c18 Mon Sep 17 00:00:00 2001 From: daoge <3523206925@qq.com> Date: Tue, 3 Mar 2026 03:04:10 +0800 Subject: feat: TU19 (Dec 2014) Features & Content (#155) * try to resolve merge conflict * feat: TU19 (Dec 2014) Features & Content (#32) * December 2014 files * Working release build * Fix compilation issues * Add sound to Windows64Media * Add DLC content and force Tutorial DLC * Revert "Add DLC content and force Tutorial DLC" This reverts commit 97a43994725008e35fceb984d5549df9c8cea470. * Disable broken light packing * Disable breakpoint during DLC texture map load Allows DLC loading but the DLC textures are still broken * Fix post build not working * ... * fix vs2022 build * fix cmake build --------- Co-authored-by: Loki --- .../Common/UI/IUIScene_TradingMenu.cpp | 49 ++++++++++------------ 1 file changed, 23 insertions(+), 26 deletions(-) (limited to 'Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp') diff --git a/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp index 658bcdfb..8cc04940 100644 --- a/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp @@ -1,6 +1,7 @@ #include "stdafx.h" #include "..\..\..\Minecraft.World\net.minecraft.world.item.trading.h" #include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h" +#include "..\..\..\Minecraft.World\net.minecraft.world.item.h" #include "..\..\..\Minecraft.World\net.minecraft.network.packet.h" #include "..\..\Minecraft.h" #include "..\..\MultiPlayerLocalPlayer.h" @@ -77,6 +78,9 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) int buyBMatches = player->inventory->countMatches(buyBItem); if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) ) { + // 4J-JEV: Fix for PS4 #7111: [PATCH 1.12] Trading Librarian villagers for multiple ‘Enchanted Books’ will cause the title to crash. + int actualShopItem = m_activeOffers.at(selectedShopItem).second; + m_merchant->notifyTrade(activeRecipe); // Remove the items we are purchasing with @@ -91,7 +95,6 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) } // Send a packet to the server - int actualShopItem = m_activeOffers.at(selectedShopItem).second; player->connection->send( shared_ptr( new TradeItemPacket(m_menu->containerId, actualShopItem) ) ); updateDisplay(); @@ -238,15 +241,14 @@ void IUIScene_TradingMenu::updateDisplay() // 4J-PB - need to get the villager type here wsTemp = app.GetString(IDS_VILLAGER_OFFERS_ITEM); - wsTemp = replaceAll(wsTemp,L"{*VILLAGER_TYPE*}",app.GetString(m_merchant->getDisplayName())); + wsTemp = replaceAll(wsTemp,L"{*VILLAGER_TYPE*}",m_merchant->getDisplayName()); int iPos=wsTemp.find(L"%s"); wsTemp.replace(iPos,2,activeRecipe->getSellItem()->getHoverName()); setTitle(wsTemp.c_str()); - vector unformattedStrings; - wstring offerDescription = GetItemDescription(activeRecipe->getSellItem(), unformattedStrings); - setOfferDescription(offerDescription, unformattedStrings); + vector *offerDescription = GetItemDescription(activeRecipe->getSellItem()); + setOfferDescription(offerDescription); shared_ptr buyAItem = activeRecipe->getBuyAItem(); shared_ptr buyBItem = activeRecipe->getBuyBItem(); @@ -299,13 +301,15 @@ void IUIScene_TradingMenu::updateDisplay() } else { - setTitle(app.GetString(m_merchant->getDisplayName())); + setTitle(m_merchant->getDisplayName()); setRequest1Name(L""); setRequest2Name(L""); setRequest1RedBox(false); setRequest2RedBox(false); setRequest1Item(nullptr); - setRequest2Item(nullptr); + setRequest2Item(nullptr); + vector offerDescription; + setOfferDescription(&offerDescription); } m_bHasUpdatedOnce = true; @@ -361,27 +365,20 @@ void IUIScene_TradingMenu::setTradeItem(int index, shared_ptr item { } -wstring IUIScene_TradingMenu::GetItemDescription(shared_ptr item, vector &unformattedStrings) +vector *IUIScene_TradingMenu::GetItemDescription(shared_ptr item) { - if(item == NULL) return L""; + vector *lines = item->getHoverText(nullptr, false); - wstring desc = L""; - vector *strings = item->getHoverTextOnly(nullptr, false, unformattedStrings); - bool firstLine = true; - for(AUTO_VAR(it, strings->begin()); it != strings->end(); ++it) + // Add rarity to first line + if (lines->size() > 0) { - wstring thisString = *it; - if(!firstLine) - { - desc.append( L"
" ); - } - else - { - firstLine = false; - } - desc.append( thisString ); + lines->at(0).color = item->getRarity()->color; } - strings->clear(); - delete strings; - return desc; + + return lines; } + +void IUIScene_TradingMenu::HandleInventoryUpdated() +{ + updateDisplay(); +} \ No newline at end of file -- cgit v1.2.3