Skip to content

MapParser: yield xblock alongside map data, add bgNight - #79

Merged
AngeloTadeucci merged 1 commit into
MS2Community:masterfrom
Zintixx:parse-xblock-bgnight
Aug 19, 2026
Merged

MapParser: yield xblock alongside map data, add bgNight#79
AngeloTadeucci merged 1 commit into
MS2Community:masterfrom
Zintixx:parse-xblock-bgnight

Conversation

@Zintixx

@Zintixx Zintixx commented Aug 19, 2026

Copy link
Copy Markdown

Summary

  • MapParser.Parse() now yields (Id, Name, MapData, MapXBlockDataRoot?). Xblock is loaded once via a new public ParseXBlocks() and looked up per map by data.xblock.name.ToLower(), so consumers no longer need a second call. Nullable because a declared xblock name might not resolve to a file on disk.
  • ClientProperty gains bgNight next to the existing bgDay. Not in retail xblocks; downstream can author it for a day/night bg cycle.
  • Fog.color / HeightFog.color switch from [M2dColor] Color to string — xblock format is decimal "R,G,B" (e.g. "199,237,255"), not the hex the M2dColor generator expects, so the previous type failed to deserialize the moment we started actually reading these files.
  • HeightFog.percentage switches intfloat — real xblocks carry scientific-notation values (e.g. "1.27798e-042").
  • Version bumped 2.4.212.4.22.

Test plan

  • dotnet test Maple2.File.Tests --filter TestParseXBlocks — new test asserts Tria xblock deserializes and bgDay == "BG_Tria.dds".
  • dotnet test Maple2.File.Tests --filter TestMapParser — existing map count assertion still passes with the new 4-tuple.
  • dotnet build — solution builds clean.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Parse() now returns (Id, Name, MapData, MapXBlockDataRoot?) — the xblock is
loaded once via ParseXBlocks() and looked up per map by data.xblock.name so
consumers no longer need a separate call. Xblock is nullable because a
declared xblock name might not resolve to a file on disk.

ClientProperty gains bgNight — not in retail xblocks, but downstream can
author it as a sibling to bgDay for a day/night bg cycle.

Fog.color and HeightFog.color switch from [M2dColor] Color to string: xblock
format is decimal "R,G,B" (e.g. "199,237,255"), not the hex the M2dColor
generator expects, so the previous type failed to deserialize. HeightFog.percentage
switches int -> float because real xblocks carry scientific-notation values
(e.g. "1.27798e-042"). These fields were never exercised before ParseXBlocks
started actually deserializing them.

Adds TestParseXBlocks covering the round-trip and asserting Tria's bgDay.
@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2b44b401-0797-4641-be2a-a840d1d2dbed


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.

@AngeloTadeucci
AngeloTadeucci merged commit d94611c into MS2Community:master Aug 19, 2026
4 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