* group entities on map by name again so different types of the same herb/vein
   don't show up as separate groups
 * except mailboxes
 * partially reverts ea25776225
This commit is contained in:
Sarjuuk
2025-11-23 20:40:48 +01:00
parent adc0e16064
commit 2305d8bf13
2 changed files with 24 additions and 22 deletions

View File

@@ -206,15 +206,15 @@ class ZoneBaseResponse extends TemplateResponse implements ICache
/* Main Content */ /* Main Content */
/****************/ /****************/
$addToSOM = function (string $what, array $entry) use (&$som) : void $addToSOM = function (string $what, string $group, array $entry) use (&$som) : void
{ {
// entry always contains: type, id, name, level, coords[] // entry always contains: type, id, name, level, coords[]
if (!isset($som[$what][$entry['name']])) // not found yet if (!isset($som[$what][$group])) // not found yet
$som[$what][$entry['id']][] = $entry; $som[$what][$group][] = $entry;
else // found .. something.. else // found .. something..
{ {
// check for identical floors // check for identical floors
foreach ($som[$what][$entry['id']] as &$byFloor) foreach ($som[$what][$group] as &$byFloor)
{ {
if ($byFloor['level'] != $entry['level']) if ($byFloor['level'] != $entry['level'])
continue; continue;
@@ -225,7 +225,7 @@ class ZoneBaseResponse extends TemplateResponse implements ICache
} }
// floor not used yet, create it // floor not used yet, create it
$som[$what][$entry['id']][] = $entry; $som[$what][$group][] = $entry;
} }
}; };
@@ -310,9 +310,12 @@ class ZoneBaseResponse extends TemplateResponse implements ICache
); );
if ($what == 'mail') if ($what == 'mail')
$blob['side'] = (($tpl['A'] < 0 ? 0 : 0x1) | ($tpl['H'] < 0 ? 0 : 0x2)); {
$blob['side'] = (($tpl['A'] < 0 ? 0 : SIDE_ALLIANCE) | ($tpl['H'] < 0 ? 0 : SIDE_HORDE));
$addToSOM($what, $blob); $addToSOM($what, $tpl['id'], $blob);
}
else
$addToSOM($what, $n, $blob);
} }
if ($tpl['startsQuests']) if ($tpl['startsQuests'])
@@ -339,24 +342,24 @@ class ZoneBaseResponse extends TemplateResponse implements ICache
$this->extendGlobalData($started->getJSGlobals()); $this->extendGlobalData($started->getJSGlobals());
if (($tpl['A'] != -1) && ($_ = $started->getSOMData(SIDE_ALLIANCE))) if (($tpl['A'] != -1) && ($_ = $started->getSOMData(SIDE_ALLIANCE)))
$addToSOM('alliancequests', array( $addToSOM('alliancequests', $n, array(
'coords' => [[$spawn['posX'], $spawn['posY']]], 'coords' => [[$spawn['posX'], $spawn['posY']]],
'level' => $spawn['floor'], 'level' => $spawn['floor'],
'name' => $n, 'name' => $n,
'type' => Type::OBJECT, 'type' => Type::OBJECT,
'id' => $tpl['id'], 'id' => $tpl['id'],
'side' => (($tpl['A'] < 0 ? 0 : 0x1) | ($tpl['H'] < 0 ? 0 : 0x2)), 'side' => (($tpl['A'] < 0 ? 0 : SIDE_ALLIANCE) | ($tpl['H'] < 0 ? 0 : SIDE_HORDE)),
'quests' => array_values($_) 'quests' => array_values($_)
)); ));
if (($tpl['H'] != -1) && ($_ = $started->getSOMData(SIDE_HORDE))) if (($tpl['H'] != -1) && ($_ = $started->getSOMData(SIDE_HORDE)))
$addToSOM('hordequests', array( $addToSOM('hordequests', $n, array(
'coords' => [[$spawn['posX'], $spawn['posY']]], 'coords' => [[$spawn['posX'], $spawn['posY']]],
'level' => $spawn['floor'], 'level' => $spawn['floor'],
'name' => $n, 'name' => $n,
'type' => Type::OBJECT, 'type' => Type::OBJECT,
'id' => $tpl['id'], 'id' => $tpl['id'],
'side' => (($tpl['A'] < 0 ? 0 : 0x1) | ($tpl['H'] < 0 ? 0 : 0x2)), 'side' => (($tpl['A'] < 0 ? 0 : SIDE_ALLIANCE) | ($tpl['H'] < 0 ? 0 : SIDE_HORDE)),
'quests' => array_values($_) 'quests' => array_values($_)
)); ));
} }
@@ -390,7 +393,7 @@ class ZoneBaseResponse extends TemplateResponse implements ICache
if ($creatureSpawns->isBoss()) if ($creatureSpawns->isBoss())
$what = 'boss'; $what = 'boss';
else if ($tpl['rank'] == 2 || $tpl['rank'] == 4) else if ($tpl['rank'] == NPC_RANK_RARE_ELITE || $tpl['rank'] == NPC_RANK_RARE)
$what = 'rare'; $what = 'rare';
else else
foreach ($flagsMap as $flag => $what) foreach ($flagsMap as $flag => $what)
@@ -401,7 +404,7 @@ class ZoneBaseResponse extends TemplateResponse implements ICache
$flightNodes[$tpl['id']] = [$spawn['posX'], $spawn['posY']]; $flightNodes[$tpl['id']] = [$spawn['posX'], $spawn['posY']];
if ($what) if ($what)
$addToSOM($what, array( $addToSOM($what, $n, array(
'coords' => [[$spawn['posX'], $spawn['posY']]], 'coords' => [[$spawn['posX'], $spawn['posY']]],
'level' => $spawn['floor'], 'level' => $spawn['floor'],
'name' => $n, 'name' => $n,
@@ -436,7 +439,7 @@ class ZoneBaseResponse extends TemplateResponse implements ICache
$this->extendGlobalData($started->getJSGlobals()); $this->extendGlobalData($started->getJSGlobals());
if (($tpl['A'] != -1) && ($_ = $started->getSOMData(SIDE_ALLIANCE))) if (($tpl['A'] != -1) && ($_ = $started->getSOMData(SIDE_ALLIANCE)))
$addToSOM('alliancequests', array( $addToSOM('alliancequests', $n, array(
'coords' => [[$spawn['posX'], $spawn['posY']]], 'coords' => [[$spawn['posX'], $spawn['posY']]],
'level' => $spawn['floor'], 'level' => $spawn['floor'],
'name' => $n, 'name' => $n,
@@ -449,7 +452,7 @@ class ZoneBaseResponse extends TemplateResponse implements ICache
)); ));
if (($tpl['H'] != -1) && ($_ = $started->getSOMData(SIDE_HORDE))) if (($tpl['H'] != -1) && ($_ = $started->getSOMData(SIDE_HORDE)))
$addToSOM('hordequests', array( $addToSOM('hordequests', $n, array(
'coords' => [[$spawn['posX'], $spawn['posY']]], 'coords' => [[$spawn['posX'], $spawn['posY']]],
'level' => $spawn['floor'], 'level' => $spawn['floor'],
'name' => $n, 'name' => $n,
@@ -472,10 +475,11 @@ class ZoneBaseResponse extends TemplateResponse implements ICache
if (!$tpl) if (!$tpl)
continue; continue;
$addToSOM('areatrigger', array( $n = Util::localizedString($tpl, 'name', true, true);
$addToSOM('areatrigger', $n, array(
'coords' => [[$spawn['posX'], $spawn['posY']]], 'coords' => [[$spawn['posX'], $spawn['posY']]],
'level' => $spawn['floor'], 'level' => $spawn['floor'],
'name' => Util::localizedString($tpl, 'name', true, true), 'name' => $n,
'type' => Type::AREATRIGGER, 'type' => Type::AREATRIGGER,
'id' => $spawn['typeId'], 'id' => $spawn['typeId'],
'description' => Lang::game('type').Lang::areatrigger('types', $tpl['type']) 'description' => Lang::game('type').Lang::areatrigger('types', $tpl['type'])

View File

@@ -107,10 +107,8 @@ ShowOnMap.prototype.construct = function() {
} }
if (nCoords > 0) { if (nCoords > 0) {
var url = (g_types[group[p][0].type] && group[p][0].id ? '?' + g_types[group[p][0].type] + '=' + group[p][0].id : ''); var url = (g_types[group[p][0].type] && group[p][0].id ? '?' + g_types[group[p][0].type] + '=' + group[p][0].id : '');
// legend[submenu.length+1] = [p, url]; aowow - switch to numeric groupIdx to support mail legend[submenu.length+1] = [p, url];
// entry.push(p + $WH.sprintf(LANG.qty, nPins)); entry.push(p + $WH.sprintf(LANG.qty, nPins));
legend[submenu.length+1] = [group[p][0].name, url];
entry.push(group[p][0].name + $WH.sprintf(LANG.qty, nPins));
entry.push(this.showStuff.bind(this, coords, [i, i2], legend)); entry.push(this.showStuff.bind(this, coords, [i, i2], legend));
submenu.push(entry); submenu.push(entry);
for (var l in coords) { for (var l in coords) {