Merge pull request #104 from cpurules/bugfix/pet-cash-food

Allow pet cash food to increase closeness even when pet fullness is maxed
This commit is contained in:
Ponk
2022-08-19 07:09:58 +02:00
committed by GitHub
2 changed files with 7 additions and 2 deletions

View File

@@ -185,11 +185,16 @@ public class Pet extends Item {
}
public void gainClosenessFullness(Character owner, int incTameness, int incFullness, int type) {
gainClosenessFullness(owner, incTameness, incFullness, type, false);
}
public void gainClosenessFullness(Character owner, int incTameness, int incFullness, int type, boolean forceEnjoy) {
byte slot = owner.getPetIndex(this);
boolean enjoyed;
//will NOT increase pet's closeness if tried to feed pet with 100% fullness
if (fullness < 100 || incFullness == 0) { //incFullness == 0: command given
// unless forceEnjoy == true (cash shop)
if (fullness < 100 || incFullness == 0 || forceEnjoy) { //incFullness == 0: command given
int newFullness = fullness + incFullness;
if (newFullness > 100) {
newFullness = 100;

View File

@@ -419,7 +419,7 @@ public final class UseCashItemHandler extends AbstractPacketHandler {
Pair<Integer, Boolean> pair = pet.canConsume(itemId);
if (pair.getRight()) {
pet.gainClosenessFullness(player, pair.getLeft(), 100, 1);
pet.gainClosenessFullness(player, pair.getLeft(), 100, 1, true);
remove(c, position, itemId);
break;
}