Profiler/Misc

* fix realm selection in profiler filters
 * minor cleanup of prQueue
This commit is contained in:
Sarjuuk
2025-06-17 17:28:21 +02:00
parent 91bb53aa1d
commit cd94a2fa4e
5 changed files with 52 additions and 97 deletions

View File

@@ -46,6 +46,8 @@ class ArenaTeamList extends BaseType
class ArenaTeamListFilter extends Filter
{
use TrProfilerFilter;
public $extraOpts = [];
protected $genericFilter = [];
@@ -86,33 +88,6 @@ class ArenaTeamListFilter extends Filter
return $parts;
}
protected function cbRegionCheck(string &$v) : bool
{
if (in_array($v, Util::$regions))
{
$this->parentCats[0] = $v; // directly redirect onto this region
$v = ''; // remove from filter
return true;
}
return false;
}
protected function cbServerCheck(string &$v) : bool
{
foreach (Profiler::getRealms() as $realm)
if ($realm['name'] == $v)
{
$this->parentCats[1] = Profiler::urlize($v);// directly redirect onto this server
$v = ''; // remove from filter
return true;
}
return false;
}
}

View File

@@ -918,6 +918,37 @@ trait sourceHelper
}
}
trait TrProfilerFilter
{
protected function cbRegionCheck(string &$v) : bool
{
if (in_array($v, Util::$regions))
{
$this->parentCats[0] = $v; // directly redirect onto this region
$v = ''; // remove from filter
return true;
}
return false;
}
protected function cbServerCheck(string &$v) : bool
{
foreach (Profiler::getRealms() as $realm)
{
if (Profiler::urlize($realm['name']) != $v)
continue;
$this->parentCats[1] = $v; // directly redirect onto this server
$v = ''; // remove from filter
return true;
}
return false;
}
}
abstract class Filter
{

View File

@@ -89,6 +89,8 @@ class GuildList extends BaseType
class GuildListFilter extends Filter
{
use TrProfilerFilter;
public $extraOpts = [];
protected $genericFilter = [];
@@ -124,33 +126,6 @@ class GuildListFilter extends Filter
return $parts;
}
protected function cbRegionCheck(string &$v) : bool
{
if (in_array($v, Util::$regions))
{
$this->parentCats[0] = $v; // directly redirect onto this region
$v = ''; // remove from filter
return true;
}
return false;
}
protected function cbServerCheck(string &$v) : bool
{
foreach (Profiler::getRealms() as $realm)
if ($realm['name'] == $v)
{
$this->parentCats[1] = Profiler::urlize($v);// directly redirect onto this server
$v = ''; // remove from filter
return true;
}
return false;
}
}

View File

@@ -239,6 +239,8 @@ class ProfileList extends BaseType
class ProfileListFilter extends Filter
{
use TrProfilerFilter;
public $useLocalList = false;
public $extraOpts = [];
@@ -359,33 +361,6 @@ class ProfileListFilter extends Filter
return $parts;
}
protected function cbRegionCheck(string &$v) : bool
{
if (in_array($v, Util::$regions))
{
$this->parentCats[0] = $v; // directly redirect onto this region
$v = ''; // remove from filter
return true;
}
return false;
}
protected function cbServerCheck(string &$v) : bool
{
foreach (Profiler::getRealms() as $realm)
if ($realm['name'] == $v)
{
$this->parentCats[1] = Profiler::urlize($v);// directly redirect onto this server
$v = ''; // remove from filter
return true;
}
return false;
}
protected function cbProfession(int $cr, int $crs, string $crv, $skillId) : ?array
{
if (!Util::checkNumeric($crv, NUM_CAST_INT) || !$this->int2Op($crs))