Skip to content

Parse Dungeon Reward Coupon & Npc Stat Factor By Player Count#67

Merged
AngeloTadeucci merged 3 commits into
MS2Community:masterfrom
Zintixx:Dungeon-Reward-Coupon
May 13, 2026
Merged

Parse Dungeon Reward Coupon & Npc Stat Factor By Player Count#67
AngeloTadeucci merged 3 commits into
MS2Community:masterfrom
Zintixx:Dungeon-Reward-Coupon

Conversation

@Zintixx
Copy link
Copy Markdown

@Zintixx Zintixx commented May 13, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for parsing dungeon reward coupon configurations.
  • Tests

    • Added test coverage for dungeon reward coupon functionality.
  • Chores

    • Updated package version to 2.4.10.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

📝 Walkthrough

Walkthrough

This PR adds parsing support for the dungeonrewardcoupon.xml table. A new data model file defines the XML-serializable DTOs, the TableParser class is extended with a serializer field and parsing method, a basic test enumerates results, and the package version is incremented to 2.4.10.

Changes

DungeonRewardCoupon Table Parsing

Layer / File(s) Summary
DungeonRewardCoupon data model
Maple2.File.Parser/Xml/Table/DungeonRewardCoupon.cs
Three public DTO classes with XmlRoot and XmlAttribute/XmlElement annotations define the schema: DungeonRewardCouponRoot contains a list of DungeonRewardCoupon entries, each with id, ticketTag, baseItemID, maxExtraCount attributes and a baseRate element list; DungeonRewardBaseRate holds an integer v attribute.
TableParser parsing implementation
Maple2.File.Parser/TableParser.cs
A private dungeonRewardCouponSerializer field is declared and initialized with XmlSerializer(typeof(DungeonRewardCouponRoot)) in the constructor; ParseDungeonRewardCoupon() method loads, sanitizes, and deserializes table/na/dungeonrewardcoupon.xml, yielding (id, coupon) tuples from the deserialized root.
Test coverage and version update
Maple2.File.Tests/TableParserTest.cs, Maple2.File.Parser/Maple2.File.Parser.csproj
TestDungeonRewardCoupon() enumerates all parser results to validate deserialization completes without error; PackageVersion is bumped from 2.4.9 to 2.4.10.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • MS2Community/Maple2.File#46: Adds a new TableParser parsing method (ParseSmartPush) with corresponding XML DTOs and test coverage, following a similar pattern.
  • MS2Community/Maple2.File#53: Extends TableParser with a different XML table parser (ParseAutoActionPricePackage) with dedicated XML serializer and DTO classes.

Suggested reviewers

  • AngeloTadeucci

Poem

🐰 A coupon table joins the fold,
With XML classes, shiny and bold,
Parser wired, tests passing through,
Version bumped—now 2.4.10's new!
Nose twitches with delight

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ⚠️ Warning The PR title mentions both 'Dungeon Reward Coupon' and 'Npc Stat Factor By Player Count', but the changeset only implements parsing for Dungeon Reward Coupon. The second part of the title is unrelated to the actual changes. Update the title to reflect only the implemented change: 'Parse Dungeon Reward Coupon' or similar, removing the unimplemented 'Npc Stat Factor By Player Count' portion.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Maple2.File.Parser/TableParser.cs`:
- Around line 1642-1651: The ParseDungeonRewardCoupon method currently hardcodes
the path "table/na/dungeonrewardcoupon.xml"; change it to use the locale
variable (e.g., $"table/{locale}/dungeonrewardcoupon.xml") when calling
xmlReader.GetString so other locales are honored; additionally add the same
fallback logic used in other parsers (check for the locale file and fall back to
"na" if missing) around the xmlReader.GetString call to mirror behavior in
methods like the one at line ~347, keeping the rest of the method
(Sanitizer.RemoveSpaces, XmlReader.Create,
dungeonRewardCouponSerializer.Deserialize, and the yield loop) unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 32becbe9-333f-4e77-bd87-d0e5abe6b2e4

📥 Commits

Reviewing files that changed from the base of the PR and between fe82419 and 723f236.

📒 Files selected for processing (4)
  • Maple2.File.Parser/Maple2.File.Parser.csproj
  • Maple2.File.Parser/TableParser.cs
  • Maple2.File.Parser/Xml/Table/DungeonRewardCoupon.cs
  • Maple2.File.Tests/TableParserTest.cs

Comment thread Maple2.File.Parser/TableParser.cs
@Zintixx Zintixx changed the title Parse Dungeon Reward Coupon Parse Dungeon Reward Coupon & Npc Stat Factor By Player Count May 13, 2026
@AngeloTadeucci AngeloTadeucci merged commit 4ef3467 into MS2Community:master May 13, 2026
3 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.

2 participants