Repository navigation
Pet equipment and pet loot - #524
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #523 (
v83/cash-shop-requests). Please change the base tomasteronce #523 is merged, since GitHub won't retarget it here.Pet equipment and pet loot (L159).
What changed
Not covered
Verification
pet_loot: a pet with a Meso Magnet takes its owner's mesos but leaves a Monster Book card.petsandpickupextended (choosing a pet, pet ownership rules).cargo fmt --checkandcargo check --workspace --tests.