diff --git a/Adventures in Lestoria/BlacksmithCraftingWindow.cpp b/Adventures in Lestoria/BlacksmithCraftingWindow.cpp index f8af3a64..d0902d97 100644 --- a/Adventures in Lestoria/BlacksmithCraftingWindow.cpp +++ b/Adventures in Lestoria/BlacksmithCraftingWindow.cpp @@ -99,7 +99,7 @@ void Menu::InitializeBlacksmithCraftingWindow(){ std::string label=""; if(Inventory::GetItemCount(item.lock()->ActualName())==0){ //If we don't own the item we have to create it first. if(item.lock()->EnhancementIsPossible()&&item.lock()->GetEnhancementInfo().size()>item.lock()->EnhancementLevel()+1){ - label=std::format("#00FF00Craft {}",item.lock()->DisplayName()); + label=""; } Component(CRAFT_ITEM,"Enhancement Level Header")->SetLabel(label); Component(CRAFT_ITEM,"Item Name Header")->SetLabel(std::format("Crafting {}",item.lock()->DisplayName())); diff --git a/Adventures in Lestoria/Item.cpp b/Adventures in Lestoria/Item.cpp index 37dc3fb0..8518893e 100644 --- a/Adventures in Lestoria/Item.cpp +++ b/Adventures in Lestoria/Item.cpp @@ -1068,7 +1068,9 @@ const bool Item::CanEnhanceItem(uint8_t qty)const{ if(ISBLANK(std::make_shared(*this)))return false; if(!GetEnhancementInfo().CanBeEnhanced())return false; if(GetEnhancementInfo().AvailableChapter()GetCurrentChapter())return false; - const EnhancementLevelInfo&enhanceInfo=GetEnhancementInfo()[EnhancementLevel()+1]; + size_t enhanceIndex=EnhancementLevel()+1; + if(Inventory::GetItemCount(ActualName())==0)enhanceIndex=0; + const EnhancementLevelInfo&enhanceInfo=GetEnhancementInfo()[enhanceIndex]; if(GetEnhancementInfo().size()>2){ //If the item has exactly 2 enhancement levels, then it's an item that can only simply be crafted. Therefore, don't do the max enhancement level check. if(EnhancementLevel()>="Item.Item Max Enhancement Level"_I)return false; } diff --git a/Adventures in Lestoria/Menu.cpp b/Adventures in Lestoria/Menu.cpp index d876bca4..46325d31 100644 --- a/Adventures in Lestoria/Menu.cpp +++ b/Adventures in Lestoria/Menu.cpp @@ -62,6 +62,7 @@ const vf2d Menu::CENTERED = {-456,-456}; MenuType Menu::lastMenuTypeCreated; std::string Menu::lastRegisteredComponent; bool Menu::alreadyClicked=false; +bool Menu::scrolling=false; INCLUDE_game INCLUDE_GFX @@ -128,7 +129,7 @@ void Menu::CheckClickAndPerformMenuSelect(AiL*game){ } void Menu::HoverMenuSelect(AiL*game){ - if(!game->IsFocused()||selection.expired()||selection.lock()->disabled||selection.lock()->grayedOut||Menu::alreadyClicked)return; + if(!game->IsFocused()||selection.expired()||selection.lock()->disabled||selection.lock()->grayedOut||Menu::alreadyClicked||Menu::scrolling)return; if(selection.lock()->draggable){ if(buttonHoldTime<"ThemeGlobal.MenuHoldTime"_F){ diff --git a/Adventures in Lestoria/Menu.h b/Adventures in Lestoria/Menu.h index 40b090fd..7860469d 100644 --- a/Adventures in Lestoria/Menu.h +++ b/Adventures in Lestoria/Menu.h @@ -89,6 +89,7 @@ struct Navigation{ }; class Menu:public IAttributable{ + friend class ScrollableWindowComponent; static void InitializeConsumableInventoryWindow(); static void InitializeClassInfoWindow(); static void InitializeClassSelectionWindow(); @@ -121,6 +122,7 @@ class Menu:public IAttributable{ int componentCount=0; float componentSelectionIndex=0.f; static bool alreadyClicked; + static bool scrolling; std::unique_ptrdraggingComponent; ViewPort window; diff --git a/Adventures in Lestoria/RequiredMaterialsList.h b/Adventures in Lestoria/RequiredMaterialsList.h index 844e3e70..fecbe09b 100644 --- a/Adventures in Lestoria/RequiredMaterialsList.h +++ b/Adventures in Lestoria/RequiredMaterialsList.h @@ -69,10 +69,14 @@ protected: labelTextSize=vf2d(game->GetTextSizeProp(label)*adjustedScale); } - if(itemRef.lock()->EnhancementIsPossible()&&itemRef.lock()->GetEnhancementInfo().size()>itemRef.lock()->EnhancementLevel()+1){ + if(itemRef.lock()->EnhancementIsPossible()){ + size_t enhancementIndex=itemRef.lock()->EnhancementLevel()+1; + if(Inventory::GetItemCount(itemRef.lock()->ActualName())==0){ //If we don't have the item, use the initial crafting list instead. + enhancementIndex=0; + } float drawWidth=rect.size.x/3; int index=0; - for(const auto&[name,amt]:itemRef.lock()->GetEnhancementInfo()[itemRef.lock()->EnhancementLevel()+1].craftingRequirement.GetItems()){ + for(const auto&[name,amt]:itemRef.lock()->GetEnhancementInfo()[enhancementIndex].craftingRequirement.GetItems()){ Pixel textCol=WHITE; if(Inventory::GetItemCount(name)GetEnhancementInfo()[itemRef.lock()->EnhancementLevel()+1].craftingRequirement.GetCost(); + uint32_t goldAmt=itemRef.lock()->GetEnhancementInfo()[enhancementIndex].craftingRequirement.GetCost(); if(goldAmt>0){ if(game->GetPlayer()->GetMoney()GetTextSizeProp("Item.Craftable Item Text"_S))*vf2d{1.f,0.85f}; - window.DrawShadowStringPropDecal(rect.pos+vf2d{rect.size.x-craftableTextSize.x-1,3},"Item.Craftable Item Text"_S,"Item.Craftable Item Text Color"_Pixel,BLACK,{1.f,0.85f}); - borderCol=GREEN; + if(!canEnhance&&fadeOutIfMissingRequirements){ + vf2d craftableTextSize=vf2d(game->GetTextSizeProp("Item.Missing Upgradeable Item Text"_S))*vf2d{1.f,0.85f}; + window.DrawShadowStringPropDecal(rect.pos+vf2d{rect.size.x-craftableTextSize.x-1,3},"Item.Missing Upgradeable Item Text"_S,"Item.Missing Upgradeable Item Text Color"_Pixel,BLACK,{1.f,0.85f}); + borderCol=GREEN; + }else{ + vf2d craftableTextSize=vf2d(game->GetTextSizeProp("Item.Craftable Item Text"_S))*vf2d{1.f,0.85f}; + window.DrawShadowStringPropDecal(rect.pos+vf2d{rect.size.x-craftableTextSize.x-1,3},"Item.Craftable Item Text"_S,"Item.Craftable Item Text Color"_Pixel,BLACK,{1.f,0.85f}); + borderCol=GREEN; + } }break; case PriceLabel::UPGRADEABLE:{ if(!canEnhance&&fadeOutIfMissingRequirements){ diff --git a/Adventures in Lestoria/ScrollableWindowComponent.h b/Adventures in Lestoria/ScrollableWindowComponent.h index 5b34597c..b180b77c 100644 --- a/Adventures in Lestoria/ScrollableWindowComponent.h +++ b/Adventures in Lestoria/ScrollableWindowComponent.h @@ -146,8 +146,10 @@ protected: } if(game->GetMouse(0).bReleased){ scrollBarSelected=false; + Menu::scrolling=false; } if(scrollBarSelected){ + Menu::scrolling=true; float spaceBetweenTopAndBottomArrows=rect.size.y-24; float viewHeight=rect.size.y; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index cd40859b..3c71e7d2 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 6609 +#define VERSION_BUILD 6616 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 7b30f5f0..220fc908 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ