Well my prices are load through my EconomyPrices.java. I couldn't figure out how they were being loaded so i change the code and made it load through a .txt file. After this i went to my pk shop and noticed that things were messedup. My Pk-Points shop sells thing in return for "Fist of Guthix tokens." Only one thing worked in the shop and that was dragon claws. The claws costs 54m tokens... So i check in my .txt file and it said the same thing. I was wondering if anyone could help me because i have no idea on how to solve this.
MY OLD EconomyPrices.java
Code:
package com.rs.utils;
import com.rs.cache.loaders.ItemDefinitions;
import com.rs.game.item.Item;
import com.rs.game.player.content.ItemConstants;
public final class EconomyPrices {
public static int getPrice(int itemId) {
ItemDefinitions defs = ItemDefinitions.getItemDefinitions(itemId);
if (defs.isNoted())
itemId = defs.getCertId();
else if (defs.isLended())
itemId = defs.getLendId();
if (!ItemConstants.isTradeable(new Item(itemId, 1)))
return 0;
if (itemId == 995) // TODO after here
return 1;
return defs.getValue() * 3; // TODO get price from real item from saved
// prices from ge
}
private EconomyPrices() {
}
}
MY CURRENT EconomyPrices.java
Code:
package com.rs.utils;
import java.io.IOException;
import com.rs.cache.loaders.ItemDefinitions;
import com.rs.game.item.Item;
import com.rs.game.player.content.ItemConstants;
public final class EconomyPrices {
public static int getPrice(int itemId) {
ItemDefinitions defs = ItemDefinitions.getItemDefinitions(itemId);
if (defs.isNoted())
itemId = defs.getCertId();
try {
for (String lines : FileUtilities.readFile("./data/items/grand_exchange/tipit_dump.txt")) {
String[] data = lines.split(" - ");
if (Integer.parseInt(data[0]) == itemId) return Integer.parseInt(data[1]);
}
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return -1;
}
private EconomyPrices() {
}
}
This is a picture of what the shop looks like and what it says when i click on something
Thanks for taking your time and reading this.
http://gyazo.com/3d07126a613140ce4e62a7fbcd1807fa
**This might be a fix*if someone could write a code* Idk how to write the code though
In my shopshandler.java to write a code that says
if currency = fist of guthix tokens(id 12852)
then load the prices from...
SOMETHING.txt
**
Hopefully that makes sense