I'm making use of the ExchangeItem.java class multiple times throughout my code. On some occasions, fetching the price works and other times all price checks simply return 0.
Here's an example of price checks which return 0:
Item[] inventoryItems = getInventory().getItems();
int j;
for(j = 0; j < inventoryItems.length; j++){
Item currentItem = inventoryItems[j];
if (currentItem != null) {
log("currentItem: " + currentItem.toString());
int jId = currentItem.getId();
String jName = currentItem.getName();
ExchangeItem jItem = new ExchangeItem(jName, jId);
int jPrice = jItem.getPrice();
log("Price: " + jPrice); //returns 0
}
}
Log example:
[INFO][Bot #1][02/22 12:54:38 AM]: currentItem: Item id: 995, Name: Coins, Amount: 8000
[INFO][Bot #1][02/22 12:54:38 AM]: Price: 0
[INFO][Bot #1][02/22 12:54:38 AM]: currentItem: Item id: 12288, Name: Mithril platebody (t), Amount: 1
[INFO][Bot #1][02/22 12:54:38 AM]: Price: 0
[INFO][Bot #1][02/22 12:54:38 AM]: currentItem: Item id: 1051, Name: Santa hat, Amount: 17
[INFO][Bot #1][02/22 12:54:39 AM]: Price: 0
[INFO][Bot #1][02/22 12:54:39 AM]: currentItem: Item id: 6740, Name: Dragon axe, Amount: 11
[INFO][Bot #1][02/22 12:54:39 AM]: Price: 0
Why is this happening?