bug: wrong-zone resources spawning after PR #7 #8
2 changed files with 35 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue