diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index c64bfa79..f1c83335 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -1767,6 +1767,7 @@ void AiL::LoadLevel(MapName map){ upperForegroundTileGroups.clear(); MONSTER_LIST.clear(); ZONE_LIST.clear(); + ItemDrop::drops.clear(); GameEvent::events.clear(); worldColor=WHITE; worldColorFunc=[&](vi2d pos){return game->worldColor;}; diff --git a/Adventures in Lestoria/ConsumableCraftItemWindow.cpp b/Adventures in Lestoria/ConsumableCraftItemWindow.cpp index ec1d4801..3e21d1d9 100644 --- a/Adventures in Lestoria/ConsumableCraftItemWindow.cpp +++ b/Adventures in Lestoria/ConsumableCraftItemWindow.cpp @@ -90,11 +90,10 @@ void Menu::InitializeConsumableCraftItemWindow(){ const std::weak_ptritem=Component(CONSUMABLE_CRAFT_ITEM,"Required Materials List")->GetItem(); uint8_t qty=stoi(Component(CONSUMABLE_CRAFT_ITEM,"Amount to Craft Amount Label")->GetLabel()); - for(uint8_t i=0;iCanEnhanceItem(qty)){ - item.lock()->EnhanceItem(qty); - } + if(item.lock()->CanEnhanceItem(qty)){ + item.lock()->EnhanceItem(qty); } + data.component.lock()->SetGrayedOut(!item.lock()->CanEnhanceItem(qty)); return true; })END; diff --git a/Adventures in Lestoria/CraftItemWindow.cpp b/Adventures in Lestoria/CraftItemWindow.cpp index 1629a62e..efc7cd70 100644 --- a/Adventures in Lestoria/CraftItemWindow.cpp +++ b/Adventures in Lestoria/CraftItemWindow.cpp @@ -39,6 +39,7 @@ All rights reserved. #include "Menu.h" #include "EnhancementStatsLabel.h" #include "RequiredMaterialsList.h" +#include "SoundEffect.h" void Menu::InitializeCraftItemWindow(){ Menu*craftItemWindow=CreateMenu(CRAFT_ITEM,CENTERED,{240,120}); @@ -63,6 +64,7 @@ void Menu::InitializeCraftItemWindow(){ Component(CRAFT_ITEM,"Enhancement Stats Label")->SetItem(item); Component(CRAFT_ITEM,"Required Materials List")->SetItem(item); //Update the item refs in the enhancement level screen to now display the correct item. Inventory::UpdateBlacksmithInventoryLists(); + SoundEffect::PlaySFX("Craft Equip",SoundEffect::CENTERED); }else{ //Since we already own this equipment, just enhance it. item.lock()->EnhanceItem(); } @@ -71,6 +73,7 @@ void Menu::InitializeCraftItemWindow(){ if(item.lock()->EnhancementIsPossible()&&item.lock()->GetEnhancementInfo().size()>item.lock()->EnhancementLevel()+1){ label=std::format("Level {} ->#00AA00 {}",item.lock()->EnhancementLevel(),item.lock()->EnhancementLevel()+1); } + Component(CRAFT_ITEM,"Item Name Header")->SetLabel(std::format("Enhancing {}",item.lock()->DisplayName())); Component(data.menu.GetType(),"Enhancement Level Header")->SetLabel(label); data.component.lock()->SetGrayedOut(!item.lock()->CanEnhanceItem()); return true; diff --git a/Adventures in Lestoria/EnhancementStatsLabel.h b/Adventures in Lestoria/EnhancementStatsLabel.h index c2fdd9c5..faaac5a7 100644 --- a/Adventures in Lestoria/EnhancementStatsLabel.h +++ b/Adventures in Lestoria/EnhancementStatsLabel.h @@ -96,7 +96,7 @@ protected: }else{ //This item is getting enhanced to the next level. window.DrawShadowStringDecal(drawPos+vf2d{maxAttributeLabelSize+4+24,yOffset},std::format("{:>5} ->#00AA00 {:<5}", attr.ShowAsDecimal()?std::format("{:>4.2f}{}",value,percentageSign):std::format("{}{}",value,percentageSign), - nextEnhanceLevel!="Item.Item Max Enhancement Level"_I? + nextEnhanceLevel<="Item.Item Max Enhancement Level"_I? attr.ShowAsDecimal()?std::format("{:<4.2f}{}",nextStageValue,percentageSign):std::format("{}{}",nextStageValue,percentageSign) :"MAX"), WHITE,BLACK,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x,1.0f); diff --git a/Adventures in Lestoria/Item.cpp b/Adventures in Lestoria/Item.cpp index 94001a44..5a4e40cb 100644 --- a/Adventures in Lestoria/Item.cpp +++ b/Adventures in Lestoria/Item.cpp @@ -679,7 +679,7 @@ const std::string Item::Description(CompactText compact)const{ if(compact==CRAFTING_INFO){ description+="\n\nCrafting Requirements:\n---------\n"; if(IsCraftable()){ - size_t enhanceIndex=EnhancementLevel()+1; + size_t enhanceIndex=std::min(EnhancementLevel()+1,"Item.Item Max Enhancement Level"_I); if(IsEquippable()&&Inventory::GetItemCount(ActualName())==0)enhanceIndex=0; const EnhancementLevelInfo&info=GetEnhancementInfo()[enhanceIndex]; @@ -931,10 +931,9 @@ void Item::EnhanceItem(uint8_t qty){ Inventory::RemoveItem(Inventory::GetItem(name)[0],amt); } game->GetPlayer()->SetMoney(game->GetPlayer()->GetMoney()-consumedResources.GetCost()); - - SoundEffect::PlaySFX("Craft Item",SoundEffect::CENTERED); } } + SoundEffect::PlaySFX("Craft Item",SoundEffect::CENTERED); }; const std::vector>&ItemSet::GetSetBonusBreakpoints()const{ @@ -1079,7 +1078,7 @@ 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; - size_t enhanceIndex=EnhancementLevel()+1; + size_t enhanceIndex=std::min(EnhancementLevel()+1,"Item.Item Max Enhancement Level"_I); if(IsEquippable()&&Inventory::GetItemCount(ActualName())==0)enhanceIndex=0;//Equipment we don't have we need to first craft. 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. diff --git a/Adventures in Lestoria/RequiredMaterialsList.h b/Adventures in Lestoria/RequiredMaterialsList.h index 71699be2..cd97765d 100644 --- a/Adventures in Lestoria/RequiredMaterialsList.h +++ b/Adventures in Lestoria/RequiredMaterialsList.h @@ -70,7 +70,7 @@ protected: } if(itemRef.lock()->EnhancementIsPossible()){ - size_t enhancementIndex=itemRef.lock()->EnhancementLevel()+1; + size_t enhancementIndex=std::min(itemRef.lock()->EnhancementLevel()+1,"Item.Item Max Enhancement Level"_I); if(itemRef.lock()->IsEquippable()&&Inventory::GetItemCount(itemRef.lock()->ActualName())==0)enhancementIndex=0;//If we don't have the item, use the initial crafting list instead. But only for equipment! float drawWidth=rect.size.x/3; int index=0; diff --git a/Adventures in Lestoria/ShermanWindow.cpp b/Adventures in Lestoria/ShermanWindow.cpp index 93276c5e..94cd28b3 100644 --- a/Adventures in Lestoria/ShermanWindow.cpp +++ b/Adventures in Lestoria/ShermanWindow.cpp @@ -41,7 +41,7 @@ All rights reserved. #include "GameState.h" void Menu::InitializeShermanWindow(){ - Menu*shermanWindow=CreateMenu(SHERMAN,CENTERED,vi2d{144,60}); + Menu*shermanWindow=CreateMenu(SHERMAN,CENTERED,vi2d{144,88}); shermanWindow->ADD("Leave Button",MenuComponent)(geom2d::rect{{0.f,4.f},{144.f,24.f}},"Leave",MenuType::ENUM_END,[](MenuFuncData data){ GameState::ChangeState(States::OVERWORLD_MAP,0.3f); @@ -52,4 +52,8 @@ void Menu::InitializeShermanWindow(){ return true; },vf2d{2.f,2.f},ButtonAttr::FIT_TO_LABEL)END ->SetGrayedOut(true); + shermanWindow->ADD("Stay Button",MenuComponent)(geom2d::rect{{0.f,60.f},{144.f,24.f}},"Stay Here",MenuType::ENUM_END,[](MenuFuncData data){ + Menu::CloseMenu(); + return true; + },vf2d{2.f,2.f},ButtonAttr::FIT_TO_LABEL)END; } \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 4f9cd8a1..b856e73b 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 6677 +#define VERSION_BUILD 6687 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/audio/events.txt b/Adventures in Lestoria/assets/config/audio/events.txt index da03b993..dc098684 100644 --- a/Adventures in Lestoria/assets/config/audio/events.txt +++ b/Adventures in Lestoria/assets/config/audio/events.txt @@ -27,6 +27,16 @@ Events # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) File[0] = consume_item.ogg, 60% } + Craft Item + { + # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) + File[0] = item_craft.ogg, 70% + } + Craft Equip + { + # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) + File[0] = craft_equip.ogg, 70% + } Equip Armor { # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) @@ -63,11 +73,6 @@ Events # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) File[0] = item_sell.ogg, 80% } - Craft Item - { - # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) - File[0] = item_craft.ogg, 70% - } Enhance Item { # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) diff --git a/Adventures in Lestoria/assets/sounds/craft_equip.ogg b/Adventures in Lestoria/assets/sounds/craft_equip.ogg new file mode 100644 index 00000000..a61c85e9 Binary files /dev/null and b/Adventures in Lestoria/assets/sounds/craft_equip.ogg differ diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 622d3117..264a59fb 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ