examine plugin: format quantity of large item stacks

This commit is contained in:
Adam
2020-10-04 23:13:27 -04:00
parent 1ce0474336
commit 2f91100f17

View File

@@ -128,6 +128,21 @@ public class ExaminePlugin extends Plugin
Widget widget = client.getWidget(widgetGroup, widgetChild);
WidgetItem widgetItem = widget.getWidgetItem(event.getActionParam());
quantity = widgetItem != null && widgetItem.getId() >= 0 ? widgetItem.getQuantity() : 1;
// Examine on inventory items with more than 100000 quantity is handled locally and shows the item stack
// count, instead of sending the examine packet, so that you can see how many items are in the stack.
// Replace that message with one that formats the quantity using the quantity formatter instead.
if (quantity >= 100_000)
{
int itemId = event.getId();
final ChatMessageBuilder message = new ChatMessageBuilder()
.append(QuantityFormatter.formatNumber(quantity)).append(" x ").append(itemManager.getItemComposition(itemId).getName());
chatMessageManager.queue(QueuedMessage.builder()
.type(ChatMessageType.ITEM_EXAMINE)
.runeLiteFormattedMessage(message.build())
.build());
event.consume();
}
break;
}
case EXAMINE_ITEM_GROUND: