Add in hp and atk growth rate displays on level ups. Make increase and decrease buttons disable when the appropriate sell/buy amounts have been reached. Sell inventory count now shows up in the selling window. Add Lock/Unlock input helper display on merchant accessory sell window. Fix missing collision tile in 1-1. Release Build 7992. Patch Version 0.5.

This commit is contained in:
2024-03-07 04:16:20 -06:00
parent 68bdb6bc26
commit 588e184764
11 changed files with 85 additions and 25 deletions
+24 -5
View File
@@ -110,8 +110,12 @@ void Menu::InitializeMerchantWindow(){
auto inventoryDisplay=merchantWindow->ADD("Merchant Inventory Display",RowInventoryScrollableWindowComponent)(geom2d::rect<float>{{2,28},{220,merchantWindow->size.y-44}},"Item Name Label","Item Description Label",
[](MenuFuncData data){
std::weak_ptr<RowItemDisplay>item=DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component.lock());
int qty=1;
int pricePerItem=item.lock()->GetItem().lock()->BuyValue();
Component<MenuLabel>(BUY_ITEM,"Item Purchase Header")->S(A::ITEM_NAME)=item.lock()->GetItem().lock()->ActualName();
Component<MenuLabel>(BUY_ITEM,"Price per item Amount Label")->SetLabel(std::to_string(item.lock()->GetItem().lock()->BuyValue()));
Component<MenuLabel>(BUY_ITEM,"Price per item Amount Label")->SetLabel(std::to_string(pricePerItem));
Component<MenuLabel>(BUY_ITEM,"Amount to buy Amount Label")->SetLabel("1");
Component<MenuLabel>(BUY_ITEM,"Total Price Amount Label")->SetLabel(std::to_string(item.lock()->GetItem().lock()->BuyValue()));
Merchant&merchant=Merchant::GetCurrentTravelingMerchant();
@@ -122,6 +126,14 @@ void Menu::InitializeMerchantWindow(){
Component<MenuLabel>(BUY_ITEM,"Total Price Amount Label")->SetLabel(colorCode+std::to_string(item.lock()->GetItem().lock()->BuyValue()));
Component<MenuLabel>(BUY_ITEM,"Item Purchase Header")->SetLabel("Buying "+item.lock()->GetItem().lock()->DisplayName());
Component<MenuComponent>(BUY_ITEM,"Purchase Button")->SetGrayedOut(!merchant.CanPurchaseItem(item.lock()->GetItem().lock()->ActualName(),1));
Component<MenuComponent>(BUY_ITEM,"Decrease buy amount Button")->SetGrayedOut(true);
if(pricePerItem*(qty+1)>game->GetPlayer()->GetMoney()){
Component<MenuComponent>(BUY_ITEM,"Increase buy amount Button")->SetGrayedOut(true);
}else{
Component<MenuComponent>(BUY_ITEM,"Increase buy amount Button")->SetGrayedOut(false);
}
Menu::OpenMenu(BUY_ITEM);
return true;
},
@@ -185,7 +197,7 @@ void Menu::InitializeMerchantWindow(){
if(item.lock()->GetItem().lock()->CanBeSold()){
Component<ItemMenuLabel>(SELL_ITEM,"Item Sell Header")->SetItem(item.lock()->GetItem());
Component<MenuLabel>(SELL_ITEM,"Price per item Amount Label")->SetLabel(std::to_string(item.lock()->GetItem().lock()->SellValue()));
Component<MenuLabel>(SELL_ITEM,"Amount to sell Amount Label")->SetLabel("1");
Component<MenuLabel>(SELL_ITEM,"Amount to sell Amount Label")->SetLabel(std::format("{}/{}",1,Inventory::GetItemCount(item.lock()->GetItem().lock()->ActualName())));
Component<MenuLabel>(SELL_ITEM,"Total Price Amount Label")->SetLabel(std::to_string(item.lock()->GetItem().lock()->SellValue()));
Merchant&merchant=Merchant::GetCurrentTravelingMerchant();
bool canPurchase=merchant.CanSellItem(item.lock()->GetItem(),1);
@@ -195,6 +207,15 @@ void Menu::InitializeMerchantWindow(){
Component<MenuLabel>(SELL_ITEM,"Total Price Amount Label")->SetLabel(colorCode+std::to_string(item.lock()->GetItem().lock()->SellValue()));
Component<MenuLabel>(SELL_ITEM,"Item Sell Header")->SetLabel("Selling "+item.lock()->GetItem().lock()->DisplayName());
Component<MenuComponent>(SELL_ITEM,"Sell Button")->SetGrayedOut(!merchant.CanSellItem(item.lock()->GetItem(),1));
Component<MenuComponent>(SELL_ITEM,"Decrease sell amount Button")->SetGrayedOut(true);
int qty=1;
int inventoryQty=Inventory::GetItemCount(item.lock()->GetItem().lock()->ActualName());
if(qty>=inventoryQty){
Component<MenuComponent>(SELL_ITEM,"Increase sell amount Button")->SetGrayedOut(true);
}else{
Component<MenuComponent>(SELL_ITEM,"Increase sell amount Button")->SetGrayedOut(false);
}
Menu::OpenMenu(SELL_ITEM);
}
return true;
@@ -334,9 +355,7 @@ void Menu::InitializeMerchantWindow(){
}
}}},
{{game->KEY_SCROLL,Pressed},{"Navigate",[](MenuType type){}}},
{game->KEY_CONFIRM,{"Select",[](MenuType type){}}},
{game->KEY_SELECT,{[](MenuFuncData data){
/* //Too wordy, let's leave it out for now.
if(!data.menu.GetSelection().expired()&&
!data.menu.GetSelection().lock()->parentComponent.expired()&&
data.menu.GetSelection().lock()->parentComponent.lock()->GetName()=="Inventory Display - Accessories"){
@@ -345,7 +364,7 @@ void Menu::InitializeMerchantWindow(){
}else{
return "Lock";
}
}*/
}
return "";
},[](MenuType type){
if(!Menu::menus[type]->GetSelection().expired()&&