Pets now run off when starving

This commit is contained in:
Ceikry
2022-04-18 12:59:14 +00:00
committed by Ryan
parent f454712c58
commit fbe78055cf
2 changed files with 18 additions and 2 deletions
@@ -60,9 +60,19 @@ public final class Pet extends Familiar {
petDetails.updateHunger(petDetails.getStage() == 0 ? 0.025 : 0.018); petDetails.updateHunger(petDetails.getStage() == 0 ? 0.025 : 0.018);
} }
double hunger = petDetails.getHunger(); double hunger = petDetails.getHunger();
if (hunger >= 90.0 && hunger < 90.025) { if (hunger >= 75.0 && hunger <= 90.0 && hunger % 5 == 0) {
owner.sendMessage("<col=ff0000>Your pet is getting hungry.</col>");
}
else if (hunger >= 90.0 && hunger % 1 == 0) {
owner.getPacketDispatch().sendMessage("<col=ff0000>Your pet is starving, feed it before it runs off.</col>"); owner.getPacketDispatch().sendMessage("<col=ff0000>Your pet is starving, feed it before it runs off.</col>");
} }
if (hunger >= 100.0 && growthRate != 0 && pet.getFood().length != 0) {
owner.getFamiliarManager().dismiss(false);
owner.getFamiliarManager().setFamiliar(null);
owner.getConfigManager().set(1175, 0);
owner.sendMessage("<col=ff0000>Your pet has run away.</col>");
return;
}
double growth = petDetails.getGrowth(); double growth = petDetails.getGrowth();
if (pet.getGrowthRate() > 0.000) { if (pet.getGrowthRate() > 0.000) {
petDetails.updateGrowth(pet.getGrowthRate()); petDetails.updateGrowth(pet.getGrowthRate());
@@ -2,6 +2,8 @@ package core.game.node.entity.skill.summoning.pet;
import rs09.game.world.GameWorld;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
/** /**
@@ -38,7 +40,11 @@ public final class PetDetails {
* @param amount The amount. * @param amount The amount.
*/ */
public void updateHunger(double amount) { public void updateHunger(double amount) {
if(GameWorld.getSettings().isDevMode()){
hunger += amount * 100;
} else {
hunger += amount; hunger += amount;
}
if (hunger < 0.0) { if (hunger < 0.0) {
hunger = 0.0; hunger = 0.0;
} else if (hunger > 100.0) { } else if (hunger > 100.0) {