Anyways i'm adding a polypore staff to a 317, the staff has a maximum 3000 charges and can be recharged with 5 fire runes per 1 charge, so 15000 fire runes to fully recharge, well my problem is like if you have 200 charges left on the staff and then you take like 15000 fire runes and use it on the staff itll add to 3200 instead of 3000, i for the life of me cannot figure this simple thing out and am getting frustrated, please do not flame me as i already understand that i have failed on this lol.
Code:
if(c.ppsLeft < 3000 && itemUsed == 554 && useWith == 12494 || c.ppsLeft < 3000 && itemUsed == 12494 && useWith == 554) {
int getFireRune = c.getItems().getItemSlot(554);
int getAmount = c.getItems().getItemAmount(554) / 5 ;
int staffCharge = (3000 - c.ppsLeft) * 5;
int staffRecharge = 3000 - (c.ppsLeft + getAmount);
//int ppsRunes = (15000 - (3000 - c.ppsLeft) / 5;
c.getItems().deleteItem(554, c.getItems().getItemSlot(554), staffCharge);
c.ppsLeft += (3000 - staffRecharge);
c.sendMessage("You have recharged your Polypore Staff");
c.sendMessage("You have " + c.ppsLeft + " charges left!");
} else if (c.ppsLeft >= 3000 && itemUsed == 554 && useWith == 12494 || itemUsed == 12494 && useWith == 554) {
c.sendMessage("Your Polypore staff is already fully charged!");
}
that is my itemonitem, i have tried multiple math sequences to get this correct so dont mind what it is now. i am not that good at math ><