fix: zone pool parser truncated every zone to its first entry

GoldRush.ZonePool separates zones with '; ' (semicolon + space) but the
node/bonus entry IDs within a zone with a bare ';'. BuildSites() split on
the bare ';', so each zone's entry list was cut down to its first ID --
which is always a herb. That is why events spawned a single wrong-zone
herb and no ore at all (PR #8).

Split on the two-character '; ' zone delimiter instead, so every zone
keeps its full node and bonus pools.
This commit is contained in:
Troll (Hermes Agent) 2026-09-10 02:15:44 +00:00
parent a0a3574b14
commit 5ffac92934
2 changed files with 35 additions and 1 deletions

View file

@ -17,6 +17,13 @@ All notable changes to `mod-gold-rush` will be documented in this file.
global `GoldRush.NodeEntries` pool exactly as before.
### Fixed
- Zone pool parsing no longer truncates every zone to its first resource entry.
`GoldRush.ZonePool` separates zones with `"; "` (semicolon + space) but the
node/bonus entry IDs within a zone with a bare `";"`. `BuildSites()` split on
the bare `";"`, so each zone's entry list was cut down to its first ID — which
is always a herb. That is why events spawned a single wrong-zone herb and no
ore at all (reported in PR #8). The parser now splits on the two-character
`"; "` zone delimiter, so every zone keeps its full node and bonus pools.
- Herb/ore categorization no longer guesses from display-name keywords. The old
`SplitByCategory()` matched "lotus"/"clover"/"thorn"/"bloom" for herbs and
"vein" for ore, which only worked for the original Northrend default pool and

View file

@ -196,6 +196,33 @@ static AreaTableEntry const* ResolveAreaEntry(std::string const& areaName)
return nullptr;
}
// The GoldRush.ZonePool value separates zones with "; " (semicolon + space) and
// the node/bonus entry IDs within a zone with a bare ";". Acore::Tokenize only
// splits on a single character, so splitting on ';' cut every zone's entry list
// down to its first ID -- the bug behind the wrong-zone/incomplete resource
// spawning reported after PR #7 (every zone's first entry is a herb, so ore
// never appeared and only one herb type spawned). Split on the two-character
// zone delimiter instead.
static std::vector<std::string_view> SplitZonePool(std::string_view zones)
{
std::vector<std::string_view> result;
size_t start = 0;
while (start < zones.size())
{
size_t end = zones.find("; ", start);
if (end == std::string_view::npos)
{
result.push_back(zones.substr(start));
break;
}
result.push_back(zones.substr(start, end - start));
start = end + 2; // skip the "; " delimiter
}
return result;
}
class GoldRushManager
{
public:
@ -568,7 +595,7 @@ private:
// area labels, change this parser to expect 4 segments and adjust
// BuildLocationText/FormatLocationForAnnouncement accordingly.
std::vector<GoldRushSite> sites;
for (std::string_view zoneToken : Acore::Tokenize(zones, ';', true))
for (std::string_view zoneToken : SplitZonePool(zones))
{
std::string token = Trim(std::string(zoneToken));
if (token.empty())