mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Sort zones in ?npc=... by spawn count
This commit is contained in:
@@ -666,9 +666,22 @@ trait spawnHelper
|
||||
foreach ($areas as $f => &$floor)
|
||||
$floor['count'] = count($floor['coords']) - (!empty($wpSum[$a][$f]) ? $wpSum[$a][$f] : 0);
|
||||
|
||||
uasort($data, array($this, 'sortBySpawnCount'));
|
||||
$this->spawnResult[SPAWNINFO_FULL] = $data;
|
||||
}
|
||||
|
||||
private function sortBySpawnCount($a, $b)
|
||||
{
|
||||
$aCount = current($a)['count'];
|
||||
$bCount = current($b)['count'];
|
||||
|
||||
if ($aCount == $bCount) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($aCount < $bCount) ? 1 : -1;
|
||||
}
|
||||
|
||||
private function createZoneSpawns() // [zoneId1, zoneId2, ..] for locations-column in listview
|
||||
{
|
||||
$res = DB::Aowow()->selectCol("SELECT typeId AS ARRAY_KEY, GROUP_CONCAT(DISTINCT areaId) FROM ?_spawns WHERE type = ?d AND typeId IN (?a) GROUP BY typeId", self::$type, $this->getfoundIDs());
|
||||
|
||||
Reference in New Issue
Block a user