runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java
/**
	 * Looks up the item price and changes the original message to the
	 * response.
	 *
	 * @param messageNode The chat message containing the command.
	 * @param search The item given with the command.
	 */
Looks up the item price and changes the original message to the
response.

@param messageNode The chat message containing the command.
@param search The item given with the command.
Looks up the item price and changes the original message to the response . @param messageNode The chat message containing the command . @param search The item given with the command .
private void itemPriceLookup(MessageNode messageNode, String search)
	{
		SearchResult result;
		try
		{
			result = itemManager.searchForItem(search);
		}
		catch (ExecutionException ex)
		{
			log.warn("Unable to search for item {}", search, ex);
			return;
		}
		if (result != null && !result.getItems().isEmpty())
		{
			Item item = retrieveFromList(result.getItems(), search);
			if (item == null)
			{
				log.debug("Unable to find item {} in result {}", search, result);
				return;
			}
			int itemId = item.getId();
			ItemPrice itemPrice;
			try
			{
				itemPrice = itemManager.getItemPrice(itemId);
			}
			catch (IOException ex)
			{
				log.warn("Unable to fetch item price for {}", itemId, ex);
				return;
			}
			final ChatMessageBuilder builder = new ChatMessageBuilder()
				.append(ChatColorType.NORMAL)
				.append("Price of ")
				.append(ChatColorType.HIGHLIGHT)
				.append(item.getName())
				.append(ChatColorType.NORMAL)
				.append(": GE average ")
				.append(ChatColorType.HIGHLIGHT)
				.append(StackFormatter.formatNumber(itemPrice.getPrice()));
			ItemComposition itemComposition = itemManager.getItemComposition(itemId);
			if (itemComposition != null)
			{
				int alchPrice = Math.round(itemComposition.getPrice() * HIGH_ALCHEMY_CONSTANT);
				builder
					.append(ChatColorType.NORMAL)
					.append(" HA value ")
					.append(ChatColorType.HIGHLIGHT)
					.append(StackFormatter.formatNumber(alchPrice));
			}
			String response = builder.build();
			log.debug("Setting response {}", response);
			messageNode.setRuneLiteFormatMessage(response);
			chatMessageManager.update(messageNode);
			client.refreshChat();
		}
	}
private void itemPriceLookup ( MessageNode messageNode , String search ) { SearchResult result ; try { result = itemManager . searchForItem ( search ) ; } catch ( ExecutionException ex ) { log . warn ( "Unable to search for item {}" , search , ex ) ; return ; } if ( result != null && ! result . getItems ( ) . isEmpty ( ) ) { Item item = retrieveFromList ( result . getItems ( ) , search ) ; if ( item == null ) { log . debug ( "Unable to find item {} in result {}" , search , result ) ; return ; } int itemId = item . getId ( ) ; ItemPrice itemPrice ; try { itemPrice = itemManager . getItemPrice ( itemId ) ; } catch ( IOException ex ) { log . warn ( "Unable to fetch item price for {}" , itemId , ex ) ; return ; } final ChatMessageBuilder builder = new ChatMessageBuilder ( ) . append ( ChatColorType . NORMAL ) . append ( "Price of " ) . append ( ChatColorType . HIGHLIGHT ) . append ( item . getName ( ) ) . append ( ChatColorType . NORMAL ) . append ( ": GE average " ) . append ( ChatColorType . HIGHLIGHT ) . append ( StackFormatter . formatNumber ( itemPrice . getPrice ( ) ) ) ; ItemComposition itemComposition = itemManager . getItemComposition ( itemId ) ; if ( itemComposition != null ) { int alchPrice = Math . round ( itemComposition . getPrice ( ) * HIGH_ALCHEMY_CONSTANT ) ; builder . append ( ChatColorType . NORMAL ) . append ( " HA value " ) . append ( ChatColorType . HIGHLIGHT ) . append ( StackFormatter . formatNumber ( alchPrice ) ) ; } String response = builder . build ( ) ; log . debug ( "Setting response {}" , response ) ; messageNode . setRuneLiteFormatMessage ( response ) ; chatMessageManager . update ( messageNode ) ; client . refreshChat ( ) ; } }
Looks up the item price and changes the original message to the
 response.
Looks up the item price and changes the original message to the response .