man this tutorial level is really screwed up

todo??:

- fix the id system [days since the universe was created is NOT a valid id]
- fix literally everything else although thats probably caused by the discrepancy above
This commit is contained in:
Fireblade
2026-05-02 20:07:41 -04:00
parent d89fadff68
commit 02f1be3bb7
23 changed files with 217 additions and 70 deletions
@@ -40,6 +40,9 @@ bool ChoiceTask::isCompleted()
return false;
int xboxPad = pMinecraft->player->GetXboxPad();
int tutorialPad = tutorial->getPad();
bool hasValidPad = (tutorialPad >= 0 && tutorialPad < XUSER_MAX_COUNT);
bool menuDisplayed = hasValidPad && ui.GetMenuDisplayed(tutorialPad);
if( m_bConfirmMappingComplete || m_bCancelMappingComplete )
{
@@ -48,14 +51,10 @@ bool ChoiceTask::isCompleted()
return true;
}
if(ui.GetMenuDisplayed(tutorial->getPad()))
{
// If a menu is displayed, then we use the handleUIInput to complete the task
}
else
if(!menuDisplayed)
{
// If the player is under water then allow all keypresses so they can jump out
if (pMinecraft->localplayers[tutorial->getPad()]->isUnderLiquid(Material::water)) return false;
if (hasValidPad && pMinecraft->localplayers[tutorialPad] != nullptr && pMinecraft->localplayers[tutorialPad]->isUnderLiquid(Material::water)) return false;
#ifdef _WINDOWS64
if (!m_bConfirmMappingComplete &&
(InputManager.GetValue(xboxPad, m_iConfirmMapping) > 0
@@ -85,8 +84,9 @@ bool ChoiceTask::isCompleted()
sendTelemetry();
enableConstraints(false, true);
}
return m_bConfirmMappingComplete || m_bCancelMappingComplete;
}
return m_bConfirmMappingComplete || m_bCancelMappingComplete;
}
eTutorial_CompletionAction ChoiceTask::getCompletionAction()
@@ -40,11 +40,13 @@ bool InfoTask::isCompleted()
bool bAllComplete = true;
Minecraft *pMinecraft = Minecraft::GetInstance();
int tutorialPad = tutorial->getPad();
bool hasValidPad = (tutorialPad >= 0 && tutorialPad < XUSER_MAX_COUNT);
// If the player is under water then allow all keypresses so they can jump out
if( pMinecraft->localplayers[tutorial->getPad()]->isUnderLiquid(Material::water) ) return false;
if( hasValidPad && pMinecraft->localplayers[tutorialPad] != nullptr && pMinecraft->localplayers[tutorialPad]->isUnderLiquid(Material::water) ) return false;
if(ui.GetMenuDisplayed(tutorial->getPad()))
if(hasValidPad && ui.GetMenuDisplayed(tutorialPad))
{
// If a menu is displayed, then we use the handleUIInput to complete the task
bAllComplete = true;
@@ -118,10 +118,12 @@ bool TutorialHint::onLookAtEntity(eINSTANCEOF type)
int TutorialHint::tick()
{
int returnVal = -1;
int tutorialPad = m_tutorial->getPad();
bool hasValidPad = (tutorialPad >= 0 && tutorialPad < XUSER_MAX_COUNT);
switch(m_type)
{
case e_Hint_SwimUp:
if( Minecraft::GetInstance()->localplayers[m_tutorial->getPad()]->isUnderLiquid(Material::water) ) returnVal = m_descriptionId;
if( hasValidPad && Minecraft::GetInstance()->localplayers[tutorialPad] != nullptr && Minecraft::GetInstance()->localplayers[tutorialPad]->isUnderLiquid(Material::water) ) returnVal = m_descriptionId;
break;
}
return returnVal;
@@ -76,10 +76,11 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
// Do we have the ingredients?
shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
shared_ptr<ItemInstance> sellItem = activeRecipe->getSellItem();
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
int buyAMatches = player->inventory->countMatches(buyAItem);
int buyBMatches = player->inventory->countMatches(buyBItem);
if( (buyAItem != nullptr && buyAMatches >= buyAItem->count) && (buyBItem == nullptr || buyBMatches >= buyBItem->count) )
if( sellItem != nullptr && (buyAItem != nullptr && buyAMatches >= buyAItem->count) && (buyBItem == nullptr || 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;
@@ -91,7 +92,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
player->inventory->removeResources(buyBItem);
// Add the item we have purchased
shared_ptr<ItemInstance> result = activeRecipe->getSellItem()->copy();
shared_ptr<ItemInstance> result = sellItem->copy();
if(!player->inventory->add( result ) )
{
player->drop(result);
@@ -238,6 +239,7 @@ void IUIScene_TradingMenu::updateDisplay()
if( selectedShopItem < m_activeOffers.size() )
{
MerchantRecipe *activeRecipe = m_activeOffers.at(selectedShopItem).first;
shared_ptr<ItemInstance> sellItem = activeRecipe ? activeRecipe->getSellItem() : nullptr;
wstring wsTemp;
@@ -245,11 +247,11 @@ void IUIScene_TradingMenu::updateDisplay()
wsTemp = app.GetString(IDS_VILLAGER_OFFERS_ITEM);
wsTemp = replaceAll(wsTemp,L"{*VILLAGER_TYPE*}",m_merchant->getDisplayName());
size_t iPos=wsTemp.find(L"%s");
wsTemp.replace(iPos,2,activeRecipe->getSellItem()->getHoverName());
wsTemp.replace(iPos,2,sellItem != nullptr ? sellItem->getHoverName() : L"");
setTitle(wsTemp.c_str());
vector<HtmlString> *offerDescription = GetItemDescription(activeRecipe->getSellItem());
vector<HtmlString> *offerDescription = GetItemDescription(sellItem);
setOfferDescription(offerDescription);
shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
@@ -270,8 +272,8 @@ void IUIScene_TradingMenu::updateDisplay()
int buyAMatches = player->inventory->countMatches(buyAItem);
if(buyAMatches > 0)
{
setRequest1RedBox(buyAMatches < buyAItem->count);
canMake = buyAMatches > buyAItem->count;
setRequest1RedBox(buyAItem == nullptr || buyAMatches < buyAItem->count);
canMake = buyAItem != nullptr && buyAMatches > buyAItem->count;
}
else
{
@@ -282,8 +284,8 @@ void IUIScene_TradingMenu::updateDisplay()
int buyBMatches = player->inventory->countMatches(buyBItem);
if(buyBMatches > 0)
{
setRequest2RedBox(buyBMatches < buyBItem->count);
canMake = canMake && buyBMatches > buyBItem->count;
setRequest2RedBox(buyBItem == nullptr || buyBMatches < buyBItem->count);
canMake = canMake && buyBItem != nullptr && buyBMatches > buyBItem->count;
}
else
{
@@ -369,6 +371,11 @@ void IUIScene_TradingMenu::setTradeItem(int index, shared_ptr<ItemInstance> item
vector<HtmlString> *IUIScene_TradingMenu::GetItemDescription(shared_ptr<ItemInstance> item)
{
if (item == nullptr)
{
return new vector<HtmlString>();
}
bool advanced = false;
if (const Minecraft* pMinecraft = Minecraft::GetInstance())
{