Repository navigation
feat(quests): a quest isn't completed while its rewards don't fit - #1491
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 47 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
c507cc0 to
a32f156
Compare
sven-n
left a comment
There was a problem hiding this comment.
Thanks, a careful change. Refusing to complete a quest whose rewards don't fit, with nothing taken, is clearly better than dropping or losing the reward. The fixed hand-in (one item per requirement, no equipped items) and IStorage.CanAddItems with its default implementation look good.
Two things before it can be merged:
-
Spanish message: #1578 (Spanish player messages) was merged in the meantime, and
TranslationCoverageTestsnow requires everyPlayerMessagekey inPlayerMessage.es.resx. With this PR it fails:PlayerMessagesAreCompleteAndMatchNeutralPlaceholders("es") -> missing "QuestZenLimitReached"Please merge
masterand addQuestZenLimitReachedtosrc/GameLogic/Properties/PlayerMessage.es.resx. -
Original packet F6 0D: as you wrote, the field becomes a result enum, and the values 2 and 3 are new for the original client. Rule 2 asks that a change to an original packet is tested with the original client (1.04d here). On the wire it's compatible (same byte, 0/1 unchanged), but please either test the refusal case with the original Season 6 client, or state that the maintainer should check it before merging. I don't want to merge this untested.
Everything else passes: I built it on current master and ran the tests (all except the slow initialization tests), and the only failure was the missing Spanish entry.
Generated by Claude Code
a32f156 to
f2ffefa
Compare
|
@sven-n ready |
sven-n
left a comment
There was a problem hiding this comment.
Thanks for adding the Spanish message (f2ffefa4). Two things remain:
- #1548 was merged in the meantime, so this conflicts again in the
PlayerMessageresources (.resx,.de,.pt,Designer.cs). Please rebase, keep both sides' entries, and add only the new designer block. - The point about the original packet F6 0D is still open: the result values 2 and 3 are new for the original Season 6 client, and rule 2 asks for a test with it. Have you been able to try the refusal with the original 1.04d client? If not, please say so in the description, so @sven-n can check it before merging.
Generated by Claude Code
A quest isn't completed while its item rewards don't fit into the inventory, counting the place of the handed in items as free, or while its money rewards would exceed the Zen limit. Nothing is taken and the quest stays active. The quest completion response (F6 0D) gets its result enum, so the Season 6 client shows its message for a full inventory (3) or the Zen limit (2); the legacy quests get a blue message. Each item is handed in for one requirement only, and equipped items aren't handed in. IStorage.CanAddItems checks if items fit into a storage after other items are removed, without changing it.
f2ffefa to
15deb2f
Compare
Why
Part of #1475 (part A, the second of three PRs; the first one, #1487, is merged).
QuestCompletionActioncompletes a quest even when its rewards don't fit: an item reward which finds no space in the inventory is dropped at the player's feet, where anyone can take it after the owner time, and a money reward over the money limit is lost. The Season 6 client already knows the answer for this case: its quest completion response (F6 0D) carries a result byte, 0 = not completed, 1 = completed, 2 = zen limit reached, 3 = inventory full. For 2 and 3 it shows its message and disables the button to complete the quest (ReceiveQuestCompleteResultin MuMain'sWSclient.cpp). OpenMU modelled the byte as a boolean and only ever senttrue.What
IsQuestCompletedofQuestCompletionResponse(F6 0D) becomesResult, an enumQuestCompletionResultwith the values the client reads. The generated code and tests are generated again. The markdown page of the packet (docs/Packets/C1-F6-0D-QuestCompletionResponse_by-server.md) is a generated file, but I edited it by hand, in the format of the generator (like the enum ofC1-F6-0B), because it's generated withnpx xslt3and Node.js isn't installed here. I didn't check that regenerating gives exactly the same text.Completed= 1 andNotCompleted= 0 are the oldtrueandfalse, and only a refusal sends the new values 2 and 3, which the MuMain handler shows as messages.IQuestCompletionResponsePlugIngetsQuestCompletionRefusedAsync(quest, refusal)with aQuestCompletionRefusal(InventoryFull,ZenLimitReached); the remote view sends result 3 or 2. The legacy quests (group 0, C1 A2) have no such result, so the player gets a message instead ("Inventory is full", or the newQuestZenLimitReachedin English, German, Portuguese and Spanish); in the Season 6 data they have no item or money rewards (all 338 item and 9 money rewards belong to the newer quests).QuestCompletionRefusedAsynchas a default implementation, so view plug-ins of other assemblies keep working.IStorage.CanAddItems(items, removedItems)tells if items would fit into a storage, including its extensions, after other items were removed, without changing it. It places them in the order ofCheckInvSpace, likeAddItemAsyncdoes: an item which fits into the storage takes its place there, the others go to the extensions. Only the removed items which the storage holds free their cells.FitsAfterRemoval(from fix(illusion-temple): review fixes of the ticket crafting and update (follow-up to #1473) #1536) isCanAddItemsfor one item now, and both use the existingFindPlaceandSetUsedSlots. An extension which isn't aStorage, e.g. of a plug-in, is asked whether it takes all the remaining items; when it doesn't, it's assumed to take none.CanAddItemshas a default implementation for storages of other assemblies: it checks a single item withFitsAfterRemovaland refuses more than one item, because it can't tell whether they fit together. Refusing too much is safe, accepting too much would drop a reward. An item without definition is refused by both, without an exception.docs-website/docs/server-features/waiting-items.md) gets a section "Quest rewards": a quest isn't completed while its rewards don't fit, nothing is taken, the messages of both clients, and that a reward which still doesn't fit is dropped, not added to the waiting items.Not changed:
Testing
dotnet buildanddotnet test --no-buildwith-p:ci=true, rebased on master (45678e3):MUnique.OpenMU.Tests: 3423 passed, 0 failed, 3 skippedMUnique.OpenMU.Persistence.Initialization.Tests: 982 passed, 0 failed, 12 skippedMUnique.OpenMU.Network.Packets.Tests: 721 passed, 0 failedMUnique.OpenMU.Web.Tests: 786 passed, 16 failed.TranslationCoverageTestspass, soQuestZenLimitReachedis in the Spanish messages too. The 16 failures are network analyzer tests which expect English texts and get the German ones of my Windows culture; they pass withDOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1.QuestRewardSpaceTest:CanAddItemswith an empty storage, items which don't fit together, removed items which make room (also in an extension, and not when another storage holds them), extensions, an extension which isn't aStorage, also one with the default implementation, which takes one item but not two; the default implementation with one item, with two items and with an item without definition; two requirements of the same item hand in different items, and one item doesn't meet two requirements; an equipped item isn't handed in; a quest with an item reward without item isn't completed; a required item without item isn't met and doesn't throw; a quest completed when the reward fits into the place of the handed in item, which the reward takes; refused with a full inventory (nothing taken, quest still active and not finished, refusal sent); refused when the money reward would exceed the limit.QuestCompletionResponseRemoteViewTests: a refusal is sent as F6 0D with result 3 or 2; a legacy refusal sends only the blue message with the localized reason ("Inventory is full" or the Zen limit text), and no quest response. These tests need the new refusal method and packet field, so they can't run without the change.quest2Dwwith "Clearing a Path to Icarus (Dark Wizard)" active (60/60 kills, reward Jewel of Chaos) and a full inventory. Clicking OK at the Shadow Phantom Soldier: the client shows "Inventory is full." and disables the button; the quest stays active. After freeing one cell: "Jewel of Chaos Obtained", the jewel is in the freed cell and the quest window closes. The zen limit was only tested by the unit test. The review fixes since then (hand-in, extensions, messages) weren't tested in game yet; that's still open.Found while testing: #1489 (merchant store items which no longer fit) and #1490 (the quest window shows item rewards as "Item: x 0").