Skip to content

Commit

Permalink
feat: add always-show-count to UIItem
Browse files Browse the repository at this point in the history
Add always-show-count to UIItem to always show the item count
  • Loading branch information
BenDol committed Mar 1, 2023
1 parent 5a0bba3 commit abcf0fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/client/uiitem.cpp
Expand Up @@ -46,7 +46,7 @@ void UIItem::drawSelf(DrawPoolType drawPane)
m_item->draw(Point(exactSize - SPRITE_SIZE) + m_item->getDisplacement(), Otc::DrawThings, m_color);
g_drawPool.releaseFrameBuffer(getPaddingRect());

if (m_font && (m_item->isStackable() || m_item->isChargeable()) && m_item->getCountOrSubType() > 1) {
if (m_font && (m_alwaysShowCount || m_item->isStackable() || m_item->isChargeable()) && m_item->getCountOrSubType() > 1) {
static const Color STACK_COLOR(231, 231, 231);

const auto& count = std::to_string(m_item->getCountOrSubType());
Expand Down Expand Up @@ -92,5 +92,7 @@ void UIItem::onStyleApply(const std::string_view styleName, const OTMLNodePtr& s
setVirtual(node->value<bool>());
else if (node->tag() == "show-id")
m_showId = node->value<bool>();
else if (node->tag() == "always-show-count")
m_alwaysShowCount = node->value<bool>();
}
}
1 change: 1 addition & 0 deletions src/client/uiitem.h
Expand Up @@ -54,4 +54,5 @@ class UIItem : public UIWidget
bool m_virtual{ false };
bool m_showId{ false };
bool m_itemVisible{ true };
bool m_alwaysShowCount{ false };
};

0 comments on commit abcf0fa

Please sign in to comment.