Skip to content

Pet equipment and pet loot - #524

Merged
neeerp merged 4 commits into
masterfrom
v83/pet-equips-loot
Oct 18, 2026
Merged

neeerp merged 4 commits into
masterfrom
v83/pet-equips-loot

Conversation

@neeerp

@neeerp neeerp commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Stacked on #523 (v83/cash-shop-requests). Please change the base to master once #523 is merged, since GitHub won't retarget it here.

Pet equipment and pet loot (L159).

What changed

  • Server, pet equipment rules:
    • Pet equips are worn at -(100+part) on each pet's parts, and checked as v83's client checks them (FUN_004f1c2d) instead of with the regular stat rules.
    • Clothes need their pet out, made for its kind and at its level. Label and quote rings need a kind with a name tag or chat balloon style.
    • Item data now reads those flags and the kinds each piece of clothing suits.
  • Server, pet loot:
    • PET_LOOT (0xAA) is honoured when the pet wears a Meso Magnet (mesos) or an Item Pouch (items), never for a drop a player threw down.
    • A kept drop flies to the pet (REMOVE_ITEM_FROM_MAP mode 5). One refused for a full inventory goes back without a packet, so nobody sees it blink.
  • Client, pet panel:
    • The equipment window's pet panel opens a tab per pet out.
    • Pet equips can be dragged onto a cell, with v83's refusals, and clothes are drawn on the pet.
    • Double-clicking pet equipment puts it on a pet that can wear it. When more than one pet qualifies, v83's pet chooser (UtilDlgEx_Pet) asks which.
    • Item pouches, magnets and the other 181–183 items were invisible in the inventory, and now show.
  • Client, pet loot:
    • Each pet out with a magnet or pouch asks for a drop at its feet every tick, as v83 does.
    • It never asks for another character's or party's drop unless it wears Magic Scales, and then only after 15 s. Each drop is tried at most once every 3 s.
    • Drops taken by a pet fly to the pet.

Not covered

  • The client pet-loot loop is unit tested but hasn't yet had a live check in the GUI. The server side passes the harness.
  • The item checksum (the server doesn't read it), an item's pickUpBlock flag, and the drop's source id.
  • The pet's exception list (0xAC) and the sweep that walks a pet toward drops.

Verification

  • New harness test pet_loot: a pet with a Meso Magnet takes its owner's mesos but leaves a Monster Book card.
  • Client tests: pets and pickup extended (choosing a pet, pet ownership rules).
  • Pet equipment and the chooser were checked in the client on Xvfb.
  • This layer passes cargo fmt --check and cargo check --workspace --tests.
  • At the top of the stack the full harness suite passes (run at 45e356d, the last server commit; the commits after it change only HeavenClient). All 83 client tests pass in a debug build.

Pet equips are worn at -(100+part), on the part for the pet they belong to
by list index: 14 and 21-29 and 46 for the first pet, 30-37 and 47 for the
second, 38-45 and 48 for the third, with the HP and MP pouches (24, 25)
shared. The server now checks them as the v83 client does (FUN_004f1c2d)
instead of with the regular stat rules. Clothes need their pet out, made
for its kind and at its level; label and quote rings need a pet whose kind
has a name tag or chat balloon style; item pouches, meso magnets and
ignore pendants need their pet out; the potion pouches, Wing Boots,
Binocular and Magic Scales need no pet. Item data now reads the nameTag
and chatBalloon flags of pets and the kinds each piece of clothing suits.
The v83 client asks for loot on its pet's behalf with PET_LOOT (0xAA): the
pet's cash serial, where it stands and the drop. The server now honours it
when that pet wears the Meso Magnet (mesos) or the Item Pouch (items) at its
own parts, and never for a drop a player threw down.

The field takes the drop out of its set without telling anyone, and the
owner's actor tries to keep it. Kept, the field shows it flying to the pet
(REMOVE_ITEM_FROM_MAP mode 5 with the owner and the pet's place in the
list); refused for a full inventory, it goes back in the set with no
packet, so other players never see it blink. A player's own pickup goes
through the same keep-or-return step as before.

tests/pet_loot.rs puts a Meso Magnet on a summoned pet straight from the
database (new grant_pet and wear_cash_equip helpers), and checks that the
pet takes its owner's mesos but leaves a Monster Book card alone.
The equipment window's pet panel now works as in v83. Its tabs open for
each pet out, and its eleven cells show what each pet wears, with red
overlays where nothing can go. Pet equipment can be dragged onto a cell of
the pet whose tab is open, with v83's refusals: clothes need a pet of their
kind at their level, label and quote rings a kind that shows them, and the
ability items a pet out (FUN_004f1c2d). Clothes are drawn on the pet, frame
by frame, for its owner and for everyone else.

Double-clicking pet equipment in the item window puts it on a pet that can
wear it (FUN_004efd25). With one pet out it goes on that pet, and the HP
and MP pouches never choose. Otherwise clothes go on the pets of their kind,
ability items on any pet, and of the rings only the Pet Label Ring and the
Pet Quote Ring choose. When more than one pet qualifies, v83's pet chooser
(UtilDlgEx_Pet) shows them one at a time with their name, level and
closeness, and OK or Enter picks the one shown. A successful double-click
equip now plays DragEnd, as v83's shared tail does.

Item pouches, magnets and the other 181 to 183 items were invisible in the
inventory, since only 180 was treated as pet equipment.
Each pet out that wears a Meso Magnet or an Item Pouch now looks for a
drop at its feet every tick and asks for it with PET_LOOT, as v83 does
(FUN_00705c5d, FUN_0050483a, FUN_00705c7c). It reaches as far as its owner
does, 25 px to either side and from 50 px above to 10 px below, and leaves
drops that players dropped, mesos without a magnet and items without a
pouch. Unlike its owner a pet never takes another character's or party's
drop, unless it wears Magic Scales, and then only after 15 s. A drop is
tried by the pets at most once every 3 s, apart from the owner's own
tries. Pets don't loot for a dead owner, or in the Extra Frosty Snow Zone.

When the server says a pet took a drop (remove mode 5), the drop now flies
to that pet's feet instead of to its owner, and vanishes if the pet is no
longer out (FUN_004416db).

Not done yet: the item checksum (the server doesn't read it), an item's
pickUpBlock flag, the drop's source id (RustMS always sends one), the
exception list, and the sweep that walks a pet toward drops.
@neeerp
neeerp changed the base branch from v83/cash-shop-requests to master October 18, 2026 18:46
@neeerp
neeerp merged commit e43b389 into master Oct 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant