Ive done my potion/food system differently so i downloaded soul-split PI and just added this to the default system it is basic and sure you can clean it up/redo it but its the correct effect.
Tired of seeing all these repeated effects that aren't even correct
Code:
public boolean torva() {
if (playerEquipment[playerHat] == 20135 && playerEquipment[playerLegs] == 20143 && playerEquipment[playerChest] == 20139
|| playerEquipment[playerHat] == 20147 && playerEquipment[playerLegs] == 20151 && playerEquipment[playerChest] == 20155
|| playerEquipment[playerHat] == 20159 && playerEquipment[playerLegs] == 20163 && playerEquipment[playerChest] == 20167) {
return true;
}
return false;
}
Code:
public void doTheBrew(int itemId, int replaceItem, int slot) {
if (c.duelRule[6]) {
c.sendMessage("You may not eat in this duel.");
return;
}
c.startAnimation(829);
c.playerItems[slot] = replaceItem + 1;
c.getItems().resetItems(3214);
int[] toDecrease = {0,2,4,6};
int[] toIncrease = {1,3};
for (int tD : toDecrease) {
c.playerLevel[tD] -= getBrewStat(tD, .10);
if (c.playerLevel[tD] < 0)
c.playerLevel[tD] = 1;
c.getPA().refreshSkill(tD);
c.getPA().setSkillLevel(tD, c.playerLevel[tD], c.playerXP[tD]);
}
c.playerLevel[1] += getBrewStat(1, .20);
if (c.playerLevel[1] > (c.getLevelForXP(c.playerXP[1])*1.2 + 1)) {
c.playerLevel[1] = (int)(c.getLevelForXP(c.playerXP[1])*1.2);
}
c.getPA().refreshSkill(1);
double ammount = c.torva() ? 1.22 : 1.17;
c.playerLevel[3] += c.torva() ? getBrewStat(3, .21) : getBrewStat(3, .15);
if (c.playerLevel[3] > (c.getLevelForXP(c.playerXP[3])* ammount + 1)) {
c.playerLevel[3] = (int)(c.getLevelForXP(c.playerXP[3])*ammount);
}
c.getPA().refreshSkill(3);
message(itemId);
}
Code:
public int gwdarmourStat(double amount) {
return (int)(c.getLevelForXP(c.playerXP[3]) * amount);
}
Code:
public void eat(int id, int slot) {
if (c.duelRule[6]) {
c.sendMessage("You may not eat in this duel.");
return;
}
if (System.currentTimeMillis() - c.foodDelay >= 1500 && c.playerLevel[3] > 0) {
c.getCombat().resetPlayerAttack();
c.attackTimer += 2;
c.startAnimation(829);
c.getItems().deleteItem(id,slot,1);
FoodToEat f = FoodToEat.food.get(id);
if (c.playerLevel[3] < gwdarmourStat(1.41) && c.torva()) {
c.playerLevel[3] += f.getHeal();
if (c.playerLevel[3] > gwdarmourStat(1.41))
c.playerLevel[3] = gwdarmourStat(1.41);
}
else if (c.playerLevel[3] < c.getLevelForXP(c.playerXP[3]) && !c.torva()) {
c.playerLevel[3] += f.getHeal();
if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
}
c.foodDelay = System.currentTimeMillis();
c.getPA().refreshSkill(3);
c.sendMessage("You eat the " + f.getName() + ".");
}
}
The codes are here you must add them yourselves, i hope i see no posts asking for help because all you really have to do is replace old methods.
Updated: Forgot 1 method.
Code:
public void message(int itemId) {
String name = c.getItems().getItemName(itemId);
c.sendMessage("You drink 1 dose of "+ name);
c.sendMessage(name.contains("(4)") ? "You now have 3 doses left" :
name.contains("(3)") ? "You now have 2 doses left" :
name.contains("(2)") ? "You now have 1 doses left" : "You now have 0 doses left");
}