Source: DSPK
Problem: Incorrect Wealth Updating?
Info: The problem I'm having is when I equip certain items it updates to the correct amount, but when it's in the inventory it seems to load an incorrect item price.
Pictures:
Calculating Code:
Code:
public int getEquipmentNet() {
int toReturn = 0;
for (int i = 0; i < c.playerEquipment.length; i++) {
toReturn += (c.getShops().getItemShopValue(c.playerEquipment[i]) * c.playerEquipmentN[i]);
}
return toReturn;
}
public int getInventoryNet() {
int toReturn = 0;
for (int i = 0; i < c.playerItems.length; i++) {
toReturn += (c.getShops().getItemShopValue(c.playerItems[i]) * c.playerItemsN[i]);
}
return toReturn;
}
Display Code:
Code:
public void DisplayWealthSafe() {
//int wealth = getItems().getCarriedWealth() + getPA().getWearingAmount2();
int wealth = getItems().getEquipmentNet() + getItems().getInventoryNet();
String wealthAdd = "";
if (wealth < 1000) {
wealthAdd = (""+wealth+"GP");
} else if (wealth >= 1000 && wealth < 1000000) {
wealthAdd = (""+wealth/1000+"K");
} else if (wealth >= 1000000 && wealth < 1000000000) {
wealthAdd = (""+wealth/1000000+" Million");
} else if (wealth >= 1000000000) {
wealthAdd = (""+wealth/1000000000+" Billion");
}
getPA().sendFrame126(""+wealthAdd+"", 21708);
}
The problem most likely is with the 'getInventoryNet()', any help would be much appreciated thanks.
MSN: [email protected]