Skip to content

ParseConstant: discover itemoptionconstant_* files instead of a hardcoded suffix list - #3

Closed
Zintixx wants to merge 2 commits into
masterfrom
flexible-itemoptionconstant-scan
Closed

ParseConstant: discover itemoptionconstant_* files instead of a hardcoded suffix list#3
Zintixx wants to merge 2 commits into
masterfrom
flexible-itemoptionconstant-scan

Conversation

@Zintixx

@Zintixx Zintixx commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

ParseConstant iterated a hardcoded constantSuffix array to build filenames. This replaces it with a prefix scan over the archive's file list — the same idiom already used by ItemParser, AchieveParser, MapParser, AdditionalEffectParser, FunctionCubeParser, etc.

foreach (PackFileEntry entry in xmlReader.Files.Where(entry =>
        entry.Name.StartsWith("itemoption/constant/itemoptionconstant_"))) {
    string xml = Sanitizer.RemoveEmpty(xmlReader.GetString(entry));
    ...

Why

  • Flexible: auto-discovers every itemoptionconstant_* file (including custom merge files) with no suffix list to maintain.
  • Robust: skips absent files instead of throwing via GetEntry(...).First(...) when a listed suffix has no file.
  • Consistent: matches the dominant enumeration pattern across the other parsers.

Removes the now-dead constantSuffix array.

No behavioral regression: the ingest consumer keys constant options by (code, grade) and throws on true duplicates regardless of order, so the enumeration-order change (archive FileList order vs the fixed array) doesn't affect correctness.

Bumps PackageVersion to 2.4.20 (2.4.19 is already published).

🤖 Generated with Claude Code

Zintixx and others added 2 commits August 2, 2026 14:55
…oded suffix list

Enumerate all itemoption/constant/itemoptionconstant_* pack entries (matching
the pattern already used by ItemParser/AchieveParser/MapParser/etc.) rather
than iterating a fixed constantSuffix array. This auto-discovers any constant
file (including custom merge files) with no list to maintain, and skips missing
files instead of throwing on GetEntry.

Removes the now-dead constantSuffix array and bumps the package to 2.4.20.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Zintixx

Zintixx commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

Retargeting to MS2Community/Maple2.File (correct upstream).

@Zintixx Zintixx closed this Aug 2, 2026
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.

1 participant