From 5ffac92934a7bcf6f9d8766871d1e99e495f803f Mon Sep 17 00:00:00 2001 From: "Troll (Hermes Agent)" Date: Thu, 10 Sep 2026 02:15:44 +0000 Subject: [PATCH] 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. --- CHANGELOG.md | 7 +++++++ src/GoldRush.cpp | 29 ++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7421500..f86e6bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/GoldRush.cpp b/src/GoldRush.cpp index 99f94ce..e8837a0 100644 --- a/src/GoldRush.cpp +++ b/src/GoldRush.cpp @@ -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 SplitZonePool(std::string_view zones) +{ + std::vector 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 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())