diff --git a/src/otclient/core/thing.cpp b/src/otclient/core/thing.cpp index daf8e5fd..7f7328db 100644 --- a/src/otclient/core/thing.cpp +++ b/src/otclient/core/thing.cpp @@ -132,3 +132,8 @@ bool Thing::ignoreLook() { return m_type->properties[ThingType::IgnoreLook]; } + +bool Thing::isStackable() +{ + return m_type->properties[ThingType::IsStackable]; +} diff --git a/src/otclient/core/thing.h b/src/otclient/core/thing.h index 3a694e05..fcf493d8 100644 --- a/src/otclient/core/thing.h +++ b/src/otclient/core/thing.h @@ -77,6 +77,7 @@ public: bool isNotMoveable(); bool isPickupable(); bool ignoreLook(); + bool isStackable(); protected: void internalDraw(const Point& p, int layer); diff --git a/src/otclient/ui/uiitem.cpp b/src/otclient/ui/uiitem.cpp index 7a5dd020..b972e119 100644 --- a/src/otclient/ui/uiitem.cpp +++ b/src/otclient/ui/uiitem.cpp @@ -23,10 +23,12 @@ #include "uiitem.h" #include #include +#include UIItem::UIItem() { m_itemMargin = 0; + m_font = g_fonts.getFont("verdana-11px-rounded"); } void UIItem::render() @@ -34,8 +36,16 @@ void UIItem::render() renderSelf(); if(m_item) { + Point topLeft = m_rect.bottomRight() - Point(32, 32) + m_itemMargin; + g_painter.setColor(Fw::white); - m_item->draw(m_rect.bottomRight() - Point(32, 32) + m_itemMargin, m_rect); + m_item->draw(topLeft, m_rect); + + if(m_font && m_item->isStackable() && m_item->getData() > 1) { + std::string count = Fw::tostring(m_item->getData()); + m_font->renderText(count, Rect(m_rect.topLeft(), m_rect.bottomRight() - Point(3, 0)), Fw::AlignBottomRight, Color(231, 231, 231)); + dump << m_rect; + } } renderChildren(); diff --git a/src/otclient/ui/uiitem.h b/src/otclient/ui/uiitem.h index 55dcd45e..59e8ab5d 100644 --- a/src/otclient/ui/uiitem.h +++ b/src/otclient/ui/uiitem.h @@ -42,6 +42,7 @@ protected: private: ItemPtr m_item; int m_itemMargin; + FontPtr m_font; }; #endif