Skip to content

Send the mini game results as the client expects them - #1000

Merged
sven-n merged 2 commits into
MUnique:masterfrom
alandarev:fix/blood-castle-score-packet
Oct 13, 2026
Merged

sven-n merged 2 commits into
MUnique:masterfrom
alandarev:fix/blood-castle-score-packet

Conversation

@alandarev

Copy link
Copy Markdown
Contributor

Fixes #999.

What

The client shows every mini game result from C1 93 and chooses the window by the byte at index 4
(0xFF blood castle, 0xFE chaos castle, a count below 200 the devil square table; details in
#999).

  • Network/Packets: new ChaosCastleScore (C1 93, type 0xFE) with the player name, the killed
    monsters, the experience and the killed players at the offsets the client reads. The descriptions
    of BloodCastleScore.Type and MiniGameScoreTable.ResultCount explain the shared code. Structs,
    ConnectionExtensions, generated tests and packet docs are regenerated from the XML.
  • GameLogic/MiniGames:
    • ChaosCastleContext counts the monsters and players each player killed and sends the result
      through the new IChaosCastleScoreTableViewPlugin; success is set for the winner only.
    • BloodCastleContext and DevilSquareContext no longer swap experience and money.
    • DevilSquareContext ranks the finishers by descending score.
  • GameServer/RemoteView/MiniGames: new ChaosCastleScoreTableViewPlugin (with its
    PlugInResources entries); MiniGameScoreTableViewPlugin sends the number of rows it writes
    (at most 10) as the count.

Open points (unchanged by this PR)

  • The blood castle result shows the first configured experience reward, not the sum of the
    experience rewards actually given.
  • In devil square, a player ranked after 10th gets no row of their own; the client shows "my info"
    only when the rank is within the rows sent.

Testing

  • tests/MUnique.OpenMU.Network.Packets.Tests/MiniGameResultReceiveLayoutTests.cs: the bytes of the
    three results at the client's offsets, including the type byte.
  • tests/MUnique.OpenMU.Tests/MiniGameScoreRemoteViewTests.cs: the view plugins, checked on the raw
    header and type byte as sent (the chaos castle test fails if the plugin sends BloodCastleScore),
    and the devil square count limited to 10 rows (fails on master).
  • MUnique.OpenMU.Network.Packets.Tests 612/612, MUnique.OpenMU.Tests 1103/1103 (on master 0db6db1).
  • By hand, with the Season 6 client: winning chaos castle shows the result window ("Monster Kill
    count: 99, Players Kill count: 0"); the same steps on master show no window. Blood castle and
    devil square were checked by the tests only.
  • Codacy: one remaining finding, MD047 (no trailing newline) in the generated
    docs/Packets/C1-93-ChaosCastleScore_by-server.md. The markdown generator writes every packet
    document that way.

Written with AI assistance and tested by hand, per CONTRIBUTING.

The client handles every C1 93 result with one struct (rank at 3, count at 4, rows of name, score,
experience and money from 5) and chooses the result window by the byte at 4: 0xFF is the blood
castle result, 0xFE the chaos castle result, a count below 200 the devil square rank table.

- Chaos castle sent the blood castle result (0xFF), which the client ignores on the chaos castle
  map, so no result was shown. It now sends the new ChaosCastleScore (0xFE) with the killed
  monsters, the experience and the killed players where the client reads them, through the new
  IChaosCastleScoreTableViewPlugin; success is set for the winner only.
- Blood castle and devil square swapped the bonus experience and money: the score tables are
  (name, score, experience, money), but were deconstructed or filled as (…, money, experience).
- Devil square ranked the finishers by ascending score, so the lowest score got rank 1 and its
  rewards.
- The devil square rank table sent the number of all scores as its count, but wrote at most 10
  rows.

The definitions describe the shared code; new tests check the written bytes at the client's
offsets and the view plugins.
@alandarev

Copy link
Copy Markdown
Contributor Author

Before/after screenshots (in game)

Setup: local server, public sven-n/MuMain client (15775d84). Before = upstream master (ff14409d9), after = master with this PR merged. Each image puts master on the left and this PR on the right. The boxes mark the evidence. The chat line "… Zen Obtained" is the money the server actually gave, so it shows which window field is the zen. The test characters are level 400, so experience itself is not granted ("You already reached maximum Level"). That is a separate issue; these images only show what the window displays.

Chaos Castle: master sends type 0xFF, which the client reads as a Blood Castle result, and no result window opens. With the PR it sends 0xFE and the window shows the kill counts.
Chaos Castle end

Blood Castle 8: on master, experience and zen are swapped. The window says Zen 130000, but the chat says 250000 Zen was obtained.
Blood Castle result

Devil Square 7, two players: on master the lowest score is ranked first (35 points above 42), and the EXP column holds the zen. With the PR the highest score is rank 1 and the columns match the chat.
Devil Square result, player 1

More: second Devil Square client, Chaos Castle running / after exit

Devil Square, second client (its own "My Info" row):
Devil Square result, player 2

Chaos Castle while running (same state on both builds):
Chaos Castle running

Chaos Castle after the game: still no window on master:
Chaos Castle after exit

The row-count bug (more than 10 Devil Square participants) needs 11 players, so it is covered by the unit test only.

@sven-n

sven-n commented Sep 30, 2026

Copy link
Copy Markdown
Member

Okay, that's the open source MuMain, not the original closed-source season 6 episode 3 client. Like discussed in Discord, we have to make sure first, that it's also broken in the original client before we change it. If it's not broken in the original client, then it's a bug in the open source client.

@eduardosmaniotto

Copy link
Copy Markdown
Contributor

I tested the scores in the original client and I can see the similar behavior:

DS don't display the ranking:

ds

BC first message:

bc

BC score with same problem as the MuMain:

bc-2

CC don't display the score:

cc

@sven-n
sven-n merged commit 6d64e98 into MUnique:master Oct 13, 2026
2 checks 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.

Mini game results: no chaos castle result window, experience and money swapped, devil square ranked the wrong way round

3 participants