Commit to "tameness" name over "closeness" for pets, fix scripts

This commit is contained in:
P0nk
2022-09-15 17:12:21 +02:00
parent 125d0aa03d
commit 1a28fc98ac
11 changed files with 18 additions and 18 deletions

View File

@@ -184,15 +184,15 @@ public class Pet extends Item {
return level;
}
public void gainClosenessFullness(Character owner, int incTameness, int incFullness, int type) {
gainClosenessFullness(owner, incTameness, incFullness, type, false);
public void gainTamenessFullness(Character owner, int incTameness, int incFullness, int type) {
gainTamenessFullness(owner, incTameness, incFullness, type, false);
}
public void gainClosenessFullness(Character owner, int incTameness, int incFullness, int type, boolean forceEnjoy) {
public void gainTamenessFullness(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
//will NOT increase pet's tameness if tried to feed pet with 100% fullness
// unless forceEnjoy == true (cash shop)
if (fullness < 100 || incFullness == 0 || forceEnjoy) { //incFullness == 0: command given
int newFullness = fullness + incFullness;

View File

@@ -53,7 +53,7 @@ public final class PetCommandHandler extends AbstractPacketHandler {
}
if (Randomizer.nextInt(100) < petCommand.getProbability()) {
pet.gainClosenessFullness(chr, petCommand.getIncrease(), 0, command);
pet.gainTamenessFullness(chr, petCommand.getIncrease(), 0, command);
chr.getMap().broadcastMessage(PacketCreator.commandResponse(chr.getId(), petIndex, false, command, false));
} else {
chr.getMap().broadcastMessage(PacketCreator.commandResponse(chr.getId(), petIndex, true, command, false));

View File

@@ -81,7 +81,7 @@ public final class PetFoodHandler extends AbstractPacketHandler {
return;
}
pet.gainClosenessFullness(chr, (pet.getFullness() <= 75) ? 1 : 0, 30, 1); // 25+ "emptyness" to get +1 closeness
pet.gainTamenessFullness(chr, (pet.getFullness() <= 75) ? 1 : 0, 30, 1); // 25+ "emptyness" to get +1 tameness
InventoryManipulator.removeFromSlot(c, InventoryType.USE, pos, (short) 1, false);
} finally {
useInv.unlockInventory();

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, true);
pet.gainTamenessFullness(player, pair.getLeft(), 100, 1, true);
remove(c, position, itemId);
break;
}

View File

@@ -340,10 +340,10 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
getClient().getChannelServer().getMapFactory().getMap(mapid).resetReactors();
}
public void gainCloseness(int closeness) {
public void gainTameness(int tameness) {
for (Pet pet : getPlayer().getPets()) {
if (pet != null) {
pet.gainClosenessFullness(getPlayer(), closeness, 0, 0);
pet.gainTamenessFullness(getPlayer(), tameness, 0, 0);
}
}
}

View File

@@ -56,7 +56,7 @@ public class PetTamenessAction extends AbstractQuestAction {
c.lockClient();
try {
pet.gainClosenessFullness(chr, tameness, 0, 0);
pet.gainTamenessFullness(chr, tameness, 0, 0);
} finally {
c.unlockClient();
}

View File

@@ -51,18 +51,18 @@ public class MinTamenessRequirement extends AbstractQuestRequirement {
@Override
public boolean check(Character chr, Integer npcid) {
int curCloseness = 0;
int curTameness = 0;
for (Pet pet : chr.getPets()) {
if (pet == null) {
continue;
}
if (pet.getTameness() > curCloseness) {
curCloseness = pet.getTameness();
if (pet.getTameness() > curTameness) {
curTameness = pet.getTameness();
}
}
return curCloseness >= minTameness;
return curTameness >= minTameness;
}
}

View File

@@ -2706,7 +2706,7 @@ public class PacketCreator {
p.writeInt(pets[i].getItemId()); // petid
p.writeString(pets[i].getName());
p.writeByte(pets[i].getLevel()); // pet level
p.writeShort(pets[i].getTameness()); // pet closeness
p.writeShort(pets[i].getTameness()); // pet tameness
p.writeByte(pets[i].getFullness()); // pet fullness
p.writeShort(0);
p.writeInt(inv != null ? inv.getItemId() : 0);