Add labels for items that can be crafted or enhanced at the blacksmith

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
pull/35/head
Nic0Nic0Nii 10 months ago
parent 8149db260b
commit 00e7a01ab1
  1. 14
      Adventures in Lestoria/InventoryCreator.cpp
  2. 8
      Adventures in Lestoria/MenuComponent.cpp
  3. 1
      Adventures in Lestoria/MenuComponent.h
  4. 2
      Adventures in Lestoria/MenuLabel.h
  5. 16
      Adventures in Lestoria/RowItemDisplay.h
  6. 1
      Adventures in Lestoria/TODO.txt
  7. 12
      Adventures in Lestoria/assets/config/items/items.txt

@ -30,7 +30,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Portions of this software are copyright © 2023 The FreeType
Portions of this software are copyright <EFBFBD> 2023 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
@ -161,7 +161,11 @@ std::function<void(InventoryScrollableWindowComponent&component,ITCategory cat)>
int itemIndex=y*invWidth+x;
auto newItem=c->ADD("item_Weapon_"+std::to_string(itemIndex),RowItemDisplay)(geom2d::rect<float>{totalSpacing*vf2d{float(x),float(y)},buttonSize},weapon,c->inventoryButtonClickAction,c->itemNameLabelName,c->itemDescriptionLabelName,c->inventoryButtonsActive?ButtonAttr::NONE:ButtonAttr::UNSELECTABLE)END;
newItem->SetCompactDescriptions(c->compact);
newItem->SetPriceLabelType(c->priceLabel);
if(Inventory::GetItemCount(weapon.lock()->ActualName())==0){ //An item that is not in our inventory is considered craftable..
newItem->SetPriceLabelType(PriceLabel::CRAFTABLE);
}else{ //Items that we do have are considered upgradeable.
newItem->SetPriceLabelType(PriceLabel::UPGRADEABLE);
}
newItem->SetHoverFunc(c->inventoryButtonHoverAction);
newItem->SetMouseOutFunc(c->inventoryButtonMouseOutAction);
newItem->SetCheckCraftingRequirements(true);
@ -194,7 +198,11 @@ std::function<void(InventoryScrollableWindowComponent&component,ITCategory cat)>
int itemIndex=y*invWidth+x;
auto newItem=c->ADD("item_Armor_"+std::to_string(itemIndex),RowItemDisplay)(geom2d::rect<float>{totalSpacing*vf2d{float(x),float(y)},buttonSize},armor,c->inventoryButtonClickAction,c->itemNameLabelName,c->itemDescriptionLabelName,c->inventoryButtonsActive?ButtonAttr::NONE:ButtonAttr::UNSELECTABLE)END;
newItem->SetCompactDescriptions(c->compact);
newItem->SetPriceLabelType(c->priceLabel);
if(Inventory::GetItemCount(armor.lock()->ActualName())==0){ //An item that is not in our inventory is considered craftable..
newItem->SetPriceLabelType(PriceLabel::CRAFTABLE);
}else{ //Items that we do have are considered upgradeable.
newItem->SetPriceLabelType(PriceLabel::UPGRADEABLE);
}
newItem->SetHoverFunc(c->inventoryButtonHoverAction);
newItem->SetMouseOutFunc(c->inventoryButtonMouseOutAction);
newItem->SetCheckCraftingRequirements(true);

@ -99,10 +99,10 @@ void MenuComponent::DrawDecal(ViewPort&window,bool focused){
window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET),rect.size,PixelLerp(Menu::themes[Menu::themeSelection].GetButtonCol(),Menu::themes[Menu::themeSelection].GetHighlightCol(),util::lerp(0.75f,1.0f,hoverEffect/"ThemeGlobal.HighlightTime"_F)));
}
if(border){
window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET),{rect.size.x+1,1});
window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET),{1,rect.size.y+1});
window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET)+vf2d{rect.size.x-1+1,0},{1,rect.size.y+1});
window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET)+vf2d{0,rect.size.y-1+1},{rect.size.x+1,1});
window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET),{rect.size.x+1,1},borderCol);
window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET),{1,rect.size.y+1},borderCol);
window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET)+vf2d{rect.size.x-1+1,0},{1,rect.size.y+1},borderCol);
window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET)+vf2d{0,rect.size.y-1+1},{rect.size.x+1,1},borderCol);
}
if(showDefaultLabel){
vf2d adjustedScale=labelScaling;

@ -114,6 +114,7 @@ protected:
bool fitToLabel=false; //Will shrink text horizontally to fit the size of the label if the display text is too large.
bool grayedOut=false; //If turned on, a button will appear grayed out and unresponsive.
int inventoryIndex=0;
Pixel borderCol=WHITE;
vf2d labelScaling={1,1};
virtual void Update(AiL*game);
virtual void DrawDecal(ViewPort&window,bool focused);

@ -65,7 +65,7 @@ public:
showDefaultLabel=false;
fitToLabel=attributes&ComponentAttr::FIT_TO_LABEL;
}
inline virtual void SetLabel(std::string text){
inline virtual void SetLabel(std::string text)override{
label=text;
if(runOnLabelChangeFunc)onLabelChangeFunc(text);
}

@ -116,9 +116,23 @@ public:
}
if(priceLabel!=PriceLabel::NONE){
borderCol=WHITE;
switch(priceLabel){
case PriceLabel::CRAFTABLE:{
//An item can be crafted if we do not have it and we are on the correct chapter.
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){
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=GREY;
}else{
vf2d craftableTextSize=vf2d(game->GetTextSizeProp("Item.Upgradeable Item Text"_S))*vf2d{1.f,0.85f};
window.DrawShadowStringPropDecal(rect.pos+vf2d{rect.size.x-craftableTextSize.x-1,3},"Item.Upgradeable Item Text"_S,"Item.Upgradeable Item Text Color"_Pixel,BLACK,{1.f,0.85f});
borderCol=YELLOW;
}
}break;
case PriceLabel::SELL_LABEL:{
std::string priceText=std::to_string(itemRef.lock()->SellValue());

@ -23,6 +23,7 @@ Settings Menu
- Clamp bosses in boss arenas.
- Track items used during a stage, on death, restore the loadout item quantities used.
- Stage Plate Navigation bugs
January 31st
============

@ -15,6 +15,18 @@ Item
Item Max Enhancement Level = 10
# The name of the currency in the game.
Currency Name = Gold
# Text that displays when items are craftable in the Blacksmith.
Craftable Item Text = Can Craft
# Color of the text that displays when items are craftable in the Blacksmith.
Craftable Item Text Color = 0,255,0,255
# Text that displays when items can be upgraded in the Blacksmith.
Upgradeable Item Text = Upgrade!
# Color of the text that displays when items can be upgraded in the Blacksmith.
Upgradeable Item Text Color = 255,255,0,255
# Text that displays when items can be upgraded in the Blacksmith but the player doesn't have enough material.
Missing Upgradeable Item Text = Missing Materials
# Color of the text that displays when items can be upgraded in the Blacksmith but the player doesn't have enough material.
Missing Upgradeable Item Text Color = 192,0,0,255
}
ItemDrop
{

Loading…
Cancel
Save