Repository navigation
feat(items): rented items show their time left and expired state - #1150
Conversation
OpenMU marks a time-limited (rented) item in the two highest bits of the level byte of its extended item data: 0x40 for an item which expires, 0x80 once it expired. The level is in the low 6 bits. ParseItemData reads them into WithExpiration and IsExpired, so the client treats the item as a period item, like with the bits 0x02 and 0x04 of byte 5 in the original item format: the tooltip shows the time left of the expiration date which D2 12 sets, and an expired item is shown as such and can't be equipped.
Dragging an expired period item onto its slot is refused by the client with "Can't wear item.", but a right click sent the equip request anyway. The server refuses it, and the client then showed the item in another equipment slot until the next login. The right click now refuses an expired item the same way.
When a rented pet expired while it was equipped, it kept flying next to the hero and collecting zen until the next login. The client ignored the item update (F3 14) for the equipment slots, so the equipped pet never got its expired state. It now equips the item again with the new data, which takes the pet off first. The pet or mount of an expired rented item isn't created anymore, so it doesn't appear (and collect zen) after the login either.
Not only an expired pet: an expired rented item in any equipment slot has no effect, so the hero is drawn as if the slot was empty, e.g. without the wings, the weapon or the armor piece, and without the mane of a Wizard's Ring +3. The expiration of an equipped item recreates the hero's parts with the new state.
|
based on pr rules pls add screenshots or video for comparison thx a lot :D <3 |
|
Thanks, I've added a video and screenshots of the result to the description: buying a rented pet, its expiration date in the tooltip, the expired pet, and the message when it expires. Two notes about the rule, meant constructively:
|
Mosch0512
left a comment
There was a problem hiding this comment.
Verdict: changes requested. Three required items, all reachable in game as soon as MUnique/OpenMU#1548 is live:
- An expiry deletes the item the player is dragging (inline on
WSclient.cpp). - The character stats still count expired equipment (inline on
ZzzCharacter.cpp). - A rented item in the inventory extension loses its whole tooltip (below,
ReceivePeriodItemList).
Thanks for this, the period item system finally works with OpenMU, and the testing list and the videos make the change easy to follow. The bit layout looks fine to me; since it's still a proposal on MUnique/OpenMU#1548, it would be good to merge both sides with the same layout.
Required: the expiry date never reaches an item in the inventory extension. ReceivePeriodItemList (D2 12, WSclient.cpp around line 13172) stores the date for equipment slots and, through FindMainInventoryItem, for the main inventory only. For a slot of the inventory extension (or the own personal shop) it finds nothing and returns. That was harmless before, because bPeriodItem was never set with OpenMU. With this PR it is, and BuildItemTooltipText (ZzzInventory.cpp:1804) shows no tooltip at all for a period item that isn't expired and has no date: a rented ring moved into the extension shows nothing when hovered, not even its name. UI::Inventory::FindPlayerItem covers both parts of the inventory.
Non-blocking: a rented item without a date has no tooltip anywhere else either. The server sets the new bit in every serialization, but sends D2 12 only for items in the inventory. A rented item in the Chaos Machine window, in another player's personal shop (where personalShopSellableWhileRented allows it), or for a moment between a move and its D2 12 hides its whole tooltip because of the same check at ZzzInventory.cpp:1804. Showing the tooltip without the time left in that case would be safer than hiding it.
Non-blocking: an expiry plays the jewel sound. After the update ReceiveModifyItemExtended picks the sound from Items[itemindex].Item.Type, but Items is the list of items on the ground, so the slot index points at an unrelated drop. An expiry, now a normal event, plays SOUND_JEWEL01 (or the Kundun sound if that ground item happens to be a Lost Map). The lookup is old, but it should probably use the item that was just inserted, or play nothing for an expiry.
Non-blocking: an expired Dark Raven still gets its pet. CMyInventory::EquipItem calls CreatePetDarkSpirit(Hero) and sends the Dark Horse/Raven pet info requests before CreateEquippingEffect checks the expiry, so an expired raven would keep following the hero. OpenMU's cash shop can sell any item with a duration, so it isn't impossible.
Non-blocking: rule 1 of the coding rules. CreateEquippingEffect (about 85 lines) changes without an extracted part; pulling the pet and mount creation into its own function would give the expiry check one place too.
Non-blocking: tests. Only the byte decoding has a test. A doctest for IsShownEquipment and one for the right-click path with an expired item would keep these working through the coming looks-in-data work on SetCharacterClass. The in-game list doesn't mention a rented transformation ring expiring while it's worn, which the summary says the shop sells: does the hero's model go back without a relog?
| bool shouldResyncInventory = false; | ||
| if (IsPlayerInventorySlot(itemindex)) | ||
| shouldResyncInventory = !UI::Inventory::InsertItem(itemindex, itemData); | ||
| else if (itemindex >= 0 && itemindex < MAX_EQUIPMENT_INDEX) |
There was a problem hiding this comment.
Required. At the top of this function, every F3 14 calls DiscardPickedItem() when the player holds an item. That fit when F3 14 only answered the player's own jewel upgrade, but now the server sends it on its own when a rental runs out. If a pet expires while the player drags a Jewel of Bless to the vault, the jewel is deleted on the client; the server still has it in its old slot and nothing asks for a resync, so it stays invisible until a relog. The discard should only happen when the update is for the held item (or the held item should be put back with RestorePickedItem()).
A second, smaller effect of this branch: the re-equip goes through SetCharacterClass twice (unequip, then equip), and it calls SetPlayerStop each time, so an expiry while walking stops the hero mid-path on the client while the server finishes the walk. Non-blocking, but worth a look while you're here.
There was a problem hiding this comment.
Fixed in 488294fde. The held item is now discarded only if the update ends it: it was used on another item (ApplyJewels marks it, and the update of the target answers the use), or it's the updated item itself. Any other held item stays in the hand. EnableUse couldn't tell these cases apart, because OpenMU sends the delete of the consumed jewel, which resets it, before the update of the target.
Tested in game: a Jewel of Bless held while a mounted Pet Skeleton expired stays in the hand after the expiry message, and applying a Jewel of Bless to an item still consumes it and raises the item's level.
About SetPlayerStop: SetCharacterClass stops the hero on every equipment change, also when the player equips something by hand while walking, so it isn't specific to the re-equip path. I left it as it is, because changing it would affect every equipment change.
| // so the hero looks as if the slot was empty. | ||
| bool IsShownEquipment(const ITEM& item) | ||
| { | ||
| return item.Type != -1 && !(item.bPeriodItem && item.bExpiredPeriod); |
There was a problem hiding this comment.
Required. The hero is drawn without the expired item, but CharacterMachine->CalculateAll() at the end of SetCharacterClass still counts it: an expired wing keeps its damage, magic and defense bonuses (ZzzInfomation.cpp:1734 and following) and its walk speed (CalculateWalkSpeed), so the character window shows numbers the server no longer applies. Only the rings and the helper in CharacterInfoWindow.cpp check for expiry today.
A suggestion for how: right now each place that reads the equipment needs its own expiry check (drawing here, pets and the ring's mane in CreateEquippingEffect, equipping in two places), and the stats, the full-set check and EquipItem's raven are missed. One accessor that treats an expired slot as empty for gameplay (for example on CharacterMachine), used by the drawing, the effects and CalculateAll, would cover all of them with one rule and one test.
There was a problem hiding this comment.
Done as you suggested, in f01b59aba. CHARACTER_MACHINE::GetEffectiveEquipment(slot) gives the item of a slot as the game uses it: an expired rental counts as an empty slot (an item with Type -1, never nullptr). The stat functions of CalculateAll, the CSItemOption loops (item skills, add-state and set options), the socket bonuses, FullSetOf and the drawing (IsShownEquipment) all use it, so they follow one rule. Equipment stays as it is for what the inventory shows.
Tested in game: with Small Wings of Satan the defense goes from 1921 to 1947, and back to 1921 when they expire, without a relog. The damage increase of the small wings doesn't show in the character window even while they're valid: they have no options in the client data, and the client never counted that increase. That's existing behaviour.
| bool CInventoryActionController::TryEquipItem(CInventoryCtrl* targetControl, ITEM* pItem, int iSrcIndex) const | ||
| { | ||
| // An expired rented item can't be worn, like when it's dragged onto its slot. | ||
| if (pItem->bPeriodItem && pItem->bExpiredPeriod) |
There was a problem hiding this comment.
Non-blocking. Two things here. The check runs before the function checks that the item has an equipment slot, so right-clicking an expired item that can't be worn at all now says "Can't wear item." and skips TryDropItem, which ran before. And it's the same check and message as in CMyInventory::EquipmentWindowProcess for dragging. Moving it into CMyInventory::IsEquipable covers both paths (which already call it) and any later one, and keeps the order of this function as it was.
There was a problem hiding this comment.
Moved into CMyInventory::IsEquipable (f01b59aba), so the drag and the right click follow the same check, and TryEquipItem is back to its old order: an item which can't be worn reaches TryDropItem again. The right click now refuses an expired item silently, like any other item it can't equip. The drag keeps the original client's "Can't wear item.".
| OBJECT* pHeroObject = &Hero->Object; | ||
| if (false == gMapManager.InChaosCastle()) | ||
| // An expired rented pet or mount has no effect, so it doesn't accompany the hero (and doesn't collect zen). | ||
| const bool isExpired = pItem->bPeriodItem && pItem->bExpiredPeriod; |
There was a problem hiding this comment.
Non-blocking. bPeriodItem && bExpiredPeriod is now written out in three new places, next to five existing ones (ItemTooltipValues, ShopRestrictions, ItemCategories, EquipmentWindowProcess). Rule 4 of the coding rules asks not to duplicate; a GameLogic::Items::IsExpiredRental(const ITEM&) next to the rental rules would be the one place.
There was a problem hiding this comment.
GameLogic::Items::IsExpiredRental (9cb651d09) is used in the new places, and also by the accessor, IsHighValueItem, the tooltip values and the drag check. I left the older checks in ShopRestrictions, ItemEnduranceInfo and CharacterInfoWindow as they are, to keep the diff focused.
| if (Hero->EtcPart <= 0 || Hero->EtcPart > 3) | ||
| { | ||
| if (pItem->Type == ITEM_WIZARDS_RING && pItem->Level == 3) | ||
| if (pItem->Type == ITEM_WIZARDS_RING && pItem->Level == 3 && !isExpired) |
There was a problem hiding this comment.
Non-blocking. This touches a hard-coded case for one item. The coding rules for areas that are already data-driven say a touched special case moves into data with the change. That would be a bigger step than this PR needs, so it's fine to name it as a deliberate exception in the description instead (the checklist currently says the rules were followed).
There was a problem hiding this comment.
Agreed. I named it in the description as a deliberate exception: moving the Wizard's Ring mane into data is a bigger step than this PR.
GameLogic::Items::IsExpiredRental replaces the bPeriodItem && bExpiredPeriod pair, so the rule an expired rental follows has one place (coding rule 4).
The hero was drawn without an expired item, but the stats still counted it: an expired wing kept its damage, defense and walk speed in the character window, while the server no longer applies them. CHARACTER_MACHINE::GetEffectiveEquipment gives the item of an equipment slot as the game uses it: an expired rental counts as an empty slot. The stat calculation, the item options (sets, excellent, socket bonuses, item skills), the full set check and the drawing of the hero use it, so they follow one rule. The pet and mount creation moves out of CreateEquippingEffect into CreatePetOrMount, with the expiry checked once, and EquipItem no longer creates the Dark Raven of an expired rental. IsEquipable refuses an expired item for the drag and the right click alike; TryEquipItem is back to its old order, so an item which can't be worn reaches TryDropItem again.
…r holds Every item update (F3 14) discarded the held item. That fit when the update only answered a jewel the player applied, but OpenMU also sends it when a rented item expires: a Jewel of Bless held at that moment was deleted on the client and stayed invisible until a relog. The held item is now discarded only if the update ends it: it was used on another item (the update of the target answers the use), or it's the updated item itself. Any other held item stays in the hand.
The end of a rented item (D2 12) was only stored for the equipment and the main inventory; FindPlayerItem covers the extension too. Before, a rented item there had no end, and its tooltip didn't show at all.
A rented item which isn't expired and has no end hid its whole tooltip. The server sends the end a moment after the item, and only for the inventory, so a rented item in the Chaos Machine, in another player's shop, or between a move and its D2 12 showed nothing when hovered, not even its name. The tooltip is shown without the end instead: the new tooltip state hasExpireDate decides the two expiration lines of Tooltip.json.
After an item update, the sound was picked from Items[index], the items on the ground, so the slot index pointed at an unrelated drop: an expiry played the jewel sound, or the Kundun sound. The sound now comes from the updated item, and an equipped item, which only the server updates (a rental expired), plays none.
|
Thanks for the thorough review. Everything is addressed in the six new commits, tested in game against MUnique/OpenMU#1548:
I've updated the Testing section and named the Wizard's Ring case as a deliberate exception in the description. |
Conflict in ApplyJewel, which main refactored: main's version is kept, and the held jewel is still marked as used on the target item.
NeedsAllTooltipValues didn't name the new state, which fails the builds with -Wswitch as an error (macOS). The state comes with the basic values.
Mosch0512
left a comment
There was a problem hiding this comment.
Verdict: changes requested, one item. Everything from the first round is fixed or answered, thanks a lot for the quick and careful work, and for the replies on each point. GetEffectiveEquipment turned out nicely, and I agree with leaving SetPlayerStop and the Wizard's Ring as they are.
Required: some checks of the client still see an expired item. A few places outside the stats read CharacterMachine->Equipment directly, so an expired rented item still counts there:
CKanturu2ndEnterNpc::ValidateEquipmentForEntry(KanturuEvent.cpp:500): an expired transformation ring still makes the NPC refuse the entry with the transformation-ring popup (g_ChangeRingMgr->CheckMoveMap), although the ring has no effect anymore and the hero's model is back. The wing and Uniria checks there read the raw slots too.- The Icarus check of the move list (
ZzzInterface.cpp:2793,HasFlightEquipmentwith the raw helper and wing): after a rented wing expires, the client still lets the player pick Icarus, and only the server refuses. The Uniria/Atlans check right above (line 2788) reads the raw helper as well. hasDarkHorse(ZzzInterface.cpp:1380) and the weapon skills inSkillExecution.cpp:376(SkillWarrior(c, &CharacterMachine->Equipment[i])).
Before this PR no item was ever expired with OpenMU, so these couldn't go wrong; now they can. Reading these slots through GetEffectiveEquipment would fix them. If you'd rather keep some for later, naming them in the description is fine too.
The notes inline are all non-blocking.
| } | ||
| else | ||
| { | ||
| PlayBuffer(SOUND_JEWEL01); |
There was a problem hiding this comment.
Non-blocking. This covers an expiry of a worn item, but OpenMU sends the same F3 14 when a rented item expires in the bag. Then FindPlayerItem finds it and the jewel sound still plays, although nothing was upgraded. Playing the sound only when the update answers the player's own action would cover both, for example by reading the held item's IsUsedOnItem() before DiscardPickedItemUpdatedBy, or by skipping it when the new item is an expired rental.
There was a problem hiding this comment.
Fixed in 93efb04e4: PlayModifiedItemSound plays nothing when the updated item is an expired rental. Tested in game: a rented Small Wings of Satan which expired in the bag plays no sound, and applying a Jewel of Bless still plays it.
| } | ||
|
|
||
| SendRequestUse(iSourceIndex, targetIndex); | ||
| pPickedItem->MarkUsedOnItem(); |
There was a problem hiding this comment.
Non-blocking. SendRequestUse returns without sending anything while EnableUse counts down or when IsCanUseItem() is false (vault or trade open), but the jewel is marked as used anyway. It stays in the hand marked, and the next unrelated F3 14, for example an expiry, discards it while the server still has it. That's the vanishing item from the first round, in a much narrower case: dropping two jewels quickly, then an expiry before the second one is put back. Letting SendRequestUse return whether it sent, and marking only then, would close it.
There was a problem hiding this comment.
Fixed in 4598307c6: SendRequestUse returns whether it sent the request, and ApplyJewel marks the jewel only then. Applying a Jewel of Bless still consumes it and raises the item's level.
| Master_Level_Data.lNext_MasterLevel_Experince = (iData_Master - (int64_t)3892250000) / (int64_t)2; | ||
| } | ||
|
|
||
| ITEM* CHARACTER_MACHINE::GetEffectiveEquipment(int slot) |
There was a problem hiding this comment.
Non-blocking. Every empty or expired slot gets the same m_NoEffectEquipment, as a writable pointer, and each call resets it. Nothing writes through it today, but CalculateDamage holds Right, Left, Amulet and both rings at once, so a later change that writes to one of them would show up in the others and vanish at the next call. Returning const ITEM* and pointing at one static const ITEM with Type -1 would rule that out, and the getter would no longer change the object, so it could be const too.
There was a problem hiding this comment.
Agreed that a static const ITEM would rule that out. It means const ITEM* through the stat code, though: PlusSpecial, PlusSpecialPercentOfSlot, ItemDefense, ItemMagicDefense, ItemWalkSpeed, CalcDurabilityPercent, the CSItemOption and socket loops and FullSetOf all take or hold an ITEM* today. That grows this PR well beyond the expiry, so I'd do it in a follow-up of its own, if that's fine with you. Nothing writes through it in this PR.
| { | ||
| ITEM* pItem = UI::Inventory::FindMainInventoryItem(Data->wItemSlotIndex); | ||
| // The main inventory or its extension. | ||
| ITEM* pItem = UI::Inventory::FindPlayerItem(Data->wItemSlotIndex); |
There was a problem hiding this comment.
Non-blocking. The player's own personal shop is still missing: its slots (IsMyShopSlot) are part of the inventory storage OpenMU sends D2 12 for, but FindPlayerItem only covers the main inventory and the extension. A rented item in the own shop (where personalShopSellableWhileRented allows it) shows no end date. Looking it up in g_pMyShopInventory, as UI::Inventory::InsertItem does, would cover it. Since the tooltip now shows anyway, this is only the missing date.
There was a problem hiding this comment.
With OpenMU a rented item can't get into the own personal shop: the server refuses to move a time-limited item into the personal store, valid or expired, and refuses to sell one from there (#1548). So no rented item is in the shop slots that D2 12 could be about. If another server allows it, looking it up in g_pMyShopInventory would be the way, as you say.
| mu::ui::window::CInventoryCtrl::DeletePickedItem(); | ||
| } | ||
|
|
||
| void DiscardPickedItemUpdatedBy(int index) |
There was a problem hiding this comment.
Non-blocking. This rule fixed the Required item of the first round, but only the in-game run covers it. It only looks at the held item's source storage, its slot and the new flag, so a doctest with a CPickedItem could pin it: an unrelated held item stays, the updated item itself and a jewel marked as used are discarded. That would catch a later change to GetSourceLinealPos or GetSourceStorageType that quietly breaks the match.
There was a problem hiding this comment.
Added in 3532661a2. A CPickedItem can't be made in a test without the inventory windows, because it takes its size and position from the grid and the pointer. So the rule moved into a function of its own, IsHeldItemEndedByUpdate, which DiscardPickedItemUpdatedBy uses, and test_held_item_update pins it: an unrelated held item stays (also with the same slot number in another storage), and the updated item itself and a jewel used on another item are ended.
…ted item Some checks still read the equipment directly, so an expired rental counted there: an expired transformation ring made the Kanturu NPC refuse the entry, expired wings still allowed Icarus in the move list (only the server refused), and the Dark Horse and Dark Raven checks and the weapon skills of warriors and elves saw the expired item. They read the slots through GetEffectiveEquipment now, like the stats.
OpenMU sends the same item update when a rented item expires in the bag, and the jewel sound played although nothing was upgraded.
…sent SendRequestUse sends nothing while another use waits for its answer or the vault or a trade is open, but the jewel was marked as used anyway, so the next unrelated item update discarded it while the server still had it. It now returns whether it sent the request, and the jewel is marked only then.
The rule of DiscardPickedItemUpdatedBy is a function of its own, so a test pins it: an unrelated held item stays, the updated item itself and a jewel used on another item are ended.
|
Thanks again. The required item is fixed in Tested in game: after a rented Small Wings of Satan expires while it's worn, warping to Icarus is refused, also right after the expiry message, while the character holds no other flying item. The inline notes:
Everything is built on Linux and passes the whole |
Mosch0512
left a comment
There was a problem hiding this comment.
Verdict: approved, ready to merge. Round 2's Required item is fixed: the Kanturu entry, the Icarus and Atlans checks of the move list, hasDarkHorse and the weapon skills now read through GetEffectiveEquipment, and thanks for catching hasDarkRaven and the elf skills in the same go, and for testing the Icarus case in game. The bag sound, the jewel marked only when the request was sent, and the held-item rule as its own function with a test are all in, and your answers on the stand-in item and the personal shop make sense to me.
The red CI isn't from this PR: the only failing test is main's tests/data/test_buffs.cpp:354 ("Buffs: an unknown field is a warning, and the entry is kept"), which fails the same way on main and is fixed by #1183.
Three small notes, all Non-blocking:
Non-blocking: the stand-in item as a follow-up. Fine with me to keep GetEffectiveEquipment returning the shared writable m_NoEffectEquipment for now, since const ITEM* would change every stat helper. Could you open an issue for it, so the follow-up doesn't get lost?
The other two are inline.
| bool IsHeldItemEndedByUpdate(STORAGE_TYPE source, int sourcePos, bool usedOnItem, int updatedIndex) | ||
| { | ||
| const bool isUpdatedItem = source == STORAGE_TYPE::INVENTORY && sourcePos == updatedIndex; | ||
| return usedOnItem || isUpdatedItem; |
There was a problem hiding this comment.
Non-blocking. One narrow case is left from the first round: when the server refuses the jewel (for example Bless on an item that's already at its limit), OpenMU answers with ItemConsumptionFailed (C1 26 FD), not F3 14. The jewel stays in the hand, still marked used, and the next unrelated F3 14, say a rental expiring, discards it while the server still has it. Remembering the target slot in MarkUsedOnItem and matching it against updatedIndex here, or clearing the mark when 0x26 FD arrives, would close it. A second case in test_held_item_update.cpp could pin it.
| { | ||
| pPickedItem->MarkUsedOnItem(); | ||
| } | ||
| PlayBuffer(SOUND_GET_ITEM01); |
There was a problem hiding this comment.
Non-blocking. This was already so before the PR: the sound plays even when SendRequestUse sent nothing (cooldown, vault or trade open). Now that the if is right above it, moving the line inside it would make the sound match what happened.
Thanks a lot for the reviews, the kind words and the merge, @Mosch0512! The two rounds made the client side much more solid. I'll open an issue with the three follow-ups, so none of them gets lost:
Then two PRs, one concern each: the held jewel (2 and 3), and the |
Summary
OpenMU can now sell the time-limited (rented) items of the cash shop: pets, transformation rings, rings and necklaces, small wings (MUnique/OpenMU#1525, server side in MUnique/OpenMU#1548). This PR is the client side.
The client already has the period item system of the original (
WithExpiration,IsExpired, the tooltip with the time left, the refusal to equip an expired item), but it got the state only from byte 5 of the original item format. The extended item format which OpenMU sends to this client has no free bit, so the server now marks a time-limited item in the two highest bits of the level byte:0x40for an item which expires,0x80once it expired. The level is in the low 6 bits; item levels only go up to 15.ItemMng.cpp):ParseItemDatareads both bits intoWithExpirationandIsExpiredand masks the level with0x3F. With that the tooltip shows the time left of the date the server sends withD2 12, which the client already handles.MyInventory.cpp): dragging an expired item onto its slot was already refused ("Can't wear item."), but a right click sent the equip request anyway. The server refuses it, and the client then showed the item in another equipment slot until the next login.CMyInventory::IsEquipablenow refuses an expired item, for the drag and the right click alike. (Showing a rejected right-click equip in the wrong slot is an older problem of its own, not changed here.)WSclient.cpp,ReceiveModifyItemExtended): the item updateF3 14ignored the equipment slots, so an equipped item never got its expired state until the next login. It now equips the item again with the new data, which takes the old one off first. An update keeps the item the player holds, unless it was used on another item or it's the updated item, and an expiry plays no sound.ZzzInfomation.cpp,CSItemOption.cpp,SocketSystem.cpp,ZzzCharacter.cpp,MyInventory.cpp): an expired item has no effect on the server.CHARACTER_MACHINE::GetEffectiveEquipmentgives the item of an equipment slot as the game uses it, with an expired rental as an empty slot, and the stats, the item options (sets, excellent, sockets, item skills), the full set check and the drawing of the hero use it. The client doesn't create the pet, mount or Dark Raven of an expired item (an expired pet kept flying and collecting zen, because the zen pickup of a pet is done by the client), and draws the hero as if the slot was empty: without the wings, the weapon or the armor piece, without the mane of a Wizard's Ring +3.GameLogic::Items::IsExpiredRentalis the one check for an expired rental.WSclient.cpp,ZzzInventory.cpp,Tooltip.json):D2 12now reaches an item in the inventory extension too, and a rented item without its end (in the Chaos Machine, in another player's shop, or between a move and itsD2 12) shows its tooltip without the end instead of none. The new tooltip statehasExpireDatedecides the expiration lines.Compatibility
Screenshots or videos
Before (
mainwith OpenMUmaster): a rented pet (or any other time-limited item) can't be bought. The server refuses every cash shop product with a duration, and the client shows "This item is not currently available".After (this branch with MUnique/OpenMU#1548), on a local server:
purchase_time-limited_item_small.mp4
Testing
F3 14) were found in game with the first commit of this branch, before they were fixed. Onmain, a rented item isn't time-limited for the client at all, so these cases can't happen there.ParseItemDatawith the new bits (period, expired, masked level);test_expired_rental_equipment(the expired-rental check,GetEffectiveEquipment, an expired wing left out of the walk speed); the tooltip tests (a rented item without its end keeps its tooltip, the new state). The wholectestsuite passes (3154 tests), the static checks of the pre-push hook pass, and clang-format 21.1.8 on the changed lines is clean.Deliberate exception to the data-driven rule: the Wizard's Ring +3 mane in
CreateEquippingEffectstays a hard-coded case. This PR only adds the expiry check to it; moving it into data is a bigger step.Known, not changed:
SetCharacterClassstops the hero on every equipment change, so an expiry while walking stops the hero on the client while the server finishes the walk. It does the same when the player equips something by hand.Related issues
MUnique/OpenMU#1525, MUnique/OpenMU#1548
Checklist
docs/CODING_RULES.mdanddocs/PULL_REQUESTS.md; deliberate exceptions are named above with the reason.docs/build/README.md).