mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Fixed a pet growth bug that could cause an error logging in
This commit is contained in:
parent
448f970c10
commit
dda80d535b
2 changed files with 10 additions and 2 deletions
|
|
@ -128,7 +128,12 @@ public final class FamiliarManager {
|
|||
}
|
||||
if (currentPet != -1) {
|
||||
int last = this.petDetails.get(currentPet).size() - 1;
|
||||
PetDetails details = this.petDetails.get(currentPet).get(last);
|
||||
PetDetails details;
|
||||
if (last < 0) { //missing data in save due to historical bug (see GL !2077)
|
||||
details = new PetDetails(0);
|
||||
} else {
|
||||
details = this.petDetails.get(currentPet).get(last);
|
||||
}
|
||||
Pets pets = Pets.forId(currentPet);
|
||||
familiar = new Pet(player, details, currentPet, pets.getNpcId(currentPet));
|
||||
} else if (familiarData.containsKey("familiar")) {
|
||||
|
|
@ -414,6 +419,9 @@ public final class FamiliarManager {
|
|||
* @param details The new pet details.
|
||||
*/
|
||||
public void addDetails(int itemId, PetDetails details) {
|
||||
if (petDetails.get(itemId) == null) {
|
||||
petDetails.put(itemId, new ArrayList<>());
|
||||
}
|
||||
petDetails.get(itemId).add(details);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -129,8 +129,8 @@ public final class Pet extends Familiar {
|
|||
if (pet.isKitten(itemId)) {
|
||||
owner.incrementAttribute("/save:stats_manager:cats_raised");
|
||||
}
|
||||
owner.getFamiliarManager().removeDetails(getItemId());
|
||||
owner.getFamiliarManager().addDetails(newItemId, details);
|
||||
owner.getFamiliarManager().removeDetails(getItemId());
|
||||
owner.getFamiliarManager().morphPet(new Item(newItemId), false, location, details.getHunger(), 0);
|
||||
owner.getPacketDispatch().sendMessage("<col=ff0000>Your pet has grown larger.</col>");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue