Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add always-show-count to UIItem #445

Merged
merged 1 commit into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/client/uiitem.cpp
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 };
};