Skip to content

Rewrite petdata to use a more authentic system + make pet growth advancement morph the existing pet

Player Name requested to merge PlayerName/2009scape:cat into master

What has been done in this MR?

Petdata rewrite

By chance, I found the following source: which shows that authentically, pets stack. This means that my previous MR !1538 (merged) which fixed the "this is not the right pet" bug took an incorrect approach. Evidently, rather than separating pets into distinct individuals, they authentically all get lumped into one and the same item stack, and Jagex must have tracked the individuals' different hunger and growth values by means of a simple stack data structure in the save file.

  • This MR implements this change to the pet data structure, and migrates existing saves accordingly. This includes merging your current non-stacking pets into their authentic stacks.
  • This also fixes the bug where a pet's data could get reset to 0 hunger and growth when you dropped it, under specific conditions.
  • In addition, I made the version migration messages silent, since the previous time we used this versioning code to make one-time changes, the messages turned out to be quite confusing for our players! I also made a few small but not very consequential internal changes to the versioning code (e.g. version is now parsed as the very first thing on save load), which were necessary for this MR.

Pet morphing

growNextStage() now makes use of morphPet(), rather than overwriting your current pet in-place and just hoping things work out. morphPet() has been updated a bit to make this possible, including the correct preservation/propagation of hunger values. The consequences of this migration to morphPet():

  • When a pet grows into a next stage (e.g. kitten to cat), it now stays in the same location, rather than vanishing and reappearing from the player's north side
  • Deleted some legacy Arios pet code for inauthentic OSRS-only pets that was affected by the changes to morphPet()

What should testers check?

  • Pets work
  • Migrating save file version works, especially if you already had a pet following you upon migration
  • Nonstacking pets magically get replaced by a single stack upon migration - confirm that you didn't lose any
  • Pets growing up stay where they are, even (especially) when this is not the tile directly to the north of the player
  • Test that hunger and growth work properly, particularly that they are preserved between growth stages.
  • I have tested these changes thoroughly.
  • I used the relevant Thanos/Zaros tool for any JSON edits where possible, and have attached screenshots of any changes.
Edited by Player Name

Merge request reports