From 2b76e9fed1d0d0ec909d1cd36893ac38bbd88c06 Mon Sep 17 00:00:00 2001 From: grbr404 <166065505+grbr404@users.noreply.github.com> Date: Thu, 5 Jun 2025 19:35:50 +0200 Subject: try 2 --- source/windowing/StarItemSlotWidget.cpp | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'source/windowing/StarItemSlotWidget.cpp') diff --git a/source/windowing/StarItemSlotWidget.cpp b/source/windowing/StarItemSlotWidget.cpp index 4ba3425..41fbc20 100644 --- a/source/windowing/StarItemSlotWidget.cpp +++ b/source/windowing/StarItemSlotWidget.cpp @@ -185,14 +185,31 @@ void ItemSlotWidget::renderImpl() { } } - int frame = (int)roundf(m_progress * 18); // TODO: Hardcoded lol - context()->drawInterfaceQuad(String(strf("/interface/cooldown.png:{}", frame)), Vec2F(screenPosition())); + if (m_item->count() > 1 && m_showCount) { // we don't need to tell people that there's only 1 of something + uint32_t count = m_item->count();Add commentMore actions + std::string formattedCount; + + if (count >= 1000000000000000) { // Quadrillions (Q) + formattedCount = toString(count / 1000000000000000) + "Q"; + } else if (count >= 1000000000) { // Billions (B) + formattedCount = toString(count / 1000000000) + "B"; + } else if (count >= 1000000) { // Millions (M) + formattedCount = toString(count / 1000000) + "M"; + } else if (count >= 1000) { // Thousands (K) + formattedCount = toString(count / 1000) + "K"; + } else { + formattedCount = toString(count); + } + + // Ensure formatted count is at most 4 characters long + if (formattedCount.length() > 4) { + formattedCount = formattedCount.substr(0, 4); + } - if (m_item->count() > 1 && m_showCount) { // we don't need to tell people that there's only 1 of something - context()->setTextStyle(m_textStyle); - context()->setFontMode(m_countFontMode); - context()->renderInterfaceText(toString(m_item->count()), m_countPosition.translated(Vec2F(screenPosition()))); - context()->clearTextStyle(); + context()->setTextStyle(m_textStyle); + context()->setFontMode(m_countFontMode); + context()->renderInterfaceText(formattedCount, m_countPosition.translated(Vec2F(screenPosition()))); + context()->clearTextStyle(); } } else if (m_drawBackingImageWhenEmpty && m_backingImage != "") { -- cgit v1.2.3 From 442964bb330a0337d12aab607b9ce7b1b8a20af6 Mon Sep 17 00:00:00 2001 From: grbr404 <166065505+grbr404@users.noreply.github.com> Date: Thu, 5 Jun 2025 19:51:31 +0200 Subject: Update StarItemSlotWidget.cpp --- source/windowing/StarItemSlotWidget.cpp | 35 ++++++++++++++------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'source/windowing/StarItemSlotWidget.cpp') diff --git a/source/windowing/StarItemSlotWidget.cpp b/source/windowing/StarItemSlotWidget.cpp index 41fbc20..c8aa79c 100644 --- a/source/windowing/StarItemSlotWidget.cpp +++ b/source/windowing/StarItemSlotWidget.cpp @@ -185,32 +185,27 @@ void ItemSlotWidget::renderImpl() { } } - if (m_item->count() > 1 && m_showCount) { // we don't need to tell people that there's only 1 of something - uint32_t count = m_item->count();Add commentMore actions - std::string formattedCount; - - if (count >= 1000000000000000) { // Quadrillions (Q) - formattedCount = toString(count / 1000000000000000) + "Q"; - } else if (count >= 1000000000) { // Billions (B) - formattedCount = toString(count / 1000000000) + "B"; - } else if (count >= 1000000) { // Millions (M) - formattedCount = toString(count / 1000000) + "M"; - } else if (count >= 1000) { // Thousands (K) - formattedCount = toString(count / 1000) + "K"; - } else { - formattedCount = toString(count); - } - - // Ensure formatted count is at most 4 characters long - if (formattedCount.length() > 4) { - formattedCount = formattedCount.substr(0, 4); +if (m_item->count() > 1 && m_showCount) { // we don't need to tell people that there's only 1 of something + uint32_t count = m_item->count(); + std::string formattedCount; + + if (count >= 1000000000000000) { // Quadrillions (Q) + formattedCount = toString(count / 1000000000000000) + "Q"; + } else if (count >= 1000000000) { // Billions (B) + formattedCount = toString(count / 1000000000) + "B"; + } else if (count >= 1000000) { // Millions (M) + formattedCount = toString(count / 1000000) + "M"; + } else if (count >= 1000) { // Thousands (K) + formattedCount = toString(count / 1000) + "K"; + } else { + formattedCount = toString(count); } context()->setTextStyle(m_textStyle); context()->setFontMode(m_countFontMode); context()->renderInterfaceText(formattedCount, m_countPosition.translated(Vec2F(screenPosition()))); context()->clearTextStyle(); - } +} } else if (m_drawBackingImageWhenEmpty && m_backingImage != "") { context()->drawInterfaceQuad(m_backingImage, Vec2F(screenPosition())); -- cgit v1.2.3 From f4217740b311b24d4bc0aa51633a0d342ab76086 Mon Sep 17 00:00:00 2001 From: grbr404 <166065505+grbr404@users.noreply.github.com> Date: Thu, 5 Jun 2025 20:07:00 +0200 Subject: try 4 --- source/windowing/StarItemSlotWidget.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'source/windowing/StarItemSlotWidget.cpp') diff --git a/source/windowing/StarItemSlotWidget.cpp b/source/windowing/StarItemSlotWidget.cpp index c8aa79c..bd2e26b 100644 --- a/source/windowing/StarItemSlotWidget.cpp +++ b/source/windowing/StarItemSlotWidget.cpp @@ -186,19 +186,23 @@ void ItemSlotWidget::renderImpl() { } if (m_item->count() > 1 && m_showCount) { // we don't need to tell people that there's only 1 of something - uint32_t count = m_item->count(); std::string formattedCount; - if (count >= 1000000000000000) { // Quadrillions (Q) - formattedCount = toString(count / 1000000000000000) + "Q"; - } else if (count >= 1000000000) { // Billions (B) - formattedCount = toString(count / 1000000000) + "B"; - } else if (count >= 1000000) { // Millions (M) - formattedCount = toString(count / 1000000) + "M"; - } else if (count >= 1000) { // Thousands (K) - formattedCount = toString(count / 1000) + "K"; + if (m_item->count() >= 1000000000000000) { // Quadrillions (Q) + formattedCount = toString(m_item->count() / 1000000000000000) + "Q"; + } else if (m_item->count() >= 1000000000) { // Billions (B) + formattedCount = toString(m_item->count() / 1000000000) + "B"; + } else if (m_item->count() >= 1000000) { // Millions (M) + formattedCount = toString(m_item->count() / 1000000) + "M"; + } else if (m_item->count() >= 1000) { // Thousands (K) + formattedCount = toString(m_item->count() / 1000) + "K"; } else { - formattedCount = toString(count); + formattedCount = toString(m_item->count()); + } + + // Ensure formatted count is at most 4 characters long + if (formattedCount.length() > 4) { + formattedCount = formattedCount.substr(0, 4); } context()->setTextStyle(m_textStyle); -- cgit v1.2.3 From aafc44a77e46c25e6097b98e7fdae76ef4aee7cd Mon Sep 17 00:00:00 2001 From: grbr404 <166065505+grbr404@users.noreply.github.com> Date: Thu, 5 Jun 2025 22:08:15 +0200 Subject: made it support up to max posible stack amount --- source/windowing/StarItemSlotWidget.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'source/windowing/StarItemSlotWidget.cpp') diff --git a/source/windowing/StarItemSlotWidget.cpp b/source/windowing/StarItemSlotWidget.cpp index bd2e26b..232f5e1 100644 --- a/source/windowing/StarItemSlotWidget.cpp +++ b/source/windowing/StarItemSlotWidget.cpp @@ -188,14 +188,20 @@ void ItemSlotWidget::renderImpl() { if (m_item->count() > 1 && m_showCount) { // we don't need to tell people that there's only 1 of something std::string formattedCount; - if (m_item->count() >= 1000000000000000) { // Quadrillions (Q) - formattedCount = toString(m_item->count() / 1000000000000000) + "Q"; - } else if (m_item->count() >= 1000000000) { // Billions (B) - formattedCount = toString(m_item->count() / 1000000000) + "B"; - } else if (m_item->count() >= 1000000) { // Millions (M) - formattedCount = toString(m_item->count() / 1000000) + "M"; - } else if (m_item->count() >= 1000) { // Thousands (K) - formattedCount = toString(m_item->count() / 1000) + "K"; + if (m_item->count() >= 1000000000000000000000) { // Sextillion (S) + formattedCount = toString(m_item->count() / 1000000000000000000000) + "S"; + } else if (m_item->count() >= 1000000000000000000) { // Quintillion (Q) + formattedCount = toString(m_item->count() / 1000000000000000000) + "Q"; + } else if (m_item->count() >= 1000000000000000) { // Quadrillion (q) + formattedCount = toString(m_item->count() / 1000000000000000) + "q"; + } else if (m_item->count() >= 1000000000000) { // Trillion (t) + formattedCount = toString(m_item->count() / 1000000000000) + "t"; + } else if (m_item->count() >= 1000000000) { // Billion (b) + formattedCount = toString(m_item->count() / 1000000000) + "b"; + } else if (m_item->count() >= 1000000) { // Million (m) + formattedCount = toString(m_item->count() / 1000000) + "m"; + } else if (m_item->count() >= 1000) { // Thousand (k) + formattedCount = toString(m_item->count() / 1000) + "k"; } else { formattedCount = toString(m_item->count()); } -- cgit v1.2.3 From b992c2af94ac81401b3fb9376809bf9d5f2870d2 Mon Sep 17 00:00:00 2001 From: grbr404 <166065505+grbr404@users.noreply.github.com> Date: Thu, 5 Jun 2025 22:52:00 +0200 Subject: maybe this fixes it --- source/windowing/StarItemSlotWidget.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'source/windowing/StarItemSlotWidget.cpp') diff --git a/source/windowing/StarItemSlotWidget.cpp b/source/windowing/StarItemSlotWidget.cpp index 232f5e1..a54a83b 100644 --- a/source/windowing/StarItemSlotWidget.cpp +++ b/source/windowing/StarItemSlotWidget.cpp @@ -186,6 +186,7 @@ void ItemSlotWidget::renderImpl() { } if (m_item->count() > 1 && m_showCount) { // we don't need to tell people that there's only 1 of something + uint64_t count = m_item->count(); std::string formattedCount; if (m_item->count() >= 1000000000000000000000) { // Sextillion (S) -- cgit v1.2.3 From f9ead10fc7830e3b522fcc7cc615087a48fd6c16 Mon Sep 17 00:00:00 2001 From: grbr404 <166065505+grbr404@users.noreply.github.com> Date: Thu, 5 Jun 2025 22:56:00 +0200 Subject: removed the to big ones --- source/windowing/StarItemSlotWidget.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'source/windowing/StarItemSlotWidget.cpp') diff --git a/source/windowing/StarItemSlotWidget.cpp b/source/windowing/StarItemSlotWidget.cpp index a54a83b..b579e7c 100644 --- a/source/windowing/StarItemSlotWidget.cpp +++ b/source/windowing/StarItemSlotWidget.cpp @@ -186,14 +186,9 @@ void ItemSlotWidget::renderImpl() { } if (m_item->count() > 1 && m_showCount) { // we don't need to tell people that there's only 1 of something - uint64_t count = m_item->count(); std::string formattedCount; - if (m_item->count() >= 1000000000000000000000) { // Sextillion (S) - formattedCount = toString(m_item->count() / 1000000000000000000000) + "S"; - } else if (m_item->count() >= 1000000000000000000) { // Quintillion (Q) - formattedCount = toString(m_item->count() / 1000000000000000000) + "Q"; - } else if (m_item->count() >= 1000000000000000) { // Quadrillion (q) + if (m_item->count() >= 1000000000000000) { // Quadrillion (q) formattedCount = toString(m_item->count() / 1000000000000000) + "q"; } else if (m_item->count() >= 1000000000000) { // Trillion (t) formattedCount = toString(m_item->count() / 1000000000000) + "t"; -- cgit v1.2.3 From 08787a9f8b99c4a41d0e8ab7a2d053e81f7237b7 Mon Sep 17 00:00:00 2001 From: grbr404 <166065505+grbr404@users.noreply.github.com> Date: Thu, 5 Jun 2025 23:04:57 +0200 Subject: Update StarItemSlotWidget.cpp --- source/windowing/StarItemSlotWidget.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'source/windowing/StarItemSlotWidget.cpp') diff --git a/source/windowing/StarItemSlotWidget.cpp b/source/windowing/StarItemSlotWidget.cpp index b579e7c..73a554f 100644 --- a/source/windowing/StarItemSlotWidget.cpp +++ b/source/windowing/StarItemSlotWidget.cpp @@ -197,16 +197,11 @@ if (m_item->count() > 1 && m_showCount) { // we don't need to tell people that } else if (m_item->count() >= 1000000) { // Million (m) formattedCount = toString(m_item->count() / 1000000) + "m"; } else if (m_item->count() >= 1000) { // Thousand (k) - formattedCount = toString(m_item->count() / 1000) + "k"; + formattedCount = toString(m_item->count() / 10000) + "k"; } else { formattedCount = toString(m_item->count()); } - // Ensure formatted count is at most 4 characters long - if (formattedCount.length() > 4) { - formattedCount = formattedCount.substr(0, 4); - } - context()->setTextStyle(m_textStyle); context()->setFontMode(m_countFontMode); context()->renderInterfaceText(formattedCount, m_countPosition.translated(Vec2F(screenPosition()))); -- cgit v1.2.3 From fbb8fa5c1a23aa6a90adb5d0c002bd8ffcfba3a7 Mon Sep 17 00:00:00 2001 From: grbr404 <166065505+grbr404@users.noreply.github.com> Date: Thu, 5 Jun 2025 23:39:42 +0200 Subject: Update StarItemSlotWidget.cpp --- source/windowing/StarItemSlotWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/windowing/StarItemSlotWidget.cpp') diff --git a/source/windowing/StarItemSlotWidget.cpp b/source/windowing/StarItemSlotWidget.cpp index 73a554f..2d47d8a 100644 --- a/source/windowing/StarItemSlotWidget.cpp +++ b/source/windowing/StarItemSlotWidget.cpp @@ -196,8 +196,8 @@ if (m_item->count() > 1 && m_showCount) { // we don't need to tell people that formattedCount = toString(m_item->count() / 1000000000) + "b"; } else if (m_item->count() >= 1000000) { // Million (m) formattedCount = toString(m_item->count() / 1000000) + "m"; - } else if (m_item->count() >= 1000) { // Thousand (k) - formattedCount = toString(m_item->count() / 10000) + "k"; + } else if (m_item->count() >= 10000) { // Thousand (k) + formattedCount = toString(m_item->count() / 1000) + "k"; } else { formattedCount = toString(m_item->count()); } -- cgit v1.2.3