Filters/Cleanup

* move filter constants to class Filter
 * use less magic numbers
 * add type declarations
This commit is contained in:
Sarjuuk
2025-02-05 21:31:29 +01:00
parent 398b93e9a7
commit 748a78c3c7
18 changed files with 797 additions and 789 deletions

View File

@@ -609,7 +609,7 @@ trait spawnHelper
return; return;
if (User::isInGroup(U_GROUP_MODERATOR)) if (User::isInGroup(U_GROUP_MODERATOR))
if ($guids = array_column(array_filter($spawns, function ($x) { return $x['guid'] > 0 || $x['type'] != Type::NPC; }), 'guid')) if ($guids = array_column(array_filter($spawns, fn($x) => $x['guid'] > 0 || $x['type'] != Type::NPC), 'guid'))
$worldPos = Game::getWorldPosForGUID(self::$type, ...$guids); $worldPos = Game::getWorldPosForGUID(self::$type, ...$guids);
foreach ($spawns as $s) foreach ($spawns as $s)
@@ -910,37 +910,23 @@ abstract class Filter
{ {
private static $wCards = ['*' => '%', '?' => '_']; private static $wCards = ['*' => '%', '?' => '_'];
public $error = false; // erronous search fields public const CR_BOOLEAN = 1;
public const CR_FLAG = 2;
public const CR_NUMERIC = 3;
public const CR_STRING = 4;
public const CR_ENUM = 5;
public const CR_STAFFFLAG = 6;
public const CR_CALLBACK = 7;
public const CR_NYI_PH = 999;
private $cndSet = []; public const V_EQUAL = 8;
public const V_RANGE = 9;
public const V_LIST = 10;
public const V_CALLBACK = 11;
public const V_REGEX = 12;
/* genericFilter: [FILTER_TYPE, colOrFnName, param1, param2] protected const ENUM_ANY = -2323;
[FILTER_CR_BOOLEAN, <string:colName>, <bool:isString>, null] protected const ENUM_NONE = -2324;
[FILTER_CR_FLAG, <string:colName>, <int:testBit>, <bool:matchAny>] # default param2: matchExact
[FILTER_CR_NUMERIC, <string:colName>, <int:NUM_FLAGS>, <bool:addExtraCol>]
[FILTER_CR_STRING, <string:colName>, <int:STR_FLAGS>, null]
[FILTER_CR_ENUM, <string:colName>, <bool:ANYNONE>, <bool:isEnumVal>] # param3 ? cr[2] is val in enum : key in enum
[FILTER_CR_STAFFFLAG, <string:colName>, null, null]
[FILTER_CR_CALLBACK, <string:fnName>, <mixed:param1>, <mixed:param2>]
[FILTER_CR_NYI_PH, null, <int:returnVal>, param2] # mostly 1: to ignore this criterium; 0: to fail the whole query
*/
protected $genericFilter = [];
protected $enums = []; // criteriumID => [validOptionList]
/*
fieldId => [checkType, checkValue[, fieldIsArray]]
*/
protected $inputFields = []; // list of input fields defined per page
protected $parentCats = []; // used to validate ty-filter
protected $fiData = ['c' => [], 'v' =>[]];
protected $formData = array( // data to fill form fields
'form' => [], // base form - unsanitized
'setCriteria' => [], // dynamic criteria list - index checked
'setWeights' => [], // dynamic weights list - index checked
'extraCols' => [], // extra columns for LV - added as required
'reputationCols' => [] // simlar and exclusive to extraCols - added as required
);
protected const PATTERN_NAME = '/[\p{C};%\\\\]/ui'; protected const PATTERN_NAME = '/[\p{C};%\\\\]/ui';
protected const PATTERN_CRV = '/[\p{C};:%\\\\]/ui'; protected const PATTERN_CRV = '/[\p{C};:%\\\\]/ui';
@@ -972,8 +958,40 @@ abstract class Filter
protected const ENUM_RACE = array( null, 1, 2, 3, 4, 5, 6, 7, 8, null, 10, 11, true, false); protected const ENUM_RACE = array( null, 1, 2, 3, 4, 5, 6, 7, 8, null, 10, 11, true, false);
protected const ENUM_PROFESSION = array( null, 171, 164, 185, 333, 202, 129, 755, 165, 186, 197, true, false, 356, 182, 773); protected const ENUM_PROFESSION = array( null, 171, 164, 185, 333, 202, 129, 755, 165, 186, 197, true, false, 356, 182, 773);
public $error = false; // erronous search fields
private $cndSet = [];
/* genericFilter: [FILTER_TYPE, colOrFnName, param1, param2]
[self::CR_BOOLEAN, <string:colName>, <bool:isString>, null]
[self::CR_FLAG, <string:colName>, <int:testBit>, <bool:matchAny>] # default param2: matchExact
[self::CR_NUMERIC, <string:colName>, <int:NUM_FLAGS>, <bool:addExtraCol>]
[self::CR_STRING, <string:colName>, <int:STR_FLAGS>, null]
[self::CR_ENUM, <string:colName>, <bool:ANYNONE>, <bool:isEnumVal>] # param3 ? crv is val in enum : key in enum
[self::CR_STAFFFLAG, <string:colName>, null, null]
[self::CR_CALLBACK, <string:fnName>, <mixed:param1>, <mixed:param2>]
[self::CR_NYI_PH, null, <int:returnVal>, param2] # mostly 1: to ignore this criterium; 0: to fail the whole query
*/
protected $genericFilter = [];
protected $enums = []; // criteriumID => [validOptionList]
/*
fieldId => [checkType, checkValue[, fieldIsArray]]
*/
protected $inputFields = []; // list of input fields defined per page
protected $parentCats = []; // used to validate ty-filter
protected $fiData = ['c' => [], 'v' =>[]];
protected $formData = array( // data to fill form fields
'form' => [], // base form - unsanitized
'setCriteria' => [], // dynamic criteria list - index checked
'setWeights' => [], // dynamic weights list - index checked
'extraCols' => [], // extra columns for LV - added as required
'reputationCols' => [] // simlar and exclusive to extraCols - added as required
);
// parse the provided request into a usable format // parse the provided request into a usable format
public function __construct($fromPOST = false, $opts = []) public function __construct(bool $fromPOST = false, array $opts = [])
{ {
if (!empty($opts['parentCats'])) if (!empty($opts['parentCats']))
$this->parentCats = $opts['parentCats']; $this->parentCats = $opts['parentCats'];
@@ -999,13 +1017,13 @@ abstract class Filter
return ['formData']; return ['formData'];
} }
public function mergeCat(&$cats) public function mergeCat(&$cats) : void
{ {
foreach ($this->parentCats as $idx => $cat) foreach ($this->parentCats as $idx => $cat)
$cats[$idx] = $cat; $cats[$idx] = $cat;
} }
private function &criteriaIterator() private function &criteriaIterator() : Generator
{ {
if (!$this->fiData['c']) if (!$this->fiData['c'])
return; return;
@@ -1025,7 +1043,7 @@ abstract class Filter
public function getFilterString(array $override = [], array $addCr = []) : string public function getFilterString(array $override = [], array $addCr = []) : string
{ {
$_ = []; $filterURL = [];
foreach (array_merge($this->fiData['c'], $this->fiData['v'], $override) as $k => $v) foreach (array_merge($this->fiData['c'], $this->fiData['v'], $override) as $k => $v)
{ {
if (isset($addCr[$k])) if (isset($addCr[$k]))
@@ -1035,42 +1053,47 @@ abstract class Filter
} }
if (is_array($v) && !empty($v)) if (is_array($v) && !empty($v))
$_[$k] = $k.'='.implode(':', $v); $filterURL[$k] = $k.'='.implode(':', $v);
else if ($v !== '') else if ($v !== '')
$_[$k] = $k.'='.$v; $filterURL[$k] = $k.'='.$v;
} }
// no criteria were set, so no merge occured .. append // no criteria were set, so no merge occured .. append
if ($addCr) if ($addCr)
{ {
$_['cr'] = 'cr='.$addCr['cr']; $filterURL['cr'] = 'cr='.$addCr['cr'];
$_['crs'] = 'crs='.$addCr['crs']; $filterURL['crs'] = 'crs='.$addCr['crs'];
$_['crv'] = 'crv='.$addCr['crv']; $filterURL['crv'] = 'crv='.$addCr['crv'];
} }
return implode(';', $_); return implode(';', $filterURL);
} }
// [<string>ExtraCol, ...]
public function getExtraCols() : array public function getExtraCols() : array
{ {
return array_unique($this->formData['extraCols']); return array_unique($this->formData['extraCols']);
} }
// ['cr' => <array>Criterium, 'crs' => <array>CriteriumSign, 'crv' => <array>CriteriumValue]
public function getSetCriteria() : array public function getSetCriteria() : array
{ {
return $this->formData['setCriteria']; return $this->formData['setCriteria'];
} }
// [<array>WeightID, <array>WeightValue]
public function getSetWeights() : array public function getSetWeights() : array
{ {
return $this->formData['setWeights']; return $this->formData['setWeights'];
} }
// [<string>ExtraCol, ...]
public function getReputationCols() : array public function getReputationCols() : array
{ {
return $this->formData['reputationCols']; return $this->formData['reputationCols'];
} }
// [inputField => FieldValue, ...]
public function getForm() : array public function getForm() : array
{ {
return $this->formData['form']; return $this->formData['form'];
@@ -1085,7 +1108,7 @@ abstract class Filter
// criteria // criteria
foreach ($this->criteriaIterator() as &$_cr) foreach ($this->criteriaIterator() as &$_cr)
if ($cnd = $this->createSQLForCriterium($_cr)) if ($cnd = $this->createSQLForCriterium(...$_cr))
$this->cndSet[] = $cnd; $this->cndSet[] = $cnd;
if ($this->cndSet) if ($this->cndSet)
@@ -1148,7 +1171,6 @@ abstract class Filter
$post[$_[0]] = $_[1]; $post[$_[0]] = $_[1];
} }
$cr = $crs = $crv = [];
foreach ($this->inputFields as $inp => [$type, $valid, $asArray]) foreach ($this->inputFields as $inp => [$type, $valid, $asArray])
{ {
if (!isset($post[$inp]) || $post[$inp] === '') if (!isset($post[$inp]) || $post[$inp] === '')
@@ -1228,19 +1250,19 @@ abstract class Filter
$gf = $this->genericFilter[$_cr[$i]]; $gf = $this->genericFilter[$_cr[$i]];
switch ($gf[0]) switch ($gf[0])
{ {
case FILTER_CR_NUMERIC: case self::CR_NUMERIC:
$_ = $_crs[$i]; $_ = $_crs[$i];
if (!Util::checkNumeric($_crv[$i], $gf[2]) || !$this->int2Op($_)) if (!Util::checkNumeric($_crv[$i], $gf[2]) || !$this->int2Op($_))
$unsetme = true; $unsetme = true;
break; break;
case FILTER_CR_BOOLEAN: case self::CR_BOOLEAN:
case FILTER_CR_FLAG: case self::CR_FLAG:
case FILTER_CR_STAFFFLAG: case self::CR_STAFFFLAG:
$_ = $_crs[$i]; $_ = $_crs[$i];
if (!$this->int2Bool($_)) if (!$this->int2Bool($_))
$unsetme = true; $unsetme = true;
break; break;
case FILTER_CR_ENUM: case self::CR_ENUM:
if (!Util::checkNumeric($_crs[$i], NUM_CAST_INT)) if (!Util::checkNumeric($_crs[$i], NUM_CAST_INT))
$unsetme = true; $unsetme = true;
break; break;
@@ -1300,11 +1322,11 @@ abstract class Filter
$this->formData['setWeights'] = [$_wt, $_wtv]; $this->formData['setWeights'] = [$_wt, $_wtv];
} }
protected function checkInput($type, $valid, &$val, $recursive = false) protected function checkInput(int $type, mixed $valid, mixed &$val, bool $recursive = false) : bool
{ {
switch ($type) switch ($type)
{ {
case FILTER_V_EQUAL: case self::V_EQUAL:
if (gettype($valid) == 'integer') if (gettype($valid) == 'integer')
$val = intval($val); $val = intval($val);
else if (gettype($valid) == 'double') else if (gettype($valid) == 'double')
@@ -1316,7 +1338,7 @@ abstract class Filter
return true; return true;
break; break;
case FILTER_V_LIST: case self::V_LIST:
if (!Util::checkNumeric($val, NUM_CAST_INT)) if (!Util::checkNumeric($val, NUM_CAST_INT))
return false; return false;
@@ -1325,7 +1347,7 @@ abstract class Filter
if (gettype($v) != 'array') if (gettype($v) != 'array')
continue; continue;
if ($this->checkInput(FILTER_V_RANGE, $v, $val, true)) if ($this->checkInput(self::V_RANGE, $v, $val, true))
return true; return true;
unset($valid[$k]); unset($valid[$k]);
@@ -1335,17 +1357,17 @@ abstract class Filter
return true; return true;
break; break;
case FILTER_V_RANGE: case self::V_RANGE:
if (Util::checkNumeric($val, NUM_CAST_INT) && $val >= $valid[0] && $val <= $valid[1]) if (Util::checkNumeric($val, NUM_CAST_INT) && $val >= $valid[0] && $val <= $valid[1])
return true; return true;
break; break;
case FILTER_V_CALLBACK: case self::V_CALLBACK:
if ($this->$valid($val)) if ($this->$valid($val))
return true; return true;
break; break;
case FILTER_V_REGEX: case self::V_REGEX:
if (!preg_match($valid, $val)) if (!preg_match($valid, $val))
return true; return true;
@@ -1364,7 +1386,7 @@ abstract class Filter
$string = str_replace('_', '\\_', $string); $string = str_replace('_', '\\_', $string);
// now replace search wildcards with sql wildcards // now replace search wildcards with sql wildcards
$string = strtr($string, Filter::$wCards); $string = strtr($string, self::$wCards);
return sprintf($exact ? '%s' : '%%%s%%', $string); return sprintf($exact ? '%s' : '%%%s%%', $string);
} }
@@ -1409,7 +1431,7 @@ abstract class Filter
return $qry; return $qry;
} }
protected function int2Op(&$op) protected function int2Op(mixed &$op) : bool
{ {
switch ($op) switch ($op)
{ {
@@ -1423,7 +1445,7 @@ abstract class Filter
} }
} }
protected function int2Bool(&$op) protected function int2Bool(mixed &$op) : bool
{ {
switch ($op) switch ($op)
{ {
@@ -1433,7 +1455,7 @@ abstract class Filter
} }
} }
protected function list2Mask(array $list, $noOffset = false) protected function list2Mask(array $list, bool $noOffset = false) : int
{ {
$mask = 0x0; $mask = 0x0;
$o = $noOffset ? 0 : 1; // schoolMask requires this..? $o = $noOffset ? 0 : 1; // schoolMask requires this..?
@@ -1450,7 +1472,7 @@ abstract class Filter
/* generic criteria */ /* generic criteria */
/**************************/ /**************************/
private function genericBoolean($field, $op, $isString) private function genericBoolean($field, $op, bool $isString) : ?array
{ {
if ($this->int2Bool($op)) if ($this->int2Bool($op))
{ {
@@ -1463,7 +1485,7 @@ abstract class Filter
return null; return null;
} }
private function genericBooleanFlags($field, $value, $op, $matchAny = false) private function genericBooleanFlags($field, $value, $op, ?bool $matchAny = false) : ?array
{ {
if (!$this->int2Bool($op)) if (!$this->int2Bool($op))
return null; return null;
@@ -1476,7 +1498,7 @@ abstract class Filter
return [[$field, $value, '&'], $value]; return [[$field, $value, '&'], $value];
} }
private function genericString($field, $value, $strFlags) private function genericString($field, $value, $strFlags) : ?array
{ {
if ($strFlags & STR_LOCALIZED) if ($strFlags & STR_LOCALIZED)
$field .= '_loc'.Lang::getLocale()->value; $field .= '_loc'.Lang::getLocale()->value;
@@ -1484,7 +1506,7 @@ abstract class Filter
return $this->modularizeString([$field], (string)$value, $strFlags & STR_MATCH_EXACT, $strFlags & STR_ALLOW_SHORT); return $this->modularizeString([$field], (string)$value, $strFlags & STR_MATCH_EXACT, $strFlags & STR_ALLOW_SHORT);
} }
private function genericNumeric($field, &$value, $op, $typeCast) private function genericNumeric($field, $value, $op, $typeCast) : ?array
{ {
if (!Util::checkNumeric($value, $typeCast)) if (!Util::checkNumeric($value, $typeCast))
return null; return null;
@@ -1495,13 +1517,13 @@ abstract class Filter
return null; return null;
} }
private function genericEnum($field, $value) private function genericEnum($field, $value) : ?array
{ {
if (is_bool($value)) if (is_bool($value))
return [$field, 0, ($value ? '>' : '<=')]; return [$field, 0, ($value ? '>' : '<=')];
else if ($value == FILTER_ENUM_ANY) // any else if ($value == self::ENUM_ANY) // any
return [$field, 0, '!']; return [$field, 0, '!'];
else if ($value == FILTER_ENUM_NONE) // none else if ($value == self::ENUM_NONE) // none
return [$field, 0]; return [$field, 0];
else if ($value !== null) else if ($value !== null)
return [$field, $value]; return [$field, $value];
@@ -1509,58 +1531,58 @@ abstract class Filter
return null; return null;
} }
protected function genericCriterion(&$cr) protected function genericCriterion(int $cr, int $crs, string $crv) : ?array
{ {
$gen = array_pad($this->genericFilter[$cr[0]], 4, null); [$crType, $colOrFn, $param1, $param2] = array_pad($this->genericFilter[$cr], 4, null);
$result = null; $result = null;
switch ($gen[0]) switch ($crType)
{ {
case FILTER_CR_NUMERIC: case self::CR_NUMERIC:
$result = $this->genericNumeric($gen[1], $cr[2], $cr[1], $gen[2]); $result = $this->genericNumeric($colOrFn, $crv, $crs, $param1);
break; break;
case FILTER_CR_FLAG: case self::CR_FLAG:
$result = $this->genericBooleanFlags($gen[1], $gen[2], $cr[1], $gen[3]); $result = $this->genericBooleanFlags($colOrFn, $param1, $crs, $param2);
break; break;
case FILTER_CR_STAFFFLAG: case self::CR_STAFFFLAG:
if (User::isInGroup(U_GROUP_EMPLOYEE) && $cr[1] >= 0) if (User::isInGroup(U_GROUP_EMPLOYEE) && $crs >= 0)
$result = $this->genericBooleanFlags($gen[1], (1 << $cr[1]), true); $result = $this->genericBooleanFlags($colOrFn, (1 << $crs), true);
break; break;
case FILTER_CR_BOOLEAN: case self::CR_BOOLEAN:
$result = $this->genericBoolean($gen[1], $cr[1], !empty($gen[2])); $result = $this->genericBoolean($colOrFn, $crs, !empty($param1));
break; break;
case FILTER_CR_STRING: case self::CR_STRING:
$result = $this->genericString($gen[1], $cr[2], $gen[2]); $result = $this->genericString($colOrFn, $crv, $param1);
break; break;
case FILTER_CR_ENUM: case self::CR_ENUM:
if (!$gen[3] && isset($this->enums[$cr[0]][$cr[1]])) if (!$param2 && isset($this->enums[$cr][$crs]))
$result = $this->genericEnum($gen[1], $this->enums[$cr[0]][$cr[1]]); $result = $this->genericEnum($colOrFn, $this->enums[$cr][$crs]);
if ($gen[3] && in_array($cr[1], $this->enums[$cr[0]])) if ($param2 && in_array($crs, $this->enums[$cr]))
$result = $this->genericEnum($gen[1], $cr[1]); $result = $this->genericEnum($colOrFn, $crs);
else if ($gen[2] && ($cr[1] == FILTER_ENUM_ANY || $cr[1] == FILTER_ENUM_NONE)) else if ($param1 && ($crs == self::ENUM_ANY || $crs == self::ENUM_NONE))
$result = $this->genericEnum($gen[1], $cr[1]); $result = $this->genericEnum($colOrFn, $crs);
break; break;
case FILTER_CR_CALLBACK: case self::CR_CALLBACK:
$result = $this->{$gen[1]}($cr, $gen[2], $gen[3]); $result = $this->{$colOrFn}([$cr, $crs, $crv], $param1, $param2);
break; break;
case FILTER_CR_NYI_PH: // do not limit with not implemented filters case self::CR_NYI_PH: // do not limit with not implemented filters
if (is_int($gen[2])) if (is_int($param1))
return [$gen[2]]; return [$param1];
// for nonsensical values; compare against 0 // for nonsensical values; compare against 0
if ($this->int2Op($cr[1]) && Util::checkNumeric($cr[2])) if ($this->int2Op($crs) && Util::checkNumeric($crv))
{ {
if ($cr[1] == '=') if ($crs == '=')
$cr[1] = '=='; $crs = '==';
return eval('return ('.$cr[2].' '.$cr[1].' 0);') ? [1] : [0]; return eval('return ('.$crv.' '.$crs.' 0);') ? [1] : [0];
} }
else else
return [0]; return [0];
} }
if ($result && $gen[0] == FILTER_CR_NUMERIC && !empty($gen[3])) if ($result && $crType == self::CR_NUMERIC && !empty($param2))
$this->formData['extraCols'][] = $cr[0]; $this->formData['extraCols'][] = $cr;
return $result; return $result;
} }
@@ -1571,19 +1593,19 @@ abstract class Filter
/* non-generic values and criteria */ /* non-generic values and criteria */
/***********************************/ /***********************************/
protected function createSQLForCriterium(array &$cr) : array protected function createSQLForCriterium(int &$cr, int &$crs, string &$crv) : array
{ {
if (!$this->genericFilter) // criteria not in use - no error if (!$this->genericFilter) // criteria not in use - no error
return []; return [];
if (in_array($cr[0], array_keys($this->genericFilter))) if (in_array($cr, array_keys($this->genericFilter)))
if ($genCr = $this->genericCriterion($cr)) if ($genCr = $this->genericCriterion($cr, $crs, $crv))
return $genCr; return $genCr;
$this->error = true; $this->error = true;
trigger_error('Filter::createSQLForCriterium - received unhandled criterium: ["'.$cr[0].'", "'.$cr[1].'", "'.$cr[2].'"]', E_USER_WARNING); trigger_error('Filter::createSQLForCriterium - received unhandled criterium: ["'.$cr.'", "'.$crs.'", "'.$crv.'"]', E_USER_WARNING);
unset($cr); unset($cr, $crs, $crv);
return []; return [];
} }

View File

@@ -155,24 +155,6 @@ define('BUTTON_GUIDE_NEW', 11);
define('BUTTON_GUIDE_EDIT', 12); define('BUTTON_GUIDE_EDIT', 12);
define('BUTTON_GUIDE_LOG', 13); define('BUTTON_GUIDE_LOG', 13);
// generic filter handler
define('FILTER_CR_BOOLEAN', 1);
define('FILTER_CR_FLAG', 2);
define('FILTER_CR_NUMERIC', 3);
define('FILTER_CR_STRING', 4);
define('FILTER_CR_ENUM', 5);
define('FILTER_CR_STAFFFLAG', 6);
define('FILTER_CR_CALLBACK', 7);
define('FILTER_CR_NYI_PH', 999);
define('FILTER_V_EQUAL', 8);
define('FILTER_V_RANGE', 9);
define('FILTER_V_LIST', 10);
define('FILTER_V_CALLBACK', 11);
define('FILTER_V_REGEX', 12);
define('FILTER_ENUM_ANY', -2323);
define('FILTER_ENUM_NONE', -2324);
// conditional information in template // conditional information in template
define('GLOBALINFO_SELF', 0x1); // id, name, icon define('GLOBALINFO_SELF', 0x1); // id, name, icon
define('GLOBALINFO_RELATED', 0x2); // spells used by pet, classes/races required by spell, ect define('GLOBALINFO_RELATED', 0x2); // spells used by pet, classes/races required by spell, ect

View File

@@ -296,8 +296,8 @@ class AchievementListFilter extends Filter
141 => 156, // Feast of Winter Veil 141 => 156, // Feast of Winter Veil
409 => -3456, // Day of the Dead 409 => -3456, // Day of the Dead
398 => -3457, // Pirates' Day 398 => -3457, // Pirates' Day
FILTER_ENUM_ANY => true, parent::ENUM_ANY => true,
FILTER_ENUM_NONE => false, parent::ENUM_NONE => false,
283 => -1, // valid events without achievements 283 => -1, // valid events without achievements
285 => -1, 353 => -1, 420 => -1, 285 => -1, 353 => -1, 420 => -1,
400 => -1, 284 => -1, 374 => -1, 400 => -1, 284 => -1, 374 => -1,
@@ -306,31 +306,31 @@ class AchievementListFilter extends Filter
); );
protected $genericFilter = array( protected $genericFilter = array(
2 => [FILTER_CR_BOOLEAN, 'reward_loc0', true ], // givesreward 2 => [parent::CR_BOOLEAN, 'reward_loc0', true ], // givesreward
3 => [FILTER_CR_STRING, 'reward', STR_LOCALIZED ], // rewardtext 3 => [parent::CR_STRING, 'reward', STR_LOCALIZED ], // rewardtext
4 => [FILTER_CR_NYI_PH, null, 1, ], // location [enum] 4 => [parent::CR_NYI_PH, null, 1, ], // location [enum]
5 => [FILTER_CR_CALLBACK, 'cbSeries', ACHIEVEMENT_CU_FIRST_SERIES, null], // first in series [yn] 5 => [parent::CR_CALLBACK, 'cbSeries', ACHIEVEMENT_CU_FIRST_SERIES, null], // first in series [yn]
6 => [FILTER_CR_CALLBACK, 'cbSeries', ACHIEVEMENT_CU_LAST_SERIES, null], // last in series [yn] 6 => [parent::CR_CALLBACK, 'cbSeries', ACHIEVEMENT_CU_LAST_SERIES, null], // last in series [yn]
7 => [FILTER_CR_BOOLEAN, 'chainId', ], // partseries 7 => [parent::CR_BOOLEAN, 'chainId', ], // partseries
9 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true], // id 9 => [parent::CR_NUMERIC, 'id', NUM_CAST_INT, true], // id
10 => [FILTER_CR_STRING, 'ic.name', ], // icon 10 => [parent::CR_STRING, 'ic.name', ], // icon
11 => [FILTER_CR_CALLBACK, 'cbRelEvent', null, null], // related event [enum] 11 => [parent::CR_CALLBACK, 'cbRelEvent', null, null], // related event [enum]
14 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 14 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
15 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots 15 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
16 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 16 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
18 => [FILTER_CR_STAFFFLAG, 'flags', ] // flags 18 => [parent::CR_STAFFFLAG, 'flags', ] // flags
); );
protected $inputFields = array( protected $inputFields = array(
'cr' => [FILTER_V_RANGE, [2, 18], true ], // criteria ids 'cr' => [parent::V_RANGE, [2, 18], true ], // criteria ids
'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 99999]], true ], // criteria operators 'crs' => [parent::V_LIST, [parent::ENUM_NONE, parent::ENUM_ANY, [0, 99999]], true ], // criteria operators
'crv' => [FILTER_V_REGEX, parent::PATTERN_CRV, true ], // criteria values - only printable chars, no delimiters 'crv' => [parent::V_REGEX, parent::PATTERN_CRV, true ], // criteria values - only printable chars, no delimiters
'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name / description - only printable chars, no delimiter 'na' => [parent::V_REGEX, parent::PATTERN_NAME, false], // name / description - only printable chars, no delimiter
'ex' => [FILTER_V_EQUAL, 'on', false], // extended name search 'ex' => [parent::V_EQUAL, 'on', false], // extended name search
'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'ma' => [parent::V_EQUAL, 1, false], // match any / all filter
'si' => [FILTER_V_LIST, [1, 2, 3, -1, -2], false], // side 'si' => [parent::V_LIST, [SIDE_ALLIANCE, SIDE_HORDE, SIDE_BOTH, -SIDE_ALLIANCE, -SIDE_HORDE], false], // side
'minpt' => [FILTER_V_RANGE, [1, 99], false], // required level min 'minpt' => [parent::V_RANGE, [1, 99], false], // required level min
'maxpt' => [FILTER_V_RANGE, [1, 99], false] // required level max 'maxpt' => [parent::V_RANGE, [1, 99], false] // required level max
); );
protected function createSQLForValues() protected function createSQLForValues()
@@ -364,13 +364,13 @@ class AchievementListFilter extends Filter
{ {
switch ($_v['si']) switch ($_v['si'])
{ {
case -1: // faction, exclusive both case -SIDE_ALLIANCE: // equals faction
case -2: case -SIDE_HORDE:
$parts[] = ['faction', -$_v['si']]; $parts[] = ['faction', -$_v['si']];
break; break;
case 1: // faction, inclusive both case SIDE_ALLIANCE: // includes faction
case 2: case SIDE_HORDE:
case 3: // both case SIDE_BOTH:
$parts[] = ['faction', $_v['si'], '&']; $parts[] = ['faction', $_v['si'], '&'];
break; break;
} }
@@ -389,7 +389,7 @@ class AchievementListFilter extends Filter
return ($_ > 0) ? ['category', $_] : ['id', abs($_)]; return ($_ > 0) ? ['category', $_] : ['id', abs($_)];
else else
{ {
$ids = array_filter($this->enums[$cr[0]], function($x) { return is_int($x) && $x > 0; }); $ids = array_filter($this->enums[$cr[0]], fn($x) => is_int($x) && $x > 0);
return ['category', $ids, $_ ? null : '!']; return ['category', $ids, $_ ? null : '!'];
} }

View File

@@ -58,17 +58,17 @@ class AreaTriggerList extends BaseType
class AreaTriggerListFilter extends Filter class AreaTriggerListFilter extends Filter
{ {
protected $genericFilter = array( protected $genericFilter = array(
2 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT] // id 2 => [parent::CR_NUMERIC, 'id', NUM_CAST_INT] // id
); );
// fieldId => [checkType, checkValue[, fieldIsArray]] // fieldId => [checkType, checkValue[, fieldIsArray]]
protected $inputFields = array( protected $inputFields = array(
'cr' => [FILTER_V_LIST, [2], true ], // criteria ids 'cr' => [parent::V_LIST, [2], true ], // criteria ids
'crs' => [FILTER_V_RANGE, [1, 6], true ], // criteria operators 'crs' => [parent::V_RANGE, [1, 6], true ], // criteria operators
'crv' => [FILTER_V_REGEX, parent::PATTERN_INT, true ], // criteria values - all criteria are numeric here 'crv' => [parent::V_REGEX, parent::PATTERN_INT, true ], // criteria values - all criteria are numeric here
'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter 'na' => [parent::V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter
'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'ma' => [parent::V_EQUAL, 1, false], // match any / all filter
'ty' => [FILTER_V_RANGE, [0, 5], true ] // types 'ty' => [parent::V_RANGE, [0, 5], true ] // types
); );
protected function createSQLForValues() protected function createSQLForValues()

View File

@@ -48,13 +48,13 @@ class ArenaTeamListFilter extends Filter
protected $genericFilter = []; protected $genericFilter = [];
protected $inputFields = array( protected $inputFields = array(
'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter 'na' => [parent::V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter
'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'ma' => [parent::V_EQUAL, 1, false], // match any / all filter
'ex' => [FILTER_V_EQUAL, 'on', false], // only match exact 'ex' => [parent::V_EQUAL, 'on', false], // only match exact
'si' => [FILTER_V_LIST, [1, 2], false], // side 'si' => [parent::V_LIST, [1, 2], false], // side
'sz' => [FILTER_V_LIST, [2, 3, 5], false], // tema size 'sz' => [parent::V_LIST, [2, 3, 5], false], // tema size
'rg' => [FILTER_V_CALLBACK, 'cbRegionCheck', false], // region 'rg' => [parent::V_CALLBACK, 'cbRegionCheck', false], // region
'sv' => [FILTER_V_CALLBACK, 'cbServerCheck', false], // server 'sv' => [parent::V_CALLBACK, 'cbServerCheck', false], // server
); );
protected function createSQLForValues() protected function createSQLForValues()
@@ -72,9 +72,9 @@ class ArenaTeamListFilter extends Filter
// side [list] // side [list]
if (!empty($_v['si'])) if (!empty($_v['si']))
{ {
if ($_v['si'] == 1) if ($_v['si'] == SIDE_ALLIANCE)
$parts[] = ['c.race', [1, 3, 4, 7, 11]]; $parts[] = ['c.race', [1, 3, 4, 7, 11]];
else if ($_v['si'] == 2) else if ($_v['si'] == SIDE_HORDE)
$parts[] = ['c.race', [2, 5, 6, 8, 10]]; $parts[] = ['c.race', [2, 5, 6, 8, 10]];
} }

View File

@@ -290,57 +290,57 @@ class CreatureListFilter extends Filter
); );
protected $genericFilter = array( protected $genericFilter = array(
1 => [FILTER_CR_CALLBACK, 'cbHealthMana', 'healthMax', 'healthMin'], // health [num] 1 => [parent::CR_CALLBACK, 'cbHealthMana', 'healthMax', 'healthMin'], // health [num]
2 => [FILTER_CR_CALLBACK, 'cbHealthMana', 'manaMin', 'manaMax' ], // mana [num] 2 => [parent::CR_CALLBACK, 'cbHealthMana', 'manaMin', 'manaMax' ], // mana [num]
3 => [FILTER_CR_CALLBACK, 'cbFaction', null, null ], // faction [enum] 3 => [parent::CR_CALLBACK, 'cbFaction', null, null ], // faction [enum]
5 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_REPAIRER ], // canrepair 5 => [parent::CR_FLAG, 'npcflag', NPC_FLAG_REPAIRER ], // canrepair
6 => [FILTER_CR_ENUM, 's.areaId', false, true ], // foundin 6 => [parent::CR_ENUM, 's.areaId', false, true ], // foundin
7 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 'startsQuests', 0x1 ], // startsquest [enum] 7 => [parent::CR_CALLBACK, 'cbQuestRelation', 'startsQuests', 0x1 ], // startsquest [enum]
8 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 'endsQuests', 0x2 ], // endsquest [enum] 8 => [parent::CR_CALLBACK, 'cbQuestRelation', 'endsQuests', 0x2 ], // endsquest [enum]
9 => [FILTER_CR_BOOLEAN, 'lootId', ], // lootable 9 => [parent::CR_BOOLEAN, 'lootId', ], // lootable
10 => [FILTER_CR_CALLBACK, 'cbRegularSkinLoot', NPC_TYPEFLAG_SPECIALLOOT ], // skinnable [yn] 10 => [parent::CR_CALLBACK, 'cbRegularSkinLoot', NPC_TYPEFLAG_SPECIALLOOT ], // skinnable [yn]
11 => [FILTER_CR_BOOLEAN, 'pickpocketLootId', ], // pickpocketable 11 => [parent::CR_BOOLEAN, 'pickpocketLootId', ], // pickpocketable
12 => [FILTER_CR_CALLBACK, 'cbMoneyDrop', null, null ], // averagemoneydropped [op] [int] 12 => [parent::CR_CALLBACK, 'cbMoneyDrop', null, null ], // averagemoneydropped [op] [int]
15 => [FILTER_CR_CALLBACK, 'cbSpecialSkinLoot', NPC_TYPEFLAG_HERBLOOT, null ], // gatherable [yn] 15 => [parent::CR_CALLBACK, 'cbSpecialSkinLoot', NPC_TYPEFLAG_HERBLOOT, null ], // gatherable [yn]
16 => [FILTER_CR_CALLBACK, 'cbSpecialSkinLoot', NPC_TYPEFLAG_MININGLOOT, null ], // minable [yn] 16 => [parent::CR_CALLBACK, 'cbSpecialSkinLoot', NPC_TYPEFLAG_MININGLOOT, null ], // minable [yn]
18 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_AUCTIONEER ], // auctioneer 18 => [parent::CR_FLAG, 'npcflag', NPC_FLAG_AUCTIONEER ], // auctioneer
19 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_BANKER ], // banker 19 => [parent::CR_FLAG, 'npcflag', NPC_FLAG_BANKER ], // banker
20 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_BATTLEMASTER ], // battlemaster 20 => [parent::CR_FLAG, 'npcflag', NPC_FLAG_BATTLEMASTER ], // battlemaster
21 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_FLIGHT_MASTER ], // flightmaster 21 => [parent::CR_FLAG, 'npcflag', NPC_FLAG_FLIGHT_MASTER ], // flightmaster
22 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_GUILD_MASTER ], // guildmaster 22 => [parent::CR_FLAG, 'npcflag', NPC_FLAG_GUILD_MASTER ], // guildmaster
23 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_INNKEEPER ], // innkeeper 23 => [parent::CR_FLAG, 'npcflag', NPC_FLAG_INNKEEPER ], // innkeeper
24 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_CLASS_TRAINER ], // talentunlearner 24 => [parent::CR_FLAG, 'npcflag', NPC_FLAG_CLASS_TRAINER ], // talentunlearner
25 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_GUILD_MASTER ], // tabardvendor 25 => [parent::CR_FLAG, 'npcflag', NPC_FLAG_GUILD_MASTER ], // tabardvendor
27 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_STABLE_MASTER ], // stablemaster 27 => [parent::CR_FLAG, 'npcflag', NPC_FLAG_STABLE_MASTER ], // stablemaster
28 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_TRAINER ], // trainer 28 => [parent::CR_FLAG, 'npcflag', NPC_FLAG_TRAINER ], // trainer
29 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_VENDOR ], // vendor 29 => [parent::CR_FLAG, 'npcflag', NPC_FLAG_VENDOR ], // vendor
31 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots 31 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
32 => [FILTER_CR_FLAG, 'cuFlags', NPC_CU_INSTANCE_BOSS ], // instanceboss 32 => [parent::CR_FLAG, 'cuFlags', NPC_CU_INSTANCE_BOSS ], // instanceboss
33 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 33 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
34 => [FILTER_CR_STRING, 'modelId', STR_MATCH_EXACT | STR_ALLOW_SHORT ], // usemodel [str] (wants int in string fmt <_<) 34 => [parent::CR_STRING, 'modelId', STR_MATCH_EXACT | STR_ALLOW_SHORT ], // usemodel [str] (wants int in string fmt <_<)
35 => [FILTER_CR_STRING, 'textureString' ], // useskin [str] 35 => [parent::CR_STRING, 'textureString' ], // useskin [str]
37 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true ], // id 37 => [parent::CR_NUMERIC, 'id', NUM_CAST_INT, true ], // id
38 => [FILTER_CR_CALLBACK, 'cbRelEvent', null, null ], // relatedevent [enum] 38 => [parent::CR_CALLBACK, 'cbRelEvent', null, null ], // relatedevent [enum]
40 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 40 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
41 => [FILTER_CR_NYI_PH, 1, null ], // haslocation [yn] [staff] 41 => [parent::CR_NYI_PH, 1, null ], // haslocation [yn] [staff]
42 => [FILTER_CR_CALLBACK, 'cbReputation', '>', null ], // increasesrepwith [enum] 42 => [parent::CR_CALLBACK, 'cbReputation', '>', null ], // increasesrepwith [enum]
43 => [FILTER_CR_CALLBACK, 'cbReputation', '<', null ], // decreasesrepwith [enum] 43 => [parent::CR_CALLBACK, 'cbReputation', '<', null ], // decreasesrepwith [enum]
44 => [FILTER_CR_CALLBACK, 'cbSpecialSkinLoot', NPC_TYPEFLAG_ENGINEERLOOT, null ] // salvageable [yn] 44 => [parent::CR_CALLBACK, 'cbSpecialSkinLoot', NPC_TYPEFLAG_ENGINEERLOOT, null ] // salvageable [yn]
); );
protected $inputFields = array( protected $inputFields = array(
'cr' => [FILTER_V_LIST, [[1, 3],[5, 12], 15, 16, [18, 25], [27, 29], [31, 35], 37, 38, [40, 44]], true ], // criteria ids 'cr' => [parent::V_LIST, [[1, 3],[5, 12], 15, 16, [18, 25], [27, 29], [31, 35], 37, 38, [40, 44]], true ], // criteria ids
'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 9999]], true ], // criteria operators 'crs' => [parent::V_LIST, [parent::ENUM_NONE, parent::ENUM_ANY, [0, 9999]], true ], // criteria operators
'crv' => [FILTER_V_REGEX, parent::PATTERN_CRV, true ], // criteria values - only printable chars, no delimiter 'crv' => [parent::V_REGEX, parent::PATTERN_CRV, true ], // criteria values - only printable chars, no delimiter
'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name / subname - only printable chars, no delimiter 'na' => [parent::V_REGEX, parent::PATTERN_NAME, false], // name / subname - only printable chars, no delimiter
'ex' => [FILTER_V_EQUAL, 'on', false], // also match subname 'ex' => [parent::V_EQUAL, 'on', false], // also match subname
'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'ma' => [parent::V_EQUAL, 1, false], // match any / all filter
'fa' => [FILTER_V_CALLBACK, 'cbPetFamily', true ], // pet family [list] - cat[0] == 1 'fa' => [parent::V_CALLBACK, 'cbPetFamily', true ], // pet family [list] - cat[0] == 1
'minle' => [FILTER_V_RANGE, [1, 99], false], // min level [int] 'minle' => [parent::V_RANGE, [1, 99], false], // min level [int]
'maxle' => [FILTER_V_RANGE, [1, 99], false], // max level [int] 'maxle' => [parent::V_RANGE, [1, 99], false], // max level [int]
'cl' => [FILTER_V_RANGE, [0, 4], true ], // classification [list] 'cl' => [parent::V_RANGE, [0, 4], true ], // classification [list]
'ra' => [FILTER_V_LIST, [-1, 0, 1], false], // react alliance [int] 'ra' => [parent::V_LIST, [-1, 0, 1], false], // react alliance [int]
'rh' => [FILTER_V_LIST, [-1, 0, 1], false] // react horde [int] 'rh' => [parent::V_LIST, [-1, 0, 1], false] // react horde [int]
); );
protected function createSQLForValues() protected function createSQLForValues()
@@ -396,7 +396,7 @@ class CreatureListFilter extends Filter
if (!Util::checkNumeric($val, NUM_CAST_INT)) if (!Util::checkNumeric($val, NUM_CAST_INT))
return false; return false;
$type = FILTER_V_LIST; $type = parent::V_LIST;
$valid = [[1, 9], 11, 12, 20, 21, [24, 27], [30, 35], [37, 39], [41, 46]]; $valid = [[1, 9], 11, 12, 20, 21, [24, 27], [30, 35], [37, 39], [41, 46]];
return $this->checkInput($type, $valid, $val); return $this->checkInput($type, $valid, $val);
@@ -404,22 +404,26 @@ class CreatureListFilter extends Filter
protected function cbRelEvent($cr) protected function cbRelEvent($cr)
{ {
if ($cr[1] == FILTER_ENUM_ANY) if ($cr[1] == parent::ENUM_ANY)
{ {
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0'); if ($eventIds = DB::Aowow()->selectCol('SELECT `id` FROM ?_events WHERE `holidayId` <> 0'))
$cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds); if ($cGuids = DB::World()->selectCol('SELECT DISTINCT `guid` FROM game_event_creature WHERE `eventEntry` IN (?a)', $eventIds))
return ['s.guid', $cGuids]; return ['s.guid', $cGuids];
return [0];
} }
else if ($cr[1] == FILTER_ENUM_NONE) else if ($cr[1] == parent::ENUM_NONE)
{ {
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0'); if ($eventIds = DB::Aowow()->selectCol('SELECT `id` FROM ?_events WHERE `holidayId` <> 0'))
$cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds); if ($cGuids = DB::World()->selectCol('SELECT DISTINCT `guid` FROM game_event_creature WHERE `eventEntry` IN (?a)', $eventIds))
return ['s.guid', $cGuids, '!']; return ['s.guid', $cGuids, '!'];
return [0];
} }
else if (in_array($cr[1], $this->enums[$cr[0]])) else if (in_array($cr[1], $this->enums[$cr[0]]))
{ {
if ($eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId = ?d', $cr[1])) if ($eventIds = DB::Aowow()->selectCol('SELECT `id` FROM ?_events WHERE `holidayId` = ?d', $cr[1]))
if ($cGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_creature WHERE eventEntry IN (?a)', $eventIds)) if ($cGuids = DB::World()->selectCol('SELECT DISTINCT `guid` FROM `game_event_creature` WHERE `eventEntry` IN (?a)', $eventIds))
return ['s.guid', $cGuids]; return ['s.guid', $cGuids];
return [0]; return [0];
@@ -507,7 +511,7 @@ class CreatureListFilter extends Filter
if (!in_array($cr[1], $this->enums[$cr[0]])) if (!in_array($cr[1], $this->enums[$cr[0]]))
return false; return false;
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1])) if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE `id` = ?d', $cr[1]))
$this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')]; $this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')];
if ($cIds = DB::World()->selectCol('SELECT creature_id FROM creature_onkill_reputation WHERE (RewOnKillRepFaction1 = ?d AND RewOnKillRepValue1 '.$op.' 0) OR (RewOnKillRepFaction2 = ?d AND RewOnKillRepValue2 '.$op.' 0)', $cr[1], $cr[1])) if ($cIds = DB::World()->selectCol('SELECT creature_id FROM creature_onkill_reputation WHERE (RewOnKillRepFaction1 = ?d AND RewOnKillRepValue1 '.$op.' 0) OR (RewOnKillRepFaction2 = ?d AND RewOnKillRepValue2 '.$op.' 0)', $cr[1], $cr[1]))

View File

@@ -166,74 +166,74 @@ class EnchantmentListFilter extends Filter
); );
protected $genericFilter = array( protected $genericFilter = array(
2 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true], // id 2 => [parent::CR_NUMERIC, 'id', NUM_CAST_INT, true], // id
3 => [FILTER_CR_ENUM, 'skillLine' ], // requiresprof 3 => [parent::CR_ENUM, 'skillLine' ], // requiresprof
4 => [FILTER_CR_NUMERIC, 'skillLevel', NUM_CAST_INT ], // reqskillrank 4 => [parent::CR_NUMERIC, 'skillLevel', NUM_CAST_INT ], // reqskillrank
5 => [FILTER_CR_BOOLEAN, 'conditionId' ], // hascondition 5 => [parent::CR_BOOLEAN, 'conditionId' ], // hascondition
10 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 10 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
11 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots 11 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
12 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 12 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
20 => [FILTER_CR_NUMERIC, 'is.str', NUM_CAST_INT, true], // str 20 => [parent::CR_NUMERIC, 'is.str', NUM_CAST_INT, true], // str
21 => [FILTER_CR_NUMERIC, 'is.agi', NUM_CAST_INT, true], // agi 21 => [parent::CR_NUMERIC, 'is.agi', NUM_CAST_INT, true], // agi
22 => [FILTER_CR_NUMERIC, 'is.sta', NUM_CAST_INT, true], // sta 22 => [parent::CR_NUMERIC, 'is.sta', NUM_CAST_INT, true], // sta
23 => [FILTER_CR_NUMERIC, 'is.int', NUM_CAST_INT, true], // int 23 => [parent::CR_NUMERIC, 'is.int', NUM_CAST_INT, true], // int
24 => [FILTER_CR_NUMERIC, 'is.spi', NUM_CAST_INT, true], // spi 24 => [parent::CR_NUMERIC, 'is.spi', NUM_CAST_INT, true], // spi
25 => [FILTER_CR_NUMERIC, 'is.arcres', NUM_CAST_INT, true], // arcres 25 => [parent::CR_NUMERIC, 'is.arcres', NUM_CAST_INT, true], // arcres
26 => [FILTER_CR_NUMERIC, 'is.firres', NUM_CAST_INT, true], // firres 26 => [parent::CR_NUMERIC, 'is.firres', NUM_CAST_INT, true], // firres
27 => [FILTER_CR_NUMERIC, 'is.natres', NUM_CAST_INT, true], // natres 27 => [parent::CR_NUMERIC, 'is.natres', NUM_CAST_INT, true], // natres
28 => [FILTER_CR_NUMERIC, 'is.frores', NUM_CAST_INT, true], // frores 28 => [parent::CR_NUMERIC, 'is.frores', NUM_CAST_INT, true], // frores
29 => [FILTER_CR_NUMERIC, 'is.shares', NUM_CAST_INT, true], // shares 29 => [parent::CR_NUMERIC, 'is.shares', NUM_CAST_INT, true], // shares
30 => [FILTER_CR_NUMERIC, 'is.holres', NUM_CAST_INT, true], // holres 30 => [parent::CR_NUMERIC, 'is.holres', NUM_CAST_INT, true], // holres
32 => [FILTER_CR_NUMERIC, 'is.dps', NUM_CAST_FLOAT, true], // dps 32 => [parent::CR_NUMERIC, 'is.dps', NUM_CAST_FLOAT, true], // dps
34 => [FILTER_CR_NUMERIC, 'is.dmg', NUM_CAST_FLOAT, true], // dmg 34 => [parent::CR_NUMERIC, 'is.dmg', NUM_CAST_FLOAT, true], // dmg
37 => [FILTER_CR_NUMERIC, 'is.mleatkpwr', NUM_CAST_INT, true], // mleatkpwr 37 => [parent::CR_NUMERIC, 'is.mleatkpwr', NUM_CAST_INT, true], // mleatkpwr
38 => [FILTER_CR_NUMERIC, 'is.rgdatkpwr', NUM_CAST_INT, true], // rgdatkpwr 38 => [parent::CR_NUMERIC, 'is.rgdatkpwr', NUM_CAST_INT, true], // rgdatkpwr
39 => [FILTER_CR_NUMERIC, 'is.rgdhitrtng', NUM_CAST_INT, true], // rgdhitrtng 39 => [parent::CR_NUMERIC, 'is.rgdhitrtng', NUM_CAST_INT, true], // rgdhitrtng
40 => [FILTER_CR_NUMERIC, 'is.rgdcritstrkrtng', NUM_CAST_INT, true], // rgdcritstrkrtng 40 => [parent::CR_NUMERIC, 'is.rgdcritstrkrtng', NUM_CAST_INT, true], // rgdcritstrkrtng
41 => [FILTER_CR_NUMERIC, 'is.armor', NUM_CAST_INT, true], // armor 41 => [parent::CR_NUMERIC, 'is.armor', NUM_CAST_INT, true], // armor
42 => [FILTER_CR_NUMERIC, 'is.defrtng', NUM_CAST_INT, true], // defrtng 42 => [parent::CR_NUMERIC, 'is.defrtng', NUM_CAST_INT, true], // defrtng
43 => [FILTER_CR_NUMERIC, 'is.block', NUM_CAST_INT, true], // block 43 => [parent::CR_NUMERIC, 'is.block', NUM_CAST_INT, true], // block
44 => [FILTER_CR_NUMERIC, 'is.blockrtng', NUM_CAST_INT, true], // blockrtng 44 => [parent::CR_NUMERIC, 'is.blockrtng', NUM_CAST_INT, true], // blockrtng
45 => [FILTER_CR_NUMERIC, 'is.dodgertng', NUM_CAST_INT, true], // dodgertng 45 => [parent::CR_NUMERIC, 'is.dodgertng', NUM_CAST_INT, true], // dodgertng
46 => [FILTER_CR_NUMERIC, 'is.parryrtng', NUM_CAST_INT, true], // parryrtng 46 => [parent::CR_NUMERIC, 'is.parryrtng', NUM_CAST_INT, true], // parryrtng
48 => [FILTER_CR_NUMERIC, 'is.splhitrtng', NUM_CAST_INT, true], // splhitrtng 48 => [parent::CR_NUMERIC, 'is.splhitrtng', NUM_CAST_INT, true], // splhitrtng
49 => [FILTER_CR_NUMERIC, 'is.splcritstrkrtng', NUM_CAST_INT, true], // splcritstrkrtng 49 => [parent::CR_NUMERIC, 'is.splcritstrkrtng', NUM_CAST_INT, true], // splcritstrkrtng
50 => [FILTER_CR_NUMERIC, 'is.splheal', NUM_CAST_INT, true], // splheal 50 => [parent::CR_NUMERIC, 'is.splheal', NUM_CAST_INT, true], // splheal
51 => [FILTER_CR_NUMERIC, 'is.spldmg', NUM_CAST_INT, true], // spldmg 51 => [parent::CR_NUMERIC, 'is.spldmg', NUM_CAST_INT, true], // spldmg
52 => [FILTER_CR_NUMERIC, 'is.arcsplpwr', NUM_CAST_INT, true], // arcsplpwr 52 => [parent::CR_NUMERIC, 'is.arcsplpwr', NUM_CAST_INT, true], // arcsplpwr
53 => [FILTER_CR_NUMERIC, 'is.firsplpwr', NUM_CAST_INT, true], // firsplpwr 53 => [parent::CR_NUMERIC, 'is.firsplpwr', NUM_CAST_INT, true], // firsplpwr
54 => [FILTER_CR_NUMERIC, 'is.frosplpwr', NUM_CAST_INT, true], // frosplpwr 54 => [parent::CR_NUMERIC, 'is.frosplpwr', NUM_CAST_INT, true], // frosplpwr
55 => [FILTER_CR_NUMERIC, 'is.holsplpwr', NUM_CAST_INT, true], // holsplpwr 55 => [parent::CR_NUMERIC, 'is.holsplpwr', NUM_CAST_INT, true], // holsplpwr
56 => [FILTER_CR_NUMERIC, 'is.natsplpwr', NUM_CAST_INT, true], // natsplpwr 56 => [parent::CR_NUMERIC, 'is.natsplpwr', NUM_CAST_INT, true], // natsplpwr
57 => [FILTER_CR_NUMERIC, 'is.shasplpwr', NUM_CAST_INT, true], // shasplpwr 57 => [parent::CR_NUMERIC, 'is.shasplpwr', NUM_CAST_INT, true], // shasplpwr
60 => [FILTER_CR_NUMERIC, 'is.healthrgn', NUM_CAST_INT, true], // healthrgn 60 => [parent::CR_NUMERIC, 'is.healthrgn', NUM_CAST_INT, true], // healthrgn
61 => [FILTER_CR_NUMERIC, 'is.manargn', NUM_CAST_INT, true], // manargn 61 => [parent::CR_NUMERIC, 'is.manargn', NUM_CAST_INT, true], // manargn
77 => [FILTER_CR_NUMERIC, 'is.atkpwr', NUM_CAST_INT, true], // atkpwr 77 => [parent::CR_NUMERIC, 'is.atkpwr', NUM_CAST_INT, true], // atkpwr
78 => [FILTER_CR_NUMERIC, 'is.mlehastertng', NUM_CAST_INT, true], // mlehastertng 78 => [parent::CR_NUMERIC, 'is.mlehastertng', NUM_CAST_INT, true], // mlehastertng
79 => [FILTER_CR_NUMERIC, 'is.resirtng', NUM_CAST_INT, true], // resirtng 79 => [parent::CR_NUMERIC, 'is.resirtng', NUM_CAST_INT, true], // resirtng
84 => [FILTER_CR_NUMERIC, 'is.mlecritstrkrtng', NUM_CAST_INT, true], // mlecritstrkrtng 84 => [parent::CR_NUMERIC, 'is.mlecritstrkrtng', NUM_CAST_INT, true], // mlecritstrkrtng
94 => [FILTER_CR_NUMERIC, 'is.splpen', NUM_CAST_INT, true], // splpen 94 => [parent::CR_NUMERIC, 'is.splpen', NUM_CAST_INT, true], // splpen
95 => [FILTER_CR_NUMERIC, 'is.mlehitrtng', NUM_CAST_INT, true], // mlehitrtng 95 => [parent::CR_NUMERIC, 'is.mlehitrtng', NUM_CAST_INT, true], // mlehitrtng
96 => [FILTER_CR_NUMERIC, 'is.critstrkrtng', NUM_CAST_INT, true], // critstrkrtng 96 => [parent::CR_NUMERIC, 'is.critstrkrtng', NUM_CAST_INT, true], // critstrkrtng
97 => [FILTER_CR_NUMERIC, 'is.feratkpwr', NUM_CAST_INT, true], // feratkpwr 97 => [parent::CR_NUMERIC, 'is.feratkpwr', NUM_CAST_INT, true], // feratkpwr
101 => [FILTER_CR_NUMERIC, 'is.rgdhastertng', NUM_CAST_INT, true], // rgdhastertng 101 => [parent::CR_NUMERIC, 'is.rgdhastertng', NUM_CAST_INT, true], // rgdhastertng
102 => [FILTER_CR_NUMERIC, 'is.splhastertng', NUM_CAST_INT, true], // splhastertng 102 => [parent::CR_NUMERIC, 'is.splhastertng', NUM_CAST_INT, true], // splhastertng
103 => [FILTER_CR_NUMERIC, 'is.hastertng', NUM_CAST_INT, true], // hastertng 103 => [parent::CR_NUMERIC, 'is.hastertng', NUM_CAST_INT, true], // hastertng
114 => [FILTER_CR_NUMERIC, 'is.armorpenrtng', NUM_CAST_INT, true], // armorpenrtng 114 => [parent::CR_NUMERIC, 'is.armorpenrtng', NUM_CAST_INT, true], // armorpenrtng
115 => [FILTER_CR_NUMERIC, 'is.health', NUM_CAST_INT, true], // health 115 => [parent::CR_NUMERIC, 'is.health', NUM_CAST_INT, true], // health
116 => [FILTER_CR_NUMERIC, 'is.mana', NUM_CAST_INT, true], // mana 116 => [parent::CR_NUMERIC, 'is.mana', NUM_CAST_INT, true], // mana
117 => [FILTER_CR_NUMERIC, 'is.exprtng', NUM_CAST_INT, true], // exprtng 117 => [parent::CR_NUMERIC, 'is.exprtng', NUM_CAST_INT, true], // exprtng
119 => [FILTER_CR_NUMERIC, 'is.hitrtng', NUM_CAST_INT, true], // hitrtng 119 => [parent::CR_NUMERIC, 'is.hitrtng', NUM_CAST_INT, true], // hitrtng
123 => [FILTER_CR_NUMERIC, 'is.splpwr', NUM_CAST_INT, true] // splpwr 123 => [parent::CR_NUMERIC, 'is.splpwr', NUM_CAST_INT, true] // splpwr
); );
protected $inputFields = array( protected $inputFields = array(
'cr' => [FILTER_V_RANGE, [2, 123], true ], // criteria ids 'cr' => [parent::V_RANGE, [2, 123], true ], // criteria ids
'crs' => [FILTER_V_RANGE, [1, 15], true ], // criteria operators 'crs' => [parent::V_RANGE, [1, 15], true ], // criteria operators
'crv' => [FILTER_V_REGEX, parent::PATTERN_INT, true ], // criteria values - only numerals 'crv' => [parent::V_REGEX, parent::PATTERN_INT, true ], // criteria values - only numerals
'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter 'na' => [parent::V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter
'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'ma' => [parent::V_EQUAL, 1, false], // match any / all filter
'ty' => [FILTER_V_RANGE, [1, 8], true ] // types 'ty' => [parent::V_RANGE, [1, 8], true ] // types
); );
protected function createSQLForValues() protected function createSQLForValues()

View File

@@ -151,26 +151,26 @@ class GameObjectListFilter extends Filter
); );
protected $genericFilter = array( protected $genericFilter = array(
1 => [FILTER_CR_ENUM, 's.areaId', false, true], // foundin 1 => [parent::CR_ENUM, 's.areaId', false, true], // foundin
2 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 'startsQuests', 0x1 ], // startsquest [side] 2 => [parent::CR_CALLBACK, 'cbQuestRelation', 'startsQuests', 0x1 ], // startsquest [side]
3 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 'endsQuests', 0x2 ], // endsquest [side] 3 => [parent::CR_CALLBACK, 'cbQuestRelation', 'endsQuests', 0x2 ], // endsquest [side]
4 => [FILTER_CR_CALLBACK, 'cbOpenable', null, null], // openable [yn] 4 => [parent::CR_CALLBACK, 'cbOpenable', null, null], // openable [yn]
5 => [FILTER_CR_NYI_PH, null, 0 ], // averagemoneycontained [op] [int] - GOs don't contain money, match against 0 5 => [parent::CR_NYI_PH, null, 0 ], // averagemoneycontained [op] [int] - GOs don't contain money, match against 0
7 => [FILTER_CR_NUMERIC, 'reqSkill', NUM_CAST_INT ], // requiredskilllevel 7 => [parent::CR_NUMERIC, 'reqSkill', NUM_CAST_INT ], // requiredskilllevel
11 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots 11 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
13 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 13 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
15 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT ], // id 15 => [parent::CR_NUMERIC, 'id', NUM_CAST_INT ], // id
16 => [FILTER_CR_CALLBACK, 'cbRelEvent', null, null], // relatedevent (ignore removed by event) 16 => [parent::CR_CALLBACK, 'cbRelEvent', null, null], // relatedevent (ignore removed by event)
18 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 18 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
50 => [FILTER_CR_ENUM, 'spellFocusId', true, true], // spellfocus 50 => [parent::CR_ENUM, 'spellFocusId', true, true], // spellfocus
); );
protected $inputFields = array( protected $inputFields = array(
'cr' => [FILTER_V_LIST, [[1, 5], 7, 11, 13, 15, 16, 18, 50], true ], // criteria ids 'cr' => [parent::V_LIST, [[1, 5], 7, 11, 13, 15, 16, 18, 50], true ], // criteria ids
'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 5000]], true ], // criteria operators 'crs' => [parent::V_LIST, [parent::ENUM_NONE, parent::ENUM_ANY, [0, 5000]], true ], // criteria operators
'crv' => [FILTER_V_REGEX, parent::PATTERN_INT, true ], // criteria values - only numeric input values expected 'crv' => [parent::V_REGEX, parent::PATTERN_INT, true ], // criteria values - only numeric input values expected
'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter 'na' => [parent::V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter
'ma' => [FILTER_V_EQUAL, 1, false] // match any / all filter 'ma' => [parent::V_EQUAL, 1, false] // match any / all filter
); );
protected function createSQLForValues() protected function createSQLForValues()
@@ -216,22 +216,26 @@ class GameObjectListFilter extends Filter
protected function cbRelEvent($cr) protected function cbRelEvent($cr)
{ {
if ($cr[1] == FILTER_ENUM_ANY) if ($cr[1] == parent::ENUM_ANY)
{ {
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0'); if ($eventIds = DB::Aowow()->selectCol('SELECT `id` FROM ?_events WHERE `holidayId` <> 0'))
$goGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_gameobject WHERE eventEntry IN (?a)', $eventIds); if ($goGuids = DB::World()->selectCol('SELECT DISTINCT `guid` FROM game_event_gameobject WHERE `eventEntry` IN (?a)', $eventIds))
return ['s.guid', $goGuids]; return ['s.guid', $goGuids];
return [0];
} }
else if ($cr[1] == FILTER_ENUM_NONE) else if ($cr[1] == parent::ENUM_NONE)
{ {
$eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId <> 0'); if ($eventIds = DB::Aowow()->selectCol('SELECT `id` FROM ?_events WHERE `holidayId` <> 0'))
$goGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_gameobject WHERE eventEntry IN (?a)', $eventIds); if ($goGuids = DB::World()->selectCol('SELECT DISTINCT `guid` FROM game_event_gameobject WHERE `eventEntry` IN (?a)', $eventIds))
return ['s.guid', $goGuids, '!']; return ['s.guid', $goGuids, '!'];
return [0];
} }
else if (in_array($cr[1], $this->enums[$cr[0]])) else if (in_array($cr[1], $this->enums[$cr[0]]))
{ {
if ($eventIds = DB::Aowow()->selectCol('SELECT id FROM ?_events WHERE holidayId = ?d', $cr[1])) if ($eventIds = DB::Aowow()->selectCol('SELECT `id` FROM ?_events WHERE `holidayId` = ?d', $cr[1]))
if ($goGuids = DB::World()->selectCol('SELECT DISTINCT guid FROM game_event_gameobject WHERE eventEntry IN (?a)', $eventIds)) if ($goGuids = DB::World()->selectCol('SELECT DISTINCT `guid` FROM game_event_gameobject WHERE `eventEntry` IN (?a)', $eventIds))
return ['s.guid', $goGuids]; return ['s.guid', $goGuids];
return [0]; return [0];

View File

@@ -46,7 +46,7 @@ class GuildList extends BaseType
if (!$guilds) if (!$guilds)
return; return;
$stats = DB::Aowow()->select('SELECT guild AS ARRAY_KEY, id AS ARRAY_KEY2, level, gearscore, achievementpoints, IF(cuFlags & ?d, 0, 1) AS synced FROM ?_profiler_profiles WHERE guild IN (?a) ORDER BY gearscore DESC', PROFILER_CU_NEEDS_RESYNC, $guilds); $stats = DB::Aowow()->select('SELECT `guild` AS ARRAY_KEY, `id` AS ARRAY_KEY2, `level`, `gearscore`, `achievementpoints`, IF(`cuFlags` & ?d, 0, 1) AS "synced" FROM ?_profiler_profiles WHERE `guild` IN (?a) ORDER BY `gearscore` DESC', PROFILER_CU_NEEDS_RESYNC, $guilds);
foreach ($this->iterate() as &$_curTpl) foreach ($this->iterate() as &$_curTpl)
{ {
$id = $_curTpl['id']; $id = $_curTpl['id'];
@@ -91,12 +91,12 @@ class GuildListFilter extends Filter
protected $genericFilter = []; protected $genericFilter = [];
protected $inputFields = array( protected $inputFields = array(
'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter 'na' => [parent::V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter
'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'ma' => [parent::V_EQUAL, 1, false], // match any / all filter
'ex' => [FILTER_V_EQUAL, 'on', false], // only match exact 'ex' => [parent::V_EQUAL, 'on', false], // only match exact
'si' => [FILTER_V_LIST, [1, 2], false], // side 'si' => [parent::V_LIST, [SIDE_ALLIANCE, SIDE_HORDE], false], // side
'rg' => [FILTER_V_CALLBACK, 'cbRegionCheck', false], // region 'rg' => [parent::V_CALLBACK, 'cbRegionCheck', false], // region
'sv' => [FILTER_V_CALLBACK, 'cbServerCheck', false], // server 'sv' => [parent::V_CALLBACK, 'cbServerCheck', false], // server
); );
protected function createSQLForValues() protected function createSQLForValues()
@@ -114,9 +114,9 @@ class GuildListFilter extends Filter
// side [list] // side [list]
if (!empty($_v['si'])) if (!empty($_v['si']))
{ {
if ($_v['si'] == 1) if ($_v['si'] == SIDE_ALLIANCE)
$parts[] = ['c.race', [1, 3, 4, 7, 11]]; $parts[] = ['c.race', [1, 3, 4, 7, 11]];
else if ($_v['si'] == 2) else if ($_v['si'] == SIDE_HORDE)
$parts[] = ['c.race', [2, 5, 6, 8, 10]]; $parts[] = ['c.race', [2, 5, 6, 8, 10]];
} }

View File

@@ -13,7 +13,7 @@ class IconList extends BaseType
public static $dataTable = '?_icons'; public static $dataTable = '?_icons';
public static $contribute = CONTRIBUTE_CO; public static $contribute = CONTRIBUTE_CO;
private $pseudoQry = 'SELECT iconId AS ARRAY_KEY, COUNT(*) FROM ?# WHERE iconId IN (?a) GROUP BY iconId'; private $pseudoQry = 'SELECT `iconId` AS ARRAY_KEY, COUNT(*) FROM ?# WHERE `iconId` IN (?a) GROUP BY `iconId`';
private $pseudoJoin = array( private $pseudoJoin = array(
'nItems' => '?_items', 'nItems' => '?_items',
'nSpells' => '?_spell', 'nSpells' => '?_spell',
@@ -53,7 +53,7 @@ class IconList extends BaseType
// use if you JUST need the name // use if you JUST need the name
public static function getName($id) public static function getName($id)
{ {
$n = DB::Aowow()->SelectRow('SELECT name FROM ?_icons WHERE id = ?d', $id ); $n = DB::Aowow()->SelectRow('SELECT `name` FROM ?_icons WHERE `id` = ?d', $id );
return Util::localizedString($n, 'name'); return Util::localizedString($n, 'name');
} }
// end static use // end static use
@@ -120,21 +120,21 @@ class IconListFilter extends Filter
private $totalUses = []; private $totalUses = [];
protected $genericFilter = array( protected $genericFilter = array(
1 => [FILTER_CR_CALLBACK, 'cbUseAny' ], // items [num] 1 => [parent::CR_CALLBACK, 'cbUseAny' ], // items [num]
2 => [FILTER_CR_CALLBACK, 'cbUseAny' ], // spells [num] 2 => [parent::CR_CALLBACK, 'cbUseAny' ], // spells [num]
3 => [FILTER_CR_CALLBACK, 'cbUseAny' ], // achievements [num] 3 => [parent::CR_CALLBACK, 'cbUseAny' ], // achievements [num]
6 => [FILTER_CR_CALLBACK, 'cbUseAny' ], // currencies [num] 6 => [parent::CR_CALLBACK, 'cbUseAny' ], // currencies [num]
9 => [FILTER_CR_CALLBACK, 'cbUseAny' ], // hunterpets [num] 9 => [parent::CR_CALLBACK, 'cbUseAny' ], // hunterpets [num]
11 => [FILTER_CR_NYI_PH, null, 0], // classes [num] 11 => [parent::CR_NYI_PH, null, 0], // classes [num]
13 => [FILTER_CR_CALLBACK, 'cbUseAll' ] // used [num] 13 => [parent::CR_CALLBACK, 'cbUseAll' ] // used [num]
); );
protected $inputFields = array( protected $inputFields = array(
'cr' => [FILTER_V_LIST, [1, 2, 3, 6, 9, 11, 13], true ], // criteria ids 'cr' => [parent::V_LIST, [1, 2, 3, 6, 9, 11, 13], true ], // criteria ids
'crs' => [FILTER_V_RANGE, [1, 6], true ], // criteria operators 'crs' => [parent::V_RANGE, [1, 6], true ], // criteria operators
'crv' => [FILTER_V_REGEX, parent::PATTERN_INT, true ], // criteria values - all criteria are numeric here 'crv' => [parent::V_REGEX, parent::PATTERN_INT, true ], // criteria values - all criteria are numeric here
'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter 'na' => [parent::V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter
'ma' => [FILTER_V_EQUAL, 1, false] // match any / all filter 'ma' => [parent::V_EQUAL, 1, false] // match any / all filter
); );
private function _getCnd($op, $val, $tbl) private function _getCnd($op, $val, $tbl)
@@ -144,7 +144,7 @@ class IconListFilter extends Filter
case '>': case '>':
case '>=': case '>=':
case '=': case '=':
$ids = DB::Aowow()->selectCol('SELECT iconId AS ARRAY_KEY, COUNT(*) AS n FROM ?# GROUP BY iconId HAVING n '.$op.' '.$val, $tbl); $ids = DB::Aowow()->selectCol('SELECT `iconId` AS ARRAY_KEY, COUNT(*) AS "n" FROM ?# GROUP BY `iconId` HAVING n '.$op.' '.$val, $tbl);
return $ids ? ['id', array_keys($ids)] : [1]; return $ids ? ['id', array_keys($ids)] : [1];
case '<=': case '<=':
if ($val) if ($val)
@@ -160,7 +160,7 @@ class IconListFilter extends Filter
break; break;
} }
$ids = DB::Aowow()->selectCol('SELECT iconId AS ARRAY_KEY, COUNT(*) AS n FROM ?# GROUP BY iconId HAVING n '.$op.' '.$val, $tbl); $ids = DB::Aowow()->selectCol('SELECT `iconId` AS ARRAY_KEY, COUNT(*) AS "n" FROM ?# GROUP BY `iconId` HAVING n '.$op.' '.$val, $tbl);
return $ids ? ['id', array_keys($ids), '!'] : [1]; return $ids ? ['id', array_keys($ids), '!'] : [1];
} }
@@ -197,7 +197,7 @@ class IconListFilter extends Filter
if (!$tbl) if (!$tbl)
continue; continue;
$res = DB::Aowow()->selectCol('SELECT iconId AS ARRAY_KEY, COUNT(*) AS n FROM ?# GROUP BY iconId', $tbl); $res = DB::Aowow()->selectCol('SELECT `iconId` AS ARRAY_KEY, COUNT(*) AS "n" FROM ?# GROUP BY `iconId`', $tbl);
Util::arraySumByKey($this->totalUses, $res); Util::arraySumByKey($this->totalUses, $res);
} }
} }
@@ -212,7 +212,7 @@ class IconListFilter extends Filter
$op = '>='; $op = '>=';
else if ($cr[1] == '!=' && $cr[2]) else if ($cr[1] == '!=' && $cr[2])
$op = '=='; $op = '==';
$ids = array_filter($this->totalUses, function ($x) use ($op, $cr) { return eval('return '.$x.' '.$op.' '.$cr[2].';'); }); $ids = array_filter($this->totalUses, fn($x) => eval('return '.$x.' '.$op.' '.$cr[2].';'));
if ($cr[1] != $op) if ($cr[1] != $op)
return $ids ? ['id', array_keys($ids), '!'] : [1]; return $ids ? ['id', array_keys($ids), '!'] : [1];

View File

@@ -1836,185 +1836,185 @@ class ItemListFilter extends Filter
); );
protected $genericFilter = array( protected $genericFilter = array(
2 => [FILTER_CR_CALLBACK, 'cbFieldHasVal', 'bonding', 1 ], // bindonpickup [yn] 2 => [parent::CR_CALLBACK, 'cbFieldHasVal', 'bonding', 1 ], // bindonpickup [yn]
3 => [FILTER_CR_CALLBACK, 'cbFieldHasVal', 'bonding', 2 ], // bindonequip [yn] 3 => [parent::CR_CALLBACK, 'cbFieldHasVal', 'bonding', 2 ], // bindonequip [yn]
4 => [FILTER_CR_CALLBACK, 'cbFieldHasVal', 'bonding', 3 ], // bindonuse [yn] 4 => [parent::CR_CALLBACK, 'cbFieldHasVal', 'bonding', 3 ], // bindonuse [yn]
5 => [FILTER_CR_CALLBACK, 'cbFieldHasVal', 'bonding', [4, 5] ], // questitem [yn] 5 => [parent::CR_CALLBACK, 'cbFieldHasVal', 'bonding', [4, 5] ], // questitem [yn]
6 => [FILTER_CR_CALLBACK, 'cbQuestRelation', null, null ], // startsquest [side] 6 => [parent::CR_CALLBACK, 'cbQuestRelation', null, null ], // startsquest [side]
7 => [FILTER_CR_BOOLEAN, 'description_loc0', true ], // hasflavortext 7 => [parent::CR_BOOLEAN, 'description_loc0', true ], // hasflavortext
8 => [FILTER_CR_BOOLEAN, 'requiredDisenchantSkill' ], // disenchantable 8 => [parent::CR_BOOLEAN, 'requiredDisenchantSkill' ], // disenchantable
9 => [FILTER_CR_FLAG, 'flags', ITEM_FLAG_CONJURED ], // conjureditem 9 => [parent::CR_FLAG, 'flags', ITEM_FLAG_CONJURED ], // conjureditem
10 => [FILTER_CR_BOOLEAN, 'lockId' ], // locked 10 => [parent::CR_BOOLEAN, 'lockId' ], // locked
11 => [FILTER_CR_FLAG, 'flags', ITEM_FLAG_OPENABLE ], // openable 11 => [parent::CR_FLAG, 'flags', ITEM_FLAG_OPENABLE ], // openable
12 => [FILTER_CR_BOOLEAN, 'itemset' ], // partofset 12 => [parent::CR_BOOLEAN, 'itemset' ], // partofset
13 => [FILTER_CR_BOOLEAN, 'randomEnchant' ], // randomlyenchanted 13 => [parent::CR_BOOLEAN, 'randomEnchant' ], // randomlyenchanted
14 => [FILTER_CR_BOOLEAN, 'pageTextId' ], // readable 14 => [parent::CR_BOOLEAN, 'pageTextId' ], // readable
15 => [FILTER_CR_CALLBACK, 'cbFieldHasVal', 'maxCount', 1 ], // unique [yn] 15 => [parent::CR_CALLBACK, 'cbFieldHasVal', 'maxCount', 1 ], // unique [yn]
16 => [FILTER_CR_CALLBACK, 'cbDropsInZone', null, null ], // dropsin [zone] 16 => [parent::CR_CALLBACK, 'cbDropsInZone', null, null ], // dropsin [zone]
17 => [FILTER_CR_ENUM, 'requiredFaction', true, true ], // requiresrepwith 17 => [parent::CR_ENUM, 'requiredFaction', true, true ], // requiresrepwith
18 => [FILTER_CR_CALLBACK, 'cbFactionQuestReward', null, null ], // rewardedbyfactionquest [side] 18 => [parent::CR_CALLBACK, 'cbFactionQuestReward', null, null ], // rewardedbyfactionquest [side]
20 => [FILTER_CR_NUMERIC, 'is.str', NUM_CAST_INT, true ], // str 20 => [parent::CR_NUMERIC, 'is.str', NUM_CAST_INT, true ], // str
21 => [FILTER_CR_NUMERIC, 'is.agi', NUM_CAST_INT, true ], // agi 21 => [parent::CR_NUMERIC, 'is.agi', NUM_CAST_INT, true ], // agi
22 => [FILTER_CR_NUMERIC, 'is.sta', NUM_CAST_INT, true ], // sta 22 => [parent::CR_NUMERIC, 'is.sta', NUM_CAST_INT, true ], // sta
23 => [FILTER_CR_NUMERIC, 'is.int', NUM_CAST_INT, true ], // int 23 => [parent::CR_NUMERIC, 'is.int', NUM_CAST_INT, true ], // int
24 => [FILTER_CR_NUMERIC, 'is.spi', NUM_CAST_INT, true ], // spi 24 => [parent::CR_NUMERIC, 'is.spi', NUM_CAST_INT, true ], // spi
25 => [FILTER_CR_NUMERIC, 'is.arcres', NUM_CAST_INT, true ], // arcres 25 => [parent::CR_NUMERIC, 'is.arcres', NUM_CAST_INT, true ], // arcres
26 => [FILTER_CR_NUMERIC, 'is.firres', NUM_CAST_INT, true ], // firres 26 => [parent::CR_NUMERIC, 'is.firres', NUM_CAST_INT, true ], // firres
27 => [FILTER_CR_NUMERIC, 'is.natres', NUM_CAST_INT, true ], // natres 27 => [parent::CR_NUMERIC, 'is.natres', NUM_CAST_INT, true ], // natres
28 => [FILTER_CR_NUMERIC, 'is.frores', NUM_CAST_INT, true ], // frores 28 => [parent::CR_NUMERIC, 'is.frores', NUM_CAST_INT, true ], // frores
29 => [FILTER_CR_NUMERIC, 'is.shares', NUM_CAST_INT, true ], // shares 29 => [parent::CR_NUMERIC, 'is.shares', NUM_CAST_INT, true ], // shares
30 => [FILTER_CR_NUMERIC, 'is.holres', NUM_CAST_INT, true ], // holres 30 => [parent::CR_NUMERIC, 'is.holres', NUM_CAST_INT, true ], // holres
32 => [FILTER_CR_NUMERIC, 'is.dps', NUM_CAST_FLOAT, true ], // dps 32 => [parent::CR_NUMERIC, 'is.dps', NUM_CAST_FLOAT, true ], // dps
33 => [FILTER_CR_NUMERIC, 'is.dmgmin1', NUM_CAST_INT, true ], // dmgmin1 33 => [parent::CR_NUMERIC, 'is.dmgmin1', NUM_CAST_INT, true ], // dmgmin1
34 => [FILTER_CR_NUMERIC, 'is.dmgmax1', NUM_CAST_INT, true ], // dmgmax1 34 => [parent::CR_NUMERIC, 'is.dmgmax1', NUM_CAST_INT, true ], // dmgmax1
35 => [FILTER_CR_CALLBACK, 'cbDamageType', null, null ], // damagetype [enum] 35 => [parent::CR_CALLBACK, 'cbDamageType', null, null ], // damagetype [enum]
36 => [FILTER_CR_NUMERIC, 'is.speed', NUM_CAST_FLOAT, true ], // speed 36 => [parent::CR_NUMERIC, 'is.speed', NUM_CAST_FLOAT, true ], // speed
37 => [FILTER_CR_NUMERIC, 'is.mleatkpwr', NUM_CAST_INT, true ], // mleatkpwr 37 => [parent::CR_NUMERIC, 'is.mleatkpwr', NUM_CAST_INT, true ], // mleatkpwr
38 => [FILTER_CR_NUMERIC, 'is.rgdatkpwr', NUM_CAST_INT, true ], // rgdatkpwr 38 => [parent::CR_NUMERIC, 'is.rgdatkpwr', NUM_CAST_INT, true ], // rgdatkpwr
39 => [FILTER_CR_NUMERIC, 'is.rgdhitrtng', NUM_CAST_INT, true ], // rgdhitrtng 39 => [parent::CR_NUMERIC, 'is.rgdhitrtng', NUM_CAST_INT, true ], // rgdhitrtng
40 => [FILTER_CR_NUMERIC, 'is.rgdcritstrkrtng', NUM_CAST_INT, true ], // rgdcritstrkrtng 40 => [parent::CR_NUMERIC, 'is.rgdcritstrkrtng', NUM_CAST_INT, true ], // rgdcritstrkrtng
41 => [FILTER_CR_NUMERIC, 'is.armor', NUM_CAST_INT, true ], // armor 41 => [parent::CR_NUMERIC, 'is.armor', NUM_CAST_INT, true ], // armor
42 => [FILTER_CR_NUMERIC, 'is.defrtng', NUM_CAST_INT, true ], // defrtng 42 => [parent::CR_NUMERIC, 'is.defrtng', NUM_CAST_INT, true ], // defrtng
43 => [FILTER_CR_NUMERIC, 'is.block', NUM_CAST_INT, true ], // block 43 => [parent::CR_NUMERIC, 'is.block', NUM_CAST_INT, true ], // block
44 => [FILTER_CR_NUMERIC, 'is.blockrtng', NUM_CAST_INT, true ], // blockrtng 44 => [parent::CR_NUMERIC, 'is.blockrtng', NUM_CAST_INT, true ], // blockrtng
45 => [FILTER_CR_NUMERIC, 'is.dodgertng', NUM_CAST_INT, true ], // dodgertng 45 => [parent::CR_NUMERIC, 'is.dodgertng', NUM_CAST_INT, true ], // dodgertng
46 => [FILTER_CR_NUMERIC, 'is.parryrtng', NUM_CAST_INT, true ], // parryrtng 46 => [parent::CR_NUMERIC, 'is.parryrtng', NUM_CAST_INT, true ], // parryrtng
48 => [FILTER_CR_NUMERIC, 'is.splhitrtng', NUM_CAST_INT, true ], // splhitrtng 48 => [parent::CR_NUMERIC, 'is.splhitrtng', NUM_CAST_INT, true ], // splhitrtng
49 => [FILTER_CR_NUMERIC, 'is.splcritstrkrtng', NUM_CAST_INT, true ], // splcritstrkrtng 49 => [parent::CR_NUMERIC, 'is.splcritstrkrtng', NUM_CAST_INT, true ], // splcritstrkrtng
50 => [FILTER_CR_NUMERIC, 'is.splheal', NUM_CAST_INT, true ], // splheal 50 => [parent::CR_NUMERIC, 'is.splheal', NUM_CAST_INT, true ], // splheal
51 => [FILTER_CR_NUMERIC, 'is.spldmg', NUM_CAST_INT, true ], // spldmg 51 => [parent::CR_NUMERIC, 'is.spldmg', NUM_CAST_INT, true ], // spldmg
52 => [FILTER_CR_NUMERIC, 'is.arcsplpwr', NUM_CAST_INT, true ], // arcsplpwr 52 => [parent::CR_NUMERIC, 'is.arcsplpwr', NUM_CAST_INT, true ], // arcsplpwr
53 => [FILTER_CR_NUMERIC, 'is.firsplpwr', NUM_CAST_INT, true ], // firsplpwr 53 => [parent::CR_NUMERIC, 'is.firsplpwr', NUM_CAST_INT, true ], // firsplpwr
54 => [FILTER_CR_NUMERIC, 'is.frosplpwr', NUM_CAST_INT, true ], // frosplpwr 54 => [parent::CR_NUMERIC, 'is.frosplpwr', NUM_CAST_INT, true ], // frosplpwr
55 => [FILTER_CR_NUMERIC, 'is.holsplpwr', NUM_CAST_INT, true ], // holsplpwr 55 => [parent::CR_NUMERIC, 'is.holsplpwr', NUM_CAST_INT, true ], // holsplpwr
56 => [FILTER_CR_NUMERIC, 'is.natsplpwr', NUM_CAST_INT, true ], // natsplpwr 56 => [parent::CR_NUMERIC, 'is.natsplpwr', NUM_CAST_INT, true ], // natsplpwr
57 => [FILTER_CR_NUMERIC, 'is.shasplpwr', NUM_CAST_INT, true ], // shasplpwr 57 => [parent::CR_NUMERIC, 'is.shasplpwr', NUM_CAST_INT, true ], // shasplpwr
59 => [FILTER_CR_NUMERIC, 'durability', NUM_CAST_INT, true ], // dura 59 => [parent::CR_NUMERIC, 'durability', NUM_CAST_INT, true ], // dura
60 => [FILTER_CR_NUMERIC, 'is.healthrgn', NUM_CAST_INT, true ], // healthrgn 60 => [parent::CR_NUMERIC, 'is.healthrgn', NUM_CAST_INT, true ], // healthrgn
61 => [FILTER_CR_NUMERIC, 'is.manargn', NUM_CAST_INT, true ], // manargn 61 => [parent::CR_NUMERIC, 'is.manargn', NUM_CAST_INT, true ], // manargn
62 => [FILTER_CR_CALLBACK, 'cbCooldown', null, null ], // cooldown [op] [int] 62 => [parent::CR_CALLBACK, 'cbCooldown', null, null ], // cooldown [op] [int]
63 => [FILTER_CR_NUMERIC, 'buyPrice', NUM_CAST_INT, true ], // buyprice 63 => [parent::CR_NUMERIC, 'buyPrice', NUM_CAST_INT, true ], // buyprice
64 => [FILTER_CR_NUMERIC, 'sellPrice', NUM_CAST_INT, true ], // sellprice 64 => [parent::CR_NUMERIC, 'sellPrice', NUM_CAST_INT, true ], // sellprice
65 => [FILTER_CR_CALLBACK, 'cbAvgMoneyContent', null, null ], // avgmoney [op] [int] 65 => [parent::CR_CALLBACK, 'cbAvgMoneyContent', null, null ], // avgmoney [op] [int]
66 => [FILTER_CR_ENUM, 'requiredSpell' ], // requiresprofspec 66 => [parent::CR_ENUM, 'requiredSpell' ], // requiresprofspec
68 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 15, null ], // otdisenchanting [yn] 68 => [parent::CR_CALLBACK, 'cbObtainedBy', 15, null ], // otdisenchanting [yn]
69 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 16, null ], // otfishing [yn] 69 => [parent::CR_CALLBACK, 'cbObtainedBy', 16, null ], // otfishing [yn]
70 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 17, null ], // otherbgathering [yn] 70 => [parent::CR_CALLBACK, 'cbObtainedBy', 17, null ], // otherbgathering [yn]
71 => [FILTER_CR_FLAG, 'cuFlags', ITEM_CU_OT_ITEMLOOT ], // otitemopening [yn] 71 => [parent::CR_FLAG, 'cuFlags', ITEM_CU_OT_ITEMLOOT ], // otitemopening [yn]
72 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 2, null ], // otlooting [yn] 72 => [parent::CR_CALLBACK, 'cbObtainedBy', 2, null ], // otlooting [yn]
73 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 19, null ], // otmining [yn] 73 => [parent::CR_CALLBACK, 'cbObtainedBy', 19, null ], // otmining [yn]
74 => [FILTER_CR_FLAG, 'cuFlags', ITEM_CU_OT_OBJECTLOOT ], // otobjectopening [yn] 74 => [parent::CR_FLAG, 'cuFlags', ITEM_CU_OT_OBJECTLOOT ], // otobjectopening [yn]
75 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 21, null ], // otpickpocketing [yn] 75 => [parent::CR_CALLBACK, 'cbObtainedBy', 21, null ], // otpickpocketing [yn]
76 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 23, null ], // otskinning [yn] 76 => [parent::CR_CALLBACK, 'cbObtainedBy', 23, null ], // otskinning [yn]
77 => [FILTER_CR_NUMERIC, 'is.atkpwr', NUM_CAST_INT, true ], // atkpwr 77 => [parent::CR_NUMERIC, 'is.atkpwr', NUM_CAST_INT, true ], // atkpwr
78 => [FILTER_CR_NUMERIC, 'is.mlehastertng', NUM_CAST_INT, true ], // mlehastertng 78 => [parent::CR_NUMERIC, 'is.mlehastertng', NUM_CAST_INT, true ], // mlehastertng
79 => [FILTER_CR_NUMERIC, 'is.resirtng', NUM_CAST_INT, true ], // resirtng 79 => [parent::CR_NUMERIC, 'is.resirtng', NUM_CAST_INT, true ], // resirtng
80 => [FILTER_CR_CALLBACK, 'cbHasSockets', null, null ], // has sockets [enum] 80 => [parent::CR_CALLBACK, 'cbHasSockets', null, null ], // has sockets [enum]
81 => [FILTER_CR_CALLBACK, 'cbFitsGemSlot', null, null ], // fits gem slot [enum] 81 => [parent::CR_CALLBACK, 'cbFitsGemSlot', null, null ], // fits gem slot [enum]
83 => [FILTER_CR_FLAG, 'flags', ITEM_FLAG_UNIQUEEQUIPPED ], // uniqueequipped 83 => [parent::CR_FLAG, 'flags', ITEM_FLAG_UNIQUEEQUIPPED ], // uniqueequipped
84 => [FILTER_CR_NUMERIC, 'is.mlecritstrkrtng', NUM_CAST_INT, true ], // mlecritstrkrtng 84 => [parent::CR_NUMERIC, 'is.mlecritstrkrtng', NUM_CAST_INT, true ], // mlecritstrkrtng
85 => [FILTER_CR_CALLBACK, 'cbObjectiveOfQuest', null, null ], // objectivequest [side] 85 => [parent::CR_CALLBACK, 'cbObjectiveOfQuest', null, null ], // objectivequest [side]
86 => [FILTER_CR_CALLBACK, 'cbCraftedByProf', null, null ], // craftedprof [enum] 86 => [parent::CR_CALLBACK, 'cbCraftedByProf', null, null ], // craftedprof [enum]
87 => [FILTER_CR_CALLBACK, 'cbReagentForAbility', null, null ], // reagentforability [enum] 87 => [parent::CR_CALLBACK, 'cbReagentForAbility', null, null ], // reagentforability [enum]
88 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 20, null ], // otprospecting [yn] 88 => [parent::CR_CALLBACK, 'cbObtainedBy', 20, null ], // otprospecting [yn]
89 => [FILTER_CR_FLAG, 'flags', ITEM_FLAG_PROSPECTABLE ], // prospectable 89 => [parent::CR_FLAG, 'flags', ITEM_FLAG_PROSPECTABLE ], // prospectable
90 => [FILTER_CR_CALLBACK, 'cbAvgBuyout', null, null ], // avgbuyout [op] [int] 90 => [parent::CR_CALLBACK, 'cbAvgBuyout', null, null ], // avgbuyout [op] [int]
91 => [FILTER_CR_ENUM, 'totemCategory', false, true ], // tool 91 => [parent::CR_ENUM, 'totemCategory', false, true ], // tool
92 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 5, null ], // soldbyvendor [yn] 92 => [parent::CR_CALLBACK, 'cbObtainedBy', 5, null ], // soldbyvendor [yn]
93 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 3, null ], // otpvp [pvp] 93 => [parent::CR_CALLBACK, 'cbObtainedBy', 3, null ], // otpvp [pvp]
94 => [FILTER_CR_NUMERIC, 'is.splpen', NUM_CAST_INT, true ], // splpen 94 => [parent::CR_NUMERIC, 'is.splpen', NUM_CAST_INT, true ], // splpen
95 => [FILTER_CR_NUMERIC, 'is.mlehitrtng', NUM_CAST_INT, true ], // mlehitrtng 95 => [parent::CR_NUMERIC, 'is.mlehitrtng', NUM_CAST_INT, true ], // mlehitrtng
96 => [FILTER_CR_NUMERIC, 'is.critstrkrtng', NUM_CAST_INT, true ], // critstrkrtng 96 => [parent::CR_NUMERIC, 'is.critstrkrtng', NUM_CAST_INT, true ], // critstrkrtng
97 => [FILTER_CR_NUMERIC, 'is.feratkpwr', NUM_CAST_INT, true ], // feratkpwr 97 => [parent::CR_NUMERIC, 'is.feratkpwr', NUM_CAST_INT, true ], // feratkpwr
98 => [FILTER_CR_FLAG, 'flags', ITEM_FLAG_PARTYLOOT ], // partyloot 98 => [parent::CR_FLAG, 'flags', ITEM_FLAG_PARTYLOOT ], // partyloot
99 => [FILTER_CR_ENUM, 'requiredSkill' ], // requiresprof 99 => [parent::CR_ENUM, 'requiredSkill' ], // requiresprof
100 => [FILTER_CR_NUMERIC, 'is.nsockets', NUM_CAST_INT ], // nsockets 100 => [parent::CR_NUMERIC, 'is.nsockets', NUM_CAST_INT ], // nsockets
101 => [FILTER_CR_NUMERIC, 'is.rgdhastertng', NUM_CAST_INT, true ], // rgdhastertng 101 => [parent::CR_NUMERIC, 'is.rgdhastertng', NUM_CAST_INT, true ], // rgdhastertng
102 => [FILTER_CR_NUMERIC, 'is.splhastertng', NUM_CAST_INT, true ], // splhastertng 102 => [parent::CR_NUMERIC, 'is.splhastertng', NUM_CAST_INT, true ], // splhastertng
103 => [FILTER_CR_NUMERIC, 'is.hastertng', NUM_CAST_INT, true ], // hastertng 103 => [parent::CR_NUMERIC, 'is.hastertng', NUM_CAST_INT, true ], // hastertng
104 => [FILTER_CR_STRING, 'description', STR_LOCALIZED ], // flavortext 104 => [parent::CR_STRING, 'description', STR_LOCALIZED ], // flavortext
105 => [FILTER_CR_CALLBACK, 'cbDropsInInstance', SRC_FLAG_DUNGEON_DROP, 1 ], // dropsinnormal [heroicdungeon-any] 105 => [parent::CR_CALLBACK, 'cbDropsInInstance', SRC_FLAG_DUNGEON_DROP, 1 ], // dropsinnormal [heroicdungeon-any]
106 => [FILTER_CR_CALLBACK, 'cbDropsInInstance', SRC_FLAG_DUNGEON_DROP, 2 ], // dropsinheroic [heroicdungeon-any] 106 => [parent::CR_CALLBACK, 'cbDropsInInstance', SRC_FLAG_DUNGEON_DROP, 2 ], // dropsinheroic [heroicdungeon-any]
107 => [FILTER_CR_NYI_PH, null, 1, ], // effecttext [str] not yet parsed ['effectsParsed_loc'.Lang::getLocale()->value, $cr[2]] 107 => [parent::CR_NYI_PH, null, 1, ], // effecttext [str] not yet parsed ['effectsParsed_loc'.Lang::getLocale()->value, $cr[2]]
109 => [FILTER_CR_CALLBACK, 'cbArmorBonus', null, null ], // armorbonus [op] [int] 109 => [parent::CR_CALLBACK, 'cbArmorBonus', null, null ], // armorbonus [op] [int]
111 => [FILTER_CR_NUMERIC, 'requiredSkillRank', NUM_CAST_INT, true ], // reqskillrank 111 => [parent::CR_NUMERIC, 'requiredSkillRank', NUM_CAST_INT, true ], // reqskillrank
113 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots 113 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
114 => [FILTER_CR_NUMERIC, 'is.armorpenrtng', NUM_CAST_INT, true ], // armorpenrtng 114 => [parent::CR_NUMERIC, 'is.armorpenrtng', NUM_CAST_INT, true ], // armorpenrtng
115 => [FILTER_CR_NUMERIC, 'is.health', NUM_CAST_INT, true ], // health 115 => [parent::CR_NUMERIC, 'is.health', NUM_CAST_INT, true ], // health
116 => [FILTER_CR_NUMERIC, 'is.mana', NUM_CAST_INT, true ], // mana 116 => [parent::CR_NUMERIC, 'is.mana', NUM_CAST_INT, true ], // mana
117 => [FILTER_CR_NUMERIC, 'is.exprtng', NUM_CAST_INT, true ], // exprtng 117 => [parent::CR_NUMERIC, 'is.exprtng', NUM_CAST_INT, true ], // exprtng
118 => [FILTER_CR_CALLBACK, 'cbPurchasableWith', null, null ], // purchasablewithitem [enum] 118 => [parent::CR_CALLBACK, 'cbPurchasableWith', null, null ], // purchasablewithitem [enum]
119 => [FILTER_CR_NUMERIC, 'is.hitrtng', NUM_CAST_INT, true ], // hitrtng 119 => [parent::CR_NUMERIC, 'is.hitrtng', NUM_CAST_INT, true ], // hitrtng
123 => [FILTER_CR_NUMERIC, 'is.splpwr', NUM_CAST_INT, true ], // splpwr 123 => [parent::CR_NUMERIC, 'is.splpwr', NUM_CAST_INT, true ], // splpwr
124 => [FILTER_CR_CALLBACK, 'cbHasRandEnchant', null, null ], // randomenchants [str] 124 => [parent::CR_CALLBACK, 'cbHasRandEnchant', null, null ], // randomenchants [str]
125 => [FILTER_CR_CALLBACK, 'cbReqArenaRating', null, null ], // reqarenartng [op] [int] todo (low): 'find out, why "IN (W, X, Y) AND IN (X, Y, Z)" doesn't result in "(X, Y)" 125 => [parent::CR_CALLBACK, 'cbReqArenaRating', null, null ], // reqarenartng [op] [int] todo (low): 'find out, why "IN (W, X, Y) AND IN (X, Y, Z)" doesn't result in "(X, Y)"
126 => [FILTER_CR_CALLBACK, 'cbQuestRewardIn', null, null ], // rewardedbyquestin [zone-any] 126 => [parent::CR_CALLBACK, 'cbQuestRewardIn', null, null ], // rewardedbyquestin [zone-any]
128 => [FILTER_CR_CALLBACK, 'cbSource', null, null ], // source [enum] 128 => [parent::CR_CALLBACK, 'cbSource', null, null ], // source [enum]
129 => [FILTER_CR_CALLBACK, 'cbSoldByNPC', null, null ], // soldbynpc [str-small] 129 => [parent::CR_CALLBACK, 'cbSoldByNPC', null, null ], // soldbynpc [str-small]
130 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 130 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
132 => [FILTER_CR_CALLBACK, 'cbGlyphType', null, null ], // glyphtype [enum] 132 => [parent::CR_CALLBACK, 'cbGlyphType', null, null ], // glyphtype [enum]
133 => [FILTER_CR_FLAG, 'flags', ITEM_FLAG_ACCOUNTBOUND ], // accountbound 133 => [parent::CR_FLAG, 'flags', ITEM_FLAG_ACCOUNTBOUND ], // accountbound
134 => [FILTER_CR_NUMERIC, 'is.mledps', NUM_CAST_FLOAT, true ], // mledps 134 => [parent::CR_NUMERIC, 'is.mledps', NUM_CAST_FLOAT, true ], // mledps
135 => [FILTER_CR_NUMERIC, 'is.mledmgmin', NUM_CAST_INT, true ], // mledmgmin 135 => [parent::CR_NUMERIC, 'is.mledmgmin', NUM_CAST_INT, true ], // mledmgmin
136 => [FILTER_CR_NUMERIC, 'is.mledmgmax', NUM_CAST_INT, true ], // mledmgmax 136 => [parent::CR_NUMERIC, 'is.mledmgmax', NUM_CAST_INT, true ], // mledmgmax
137 => [FILTER_CR_NUMERIC, 'is.mlespeed', NUM_CAST_FLOAT, true ], // mlespeed 137 => [parent::CR_NUMERIC, 'is.mlespeed', NUM_CAST_FLOAT, true ], // mlespeed
138 => [FILTER_CR_NUMERIC, 'is.rgddps', NUM_CAST_FLOAT, true ], // rgddps 138 => [parent::CR_NUMERIC, 'is.rgddps', NUM_CAST_FLOAT, true ], // rgddps
139 => [FILTER_CR_NUMERIC, 'is.rgddmgmin', NUM_CAST_INT, true ], // rgddmgmin 139 => [parent::CR_NUMERIC, 'is.rgddmgmin', NUM_CAST_INT, true ], // rgddmgmin
140 => [FILTER_CR_NUMERIC, 'is.rgddmgmax', NUM_CAST_INT, true ], // rgddmgmax 140 => [parent::CR_NUMERIC, 'is.rgddmgmax', NUM_CAST_INT, true ], // rgddmgmax
141 => [FILTER_CR_NUMERIC, 'is.rgdspeed', NUM_CAST_FLOAT, true ], // rgdspeed 141 => [parent::CR_NUMERIC, 'is.rgdspeed', NUM_CAST_FLOAT, true ], // rgdspeed
142 => [FILTER_CR_STRING, 'ic.name' ], // icon 142 => [parent::CR_STRING, 'ic.name' ], // icon
143 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 18, null ], // otmilling [yn] 143 => [parent::CR_CALLBACK, 'cbObtainedBy', 18, null ], // otmilling [yn]
144 => [FILTER_CR_CALLBACK, 'cbPvpPurchasable', 'reqHonorPoints', null ], // purchasablewithhonor [yn] 144 => [parent::CR_CALLBACK, 'cbPvpPurchasable', 'reqHonorPoints', null ], // purchasablewithhonor [yn]
145 => [FILTER_CR_CALLBACK, 'cbPvpPurchasable', 'reqArenaPoints', null ], // purchasablewitharena [yn] 145 => [parent::CR_CALLBACK, 'cbPvpPurchasable', 'reqArenaPoints', null ], // purchasablewitharena [yn]
146 => [FILTER_CR_FLAG, 'flags', ITEM_FLAG_HEROIC ], // heroic 146 => [parent::CR_FLAG, 'flags', ITEM_FLAG_HEROIC ], // heroic
147 => [FILTER_CR_CALLBACK, 'cbDropsInInstance', SRC_FLAG_RAID_DROP, 1, ], // dropsinnormal10 [multimoderaid-any] 147 => [parent::CR_CALLBACK, 'cbDropsInInstance', SRC_FLAG_RAID_DROP, 1, ], // dropsinnormal10 [multimoderaid-any]
148 => [FILTER_CR_CALLBACK, 'cbDropsInInstance', SRC_FLAG_RAID_DROP, 2, ], // dropsinnormal25 [multimoderaid-any] 148 => [parent::CR_CALLBACK, 'cbDropsInInstance', SRC_FLAG_RAID_DROP, 2, ], // dropsinnormal25 [multimoderaid-any]
149 => [FILTER_CR_CALLBACK, 'cbDropsInInstance', SRC_FLAG_RAID_DROP, 4, ], // dropsinheroic10 [heroicraid-any] 149 => [parent::CR_CALLBACK, 'cbDropsInInstance', SRC_FLAG_RAID_DROP, 4, ], // dropsinheroic10 [heroicraid-any]
150 => [FILTER_CR_CALLBACK, 'cbDropsInInstance', SRC_FLAG_RAID_DROP, 8, ], // dropsinheroic25 [heroicraid-any] 150 => [parent::CR_CALLBACK, 'cbDropsInInstance', SRC_FLAG_RAID_DROP, 8, ], // dropsinheroic25 [heroicraid-any]
151 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true ], // id 151 => [parent::CR_NUMERIC, 'id', NUM_CAST_INT, true ], // id
152 => [FILTER_CR_CALLBACK, 'cbClassRaceSpec', 'requiredClass', CLASS_MASK_ALL], // classspecific [enum] 152 => [parent::CR_CALLBACK, 'cbClassRaceSpec', 'requiredClass', CLASS_MASK_ALL], // classspecific [enum]
153 => [FILTER_CR_CALLBACK, 'cbClassRaceSpec', 'requiredRace', RACE_MASK_ALL ], // racespecific [enum] 153 => [parent::CR_CALLBACK, 'cbClassRaceSpec', 'requiredRace', RACE_MASK_ALL ], // racespecific [enum]
154 => [FILTER_CR_FLAG, 'flags', ITEM_FLAG_REFUNDABLE ], // refundable 154 => [parent::CR_FLAG, 'flags', ITEM_FLAG_REFUNDABLE ], // refundable
155 => [FILTER_CR_FLAG, 'flags', ITEM_FLAG_USABLE_ARENA ], // usableinarenas 155 => [parent::CR_FLAG, 'flags', ITEM_FLAG_USABLE_ARENA ], // usableinarenas
156 => [FILTER_CR_FLAG, 'flags', ITEM_FLAG_USABLE_SHAPED ], // usablewhenshapeshifted 156 => [parent::CR_FLAG, 'flags', ITEM_FLAG_USABLE_SHAPED ], // usablewhenshapeshifted
157 => [FILTER_CR_FLAG, 'flags', ITEM_FLAG_SMARTLOOT ], // smartloot 157 => [parent::CR_FLAG, 'flags', ITEM_FLAG_SMARTLOOT ], // smartloot
158 => [FILTER_CR_CALLBACK, 'cbPurchasableWith', null, null ], // purchasablewithcurrency [enum] 158 => [parent::CR_CALLBACK, 'cbPurchasableWith', null, null ], // purchasablewithcurrency [enum]
159 => [FILTER_CR_FLAG, 'flags', ITEM_FLAG_MILLABLE ], // millable 159 => [parent::CR_FLAG, 'flags', ITEM_FLAG_MILLABLE ], // millable
160 => [FILTER_CR_NYI_PH, null, 1, ], // relatedevent [enum] like 169 .. crawl though npc_vendor and loot_templates of event-related spawns 160 => [parent::CR_NYI_PH, null, 1, ], // relatedevent [enum] like 169 .. crawl though npc_vendor and loot_templates of event-related spawns
161 => [FILTER_CR_CALLBACK, 'cbAvailable', null, null ], // availabletoplayers [yn] 161 => [parent::CR_CALLBACK, 'cbAvailable', null, null ], // availabletoplayers [yn]
162 => [FILTER_CR_FLAG, 'flags', ITEM_FLAG_DEPRECATED ], // deprecated 162 => [parent::CR_FLAG, 'flags', ITEM_FLAG_DEPRECATED ], // deprecated
163 => [FILTER_CR_CALLBACK, 'cbDisenchantsInto', null, null ], // disenchantsinto [disenchanting] 163 => [parent::CR_CALLBACK, 'cbDisenchantsInto', null, null ], // disenchantsinto [disenchanting]
165 => [FILTER_CR_NUMERIC, 'repairPrice', NUM_CAST_INT, true ], // repaircost 165 => [parent::CR_NUMERIC, 'repairPrice', NUM_CAST_INT, true ], // repaircost
167 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 167 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
168 => [FILTER_CR_CALLBACK, 'cbFieldHasVal', 'spellId1', LEARN_SPELLS ], // teachesspell [yn] 168 => [parent::CR_CALLBACK, 'cbFieldHasVal', 'spellId1', LEARN_SPELLS ], // teachesspell [yn]
169 => [FILTER_CR_ENUM, 'e.holidayId', true, true ], // requiresevent 169 => [parent::CR_ENUM, 'e.holidayId', true, true ], // requiresevent
171 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 8, null ], // otredemption [yn] 171 => [parent::CR_CALLBACK, 'cbObtainedBy', 8, null ], // otredemption [yn]
172 => [FILTER_CR_CALLBACK, 'cbObtainedBy', 12, null ], // rewardedbyachievement [yn] 172 => [parent::CR_CALLBACK, 'cbObtainedBy', 12, null ], // rewardedbyachievement [yn]
176 => [FILTER_CR_STAFFFLAG, 'flags' ], // flags 176 => [parent::CR_STAFFFLAG, 'flags' ], // flags
177 => [FILTER_CR_STAFFFLAG, 'flagsExtra' ], // flags2 177 => [parent::CR_STAFFFLAG, 'flagsExtra' ], // flags2
); );
protected $inputFields = array( protected $inputFields = array(
'wt' => [FILTER_V_CALLBACK, 'cbWeightKeyCheck', true ], // weight keys 'wt' => [parent::V_CALLBACK, 'cbWeightKeyCheck', true ], // weight keys
'wtv' => [FILTER_V_RANGE, [1, 999], true ], // weight values 'wtv' => [parent::V_RANGE, [1, 999], true ], // weight values
'jc' => [FILTER_V_LIST, [1], false], // use jewelcrafter gems for weight calculation 'jc' => [parent::V_LIST, [1], false], // use jewelcrafter gems for weight calculation
'gm' => [FILTER_V_LIST, [2, 3, 4], false], // gem rarity for weight calculation 'gm' => [parent::V_LIST, [2, 3, 4], false], // gem rarity for weight calculation
'cr' => [FILTER_V_RANGE, [1, 177], true ], // criteria ids 'cr' => [parent::V_RANGE, [1, 177], true ], // criteria ids
'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 99999]], true ], // criteria operators 'crs' => [parent::V_LIST, [parent::ENUM_NONE, parent::ENUM_ANY, [0, 99999]], true ], // criteria operators
'crv' => [FILTER_V_REGEX, parent::PATTERN_CRV, true ], // criteria values - only printable chars, no delimiters 'crv' => [parent::V_REGEX, parent::PATTERN_CRV, true ], // criteria values - only printable chars, no delimiters
'upg' => [FILTER_V_REGEX, '/[^\d:]/ui', false], // upgrade item ids 'upg' => [parent::V_REGEX, '/[^\d:]/ui', false], // upgrade item ids
'gb' => [FILTER_V_LIST, [0, 1, 2, 3], false], // search result grouping 'gb' => [parent::V_LIST, [0, 1, 2, 3], false], // search result grouping
'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter 'na' => [parent::V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter
'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'ma' => [parent::V_EQUAL, 1, false], // match any / all filter
'ub' => [FILTER_V_LIST, [[1, 9], 11], false], // usable by classId 'ub' => [parent::V_LIST, [[1, 9], 11], false], // usable by classId
'qu' => [FILTER_V_RANGE, [0, 7], true ], // quality ids 'qu' => [parent::V_RANGE, [0, 7], true ], // quality ids
'ty' => [FILTER_V_CALLBACK, 'cbTypeCheck', true ], // item type - dynamic by current group 'ty' => [parent::V_CALLBACK, 'cbTypeCheck', true ], // item type - dynamic by current group
'sl' => [FILTER_V_CALLBACK, 'cbSlotCheck', true ], // item slot - dynamic by current group 'sl' => [parent::V_CALLBACK, 'cbSlotCheck', true ], // item slot - dynamic by current group
'si' => [FILTER_V_LIST, [1, 2, 3, -1, -2], false], // side 'si' => [parent::V_LIST, [1, 2, 3, -1, -2], false], // side
'minle' => [FILTER_V_RANGE, [1, 999], false], // item level min 'minle' => [parent::V_RANGE, [1, 999], false], // item level min
'maxle' => [FILTER_V_RANGE, [1, 999], false], // item level max 'maxle' => [parent::V_RANGE, [1, 999], false], // item level max
'minrl' => [FILTER_V_RANGE, [1, MAX_LEVEL], false], // required level min 'minrl' => [parent::V_RANGE, [1, MAX_LEVEL], false], // required level min
'maxrl' => [FILTER_V_RANGE, [1, MAX_LEVEL], false] // required level max 'maxrl' => [parent::V_RANGE, [1, MAX_LEVEL], false] // required level max
); );
public function __construct($fromPOST = false, $opts = []) public function __construct($fromPOST = false, $opts = [])
@@ -2274,7 +2274,7 @@ class ItemListFilter extends Filter
protected function cbHasRandEnchant($cr) : mixed protected function cbHasRandEnchant($cr) : mixed
{ {
$n = preg_replace(Filter::PATTERN_NAME, '', $cr[2]); $n = preg_replace(parent::PATTERN_NAME, '', $cr[2]);
$n = $this->transformString($n, false); $n = $this->transformString($n, false);
$randIds = DB::Aowow()->select('SELECT `id` AS ARRAY_KEY, ABS(`id`) AS `id`, name_loc?d, `name_loc0` FROM ?_itemrandomenchant WHERE name_loc?d LIKE ?', Lang::getLocale()->value, Lang::getLocale()->value, $n); $randIds = DB::Aowow()->select('SELECT `id` AS ARRAY_KEY, ABS(`id`) AS `id`, name_loc?d, `name_loc0` FROM ?_itemrandomenchant WHERE name_loc?d LIKE ?', Lang::getLocale()->value, Lang::getLocale()->value, $n);
@@ -2332,7 +2332,7 @@ class ItemListFilter extends Filter
protected function cbDamageType($cr) : mixed protected function cbDamageType($cr) : mixed
{ {
if (!$this->checkInput(FILTER_V_RANGE, [0, 6], $cr[1])) if (!$this->checkInput(parent::V_RANGE, [0, 6], $cr[1]))
return false; return false;
return ['OR', ['dmgType1', $cr[1]], ['dmgType2', $cr[1]]]; return ['OR', ['dmgType1', $cr[1]], ['dmgType2', $cr[1]]];
@@ -2365,7 +2365,7 @@ class ItemListFilter extends Filter
{ {
if (in_array($cr[1], $this->enums[$cr[0]])) if (in_array($cr[1], $this->enums[$cr[0]]))
return ['AND', ['src.src4', null, '!'], ['src.moreZoneId', $cr[1]]]; return ['AND', ['src.src4', null, '!'], ['src.moreZoneId', $cr[1]]];
else if ($cr[1] == FILTER_ENUM_ANY) else if ($cr[1] == parent::ENUM_ANY)
return ['src.src4', null, '!']; // well, this seems a bit redundant.. return ['src.src4', null, '!']; // well, this seems a bit redundant..
return false; return false;
@@ -2375,7 +2375,7 @@ class ItemListFilter extends Filter
{ {
if (in_array($cr[1], $this->enums[$cr[0]])) if (in_array($cr[1], $this->enums[$cr[0]]))
return ['AND', ['src.src2', null, '!'], ['src.moreZoneId', $cr[1]]]; return ['AND', ['src.src2', null, '!'], ['src.moreZoneId', $cr[1]]];
else if ($cr[1] == FILTER_ENUM_ANY) else if ($cr[1] == parent::ENUM_ANY)
return ['src.src2', null, '!']; // well, this seems a bit redundant.. return ['src.src2', null, '!']; // well, this seems a bit redundant..
return false; return false;
@@ -2385,7 +2385,7 @@ class ItemListFilter extends Filter
{ {
if (in_array($cr[1], $this->enums[$cr[0]])) if (in_array($cr[1], $this->enums[$cr[0]]))
return ['AND', ['src.src2', $modeBit, '&'], ['src.moreMask', $moreFlag, '&'], ['src.moreZoneId', $cr[1]]]; return ['AND', ['src.src2', $modeBit, '&'], ['src.moreMask', $moreFlag, '&'], ['src.moreZoneId', $cr[1]]];
else if ($cr[1] == FILTER_ENUM_ANY) else if ($cr[1] == parent::ENUM_ANY)
return ['AND', ['src.src2', $modeBit, '&'], ['src.moreMask', $moreFlag, '&']]; return ['AND', ['src.src2', $modeBit, '&'], ['src.moreMask', $moreFlag, '&']];
return false; return false;
@@ -2395,7 +2395,7 @@ class ItemListFilter extends Filter
{ {
if (in_array($cr[1], $this->enums[$cr[0]])) if (in_array($cr[1], $this->enums[$cr[0]]))
$_ = (array)$cr[1]; $_ = (array)$cr[1];
else if ($cr[1] == FILTER_ENUM_ANY) else if ($cr[1] == parent::ENUM_ANY)
$_ = $this->enums[$cr[0]]; $_ = $this->enums[$cr[0]];
else else
return false; return false;

View File

@@ -177,31 +177,31 @@ class ItemsetListFilter extends Filter
); );
protected $genericFilter = array( protected $genericFilter = array(
2 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true], // id 2 => [parent::CR_NUMERIC, 'id', NUM_CAST_INT, true], // id
3 => [FILTER_CR_NUMERIC, 'npieces', NUM_CAST_INT ], // pieces 3 => [parent::CR_NUMERIC, 'npieces', NUM_CAST_INT ], // pieces
4 => [FILTER_CR_STRING, 'bonusText', STR_LOCALIZED ], // bonustext 4 => [parent::CR_STRING, 'bonusText', STR_LOCALIZED ], // bonustext
5 => [FILTER_CR_BOOLEAN, 'heroic' ], // heroic 5 => [parent::CR_BOOLEAN, 'heroic' ], // heroic
6 => [FILTER_CR_ENUM, 'e.holidayId', true, true], // relatedevent 6 => [parent::CR_ENUM, 'e.holidayId', true, true], // relatedevent
8 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 8 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
9 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots 9 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
10 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 10 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
12 => [FILTER_CR_CALLBACK, 'cbAvaliable', ] // available to players [yn] 12 => [parent::CR_CALLBACK, 'cbAvaliable', ] // available to players [yn]
); );
protected $inputFields = array( protected $inputFields = array(
'cr' => [FILTER_V_RANGE, [2, 12], true ], // criteria ids 'cr' => [parent::V_RANGE, [2, 12], true ], // criteria ids
'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 424]], true ], // criteria operators 'crs' => [parent::V_LIST, [parent::ENUM_NONE, parent::ENUM_ANY, [0, 424]], true ], // criteria operators
'crv' => [FILTER_V_REGEX, parent::PATTERN_CRV, true ], // criteria values - only printable chars, no delimiters 'crv' => [parent::V_REGEX, parent::PATTERN_CRV, true ], // criteria values - only printable chars, no delimiters
'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name / description - only printable chars, no delimiter 'na' => [parent::V_REGEX, parent::PATTERN_NAME, false], // name / description - only printable chars, no delimiter
'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'ma' => [parent::V_EQUAL, 1, false], // match any / all filter
'qu' => [FILTER_V_RANGE, [0, 7], true ], // quality 'qu' => [parent::V_RANGE, [0, 7], true ], // quality
'ty' => [FILTER_V_RANGE, [1, 12], true ], // set type 'ty' => [parent::V_RANGE, [1, 12], true ], // set type
'minle' => [FILTER_V_RANGE, [1, 999], false], // min item level 'minle' => [parent::V_RANGE, [1, 999], false], // min item level
'maxle' => [FILTER_V_RANGE, [1, 999], false], // max itemlevel 'maxle' => [parent::V_RANGE, [1, 999], false], // max itemlevel
'minrl' => [FILTER_V_RANGE, [1, MAX_LEVEL], false], // min required level 'minrl' => [parent::V_RANGE, [1, MAX_LEVEL], false], // min required level
'maxrl' => [FILTER_V_RANGE, [1, MAX_LEVEL], false], // max required level 'maxrl' => [parent::V_RANGE, [1, MAX_LEVEL], false], // max required level
'cl' => [FILTER_V_LIST, [[1, 9], 11], false], // class 'cl' => [parent::V_LIST, [[1, 9], 11], false], // class
'ta' => [FILTER_V_RANGE, [1, 30], false] // tag / content group 'ta' => [parent::V_RANGE, [1, 30], false] // tag / content group
); );
protected function createSQLForValues() protected function createSQLForValues()

View File

@@ -243,52 +243,52 @@ class ProfileListFilter extends Filter
private $realms = []; private $realms = [];
protected $genericFilter = array( protected $genericFilter = array(
2 => [FILTER_CR_NUMERIC, 'gearscore', NUM_CAST_INT ], // gearscore [num] 2 => [parent::CR_NUMERIC, 'gearscore', NUM_CAST_INT ], // gearscore [num]
3 => [FILTER_CR_CALLBACK, 'cbAchievs', null, null], // achievementpoints [num] 3 => [parent::CR_CALLBACK, 'cbAchievs', null, null], // achievementpoints [num]
5 => [FILTER_CR_NUMERIC, 'talenttree1', NUM_CAST_INT ], // talenttree1 [num] 5 => [parent::CR_NUMERIC, 'talenttree1', NUM_CAST_INT ], // talenttree1 [num]
6 => [FILTER_CR_NUMERIC, 'talenttree2', NUM_CAST_INT ], // talenttree2 [num] 6 => [parent::CR_NUMERIC, 'talenttree2', NUM_CAST_INT ], // talenttree2 [num]
7 => [FILTER_CR_NUMERIC, 'talenttree3', NUM_CAST_INT ], // talenttree3 [num] 7 => [parent::CR_NUMERIC, 'talenttree3', NUM_CAST_INT ], // talenttree3 [num]
9 => [FILTER_CR_STRING, 'g.name' ], // guildname 9 => [parent::CR_STRING, 'g.name' ], // guildname
10 => [FILTER_CR_CALLBACK, 'cbHasGuildRank', null, null], // guildrank 10 => [parent::CR_CALLBACK, 'cbHasGuildRank', null, null], // guildrank
12 => [FILTER_CR_CALLBACK, 'cbTeamName', 2, null], // teamname2v2 12 => [parent::CR_CALLBACK, 'cbTeamName', 2, null], // teamname2v2
15 => [FILTER_CR_CALLBACK, 'cbTeamName', 3, null], // teamname3v3 15 => [parent::CR_CALLBACK, 'cbTeamName', 3, null], // teamname3v3
18 => [FILTER_CR_CALLBACK, 'cbTeamName', 5, null], // teamname5v5 18 => [parent::CR_CALLBACK, 'cbTeamName', 5, null], // teamname5v5
13 => [FILTER_CR_CALLBACK, 'cbTeamRating', 2, null], // teamrtng2v2 13 => [parent::CR_CALLBACK, 'cbTeamRating', 2, null], // teamrtng2v2
16 => [FILTER_CR_CALLBACK, 'cbTeamRating', 3, null], // teamrtng3v3 16 => [parent::CR_CALLBACK, 'cbTeamRating', 3, null], // teamrtng3v3
19 => [FILTER_CR_CALLBACK, 'cbTeamRating', 5, null], // teamrtng5v5 19 => [parent::CR_CALLBACK, 'cbTeamRating', 5, null], // teamrtng5v5
14 => [FILTER_CR_NYI_PH, null, 0 /* 2 */ ], // teamcontrib2v2 [num] 14 => [parent::CR_NYI_PH, null, 0 /* 2 */ ], // teamcontrib2v2 [num]
17 => [FILTER_CR_NYI_PH, null, 0 /* 3 */ ], // teamcontrib3v3 [num] 17 => [parent::CR_NYI_PH, null, 0 /* 3 */ ], // teamcontrib3v3 [num]
20 => [FILTER_CR_NYI_PH, null, 0 /* 5 */ ], // teamcontrib5v5 [num] 20 => [parent::CR_NYI_PH, null, 0 /* 5 */ ], // teamcontrib5v5 [num]
21 => [FILTER_CR_CALLBACK, 'cbWearsItems', null, null], // wearingitem [str] 21 => [parent::CR_CALLBACK, 'cbWearsItems', null, null], // wearingitem [str]
23 => [FILTER_CR_CALLBACK, 'cbCompletedAcv', null, null], // completedachievement 23 => [parent::CR_CALLBACK, 'cbCompletedAcv', null, null], // completedachievement
25 => [FILTER_CR_CALLBACK, 'cbProfession', SKILL_ALCHEMY, null], // alchemy [num] 25 => [parent::CR_CALLBACK, 'cbProfession', SKILL_ALCHEMY, null], // alchemy [num]
26 => [FILTER_CR_CALLBACK, 'cbProfession', SKILL_BLACKSMITHING, null], // blacksmithing [num] 26 => [parent::CR_CALLBACK, 'cbProfession', SKILL_BLACKSMITHING, null], // blacksmithing [num]
27 => [FILTER_CR_CALLBACK, 'cbProfession', SKILL_ENCHANTING, null], // enchanting [num] 27 => [parent::CR_CALLBACK, 'cbProfession', SKILL_ENCHANTING, null], // enchanting [num]
28 => [FILTER_CR_CALLBACK, 'cbProfession', SKILL_ENGINEERING, null], // engineering [num] 28 => [parent::CR_CALLBACK, 'cbProfession', SKILL_ENGINEERING, null], // engineering [num]
29 => [FILTER_CR_CALLBACK, 'cbProfession', SKILL_HERBALISM, null], // herbalism [num] 29 => [parent::CR_CALLBACK, 'cbProfession', SKILL_HERBALISM, null], // herbalism [num]
30 => [FILTER_CR_CALLBACK, 'cbProfession', SKILL_INSCRIPTION, null], // inscription [num] 30 => [parent::CR_CALLBACK, 'cbProfession', SKILL_INSCRIPTION, null], // inscription [num]
31 => [FILTER_CR_CALLBACK, 'cbProfession', SKILL_JEWELCRAFTING, null], // jewelcrafting [num] 31 => [parent::CR_CALLBACK, 'cbProfession', SKILL_JEWELCRAFTING, null], // jewelcrafting [num]
32 => [FILTER_CR_CALLBACK, 'cbProfession', SKILL_LEATHERWORKING, null], // leatherworking [num] 32 => [parent::CR_CALLBACK, 'cbProfession', SKILL_LEATHERWORKING, null], // leatherworking [num]
33 => [FILTER_CR_CALLBACK, 'cbProfession', SKILL_MINING, null], // mining [num] 33 => [parent::CR_CALLBACK, 'cbProfession', SKILL_MINING, null], // mining [num]
34 => [FILTER_CR_CALLBACK, 'cbProfession', SKILL_SKINNING, null], // skinning [num] 34 => [parent::CR_CALLBACK, 'cbProfession', SKILL_SKINNING, null], // skinning [num]
35 => [FILTER_CR_CALLBACK, 'cbProfession', SKILL_TAILORING, null], // tailoring [num] 35 => [parent::CR_CALLBACK, 'cbProfession', SKILL_TAILORING, null], // tailoring [num]
36 => [FILTER_CR_CALLBACK, 'cbHasGuild', null, null] // hasguild [yn] 36 => [parent::CR_CALLBACK, 'cbHasGuild', null, null] // hasguild [yn]
); );
protected $inputFields = array( protected $inputFields = array(
'cr' => [FILTER_V_RANGE, [1, 36], true ], // criteria ids 'cr' => [parent::V_RANGE, [1, 36], true ], // criteria ids
'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 5000]], true ], // criteria operators 'crs' => [parent::V_LIST, [parent::ENUM_NONE, parent::ENUM_ANY, [0, 5000]], true ], // criteria operators
'crv' => [FILTER_V_REGEX, parent::PATTERN_CRV, true ], // criteria values 'crv' => [parent::V_REGEX, parent::PATTERN_CRV, true ], // criteria values
'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter 'na' => [parent::V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter
'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'ma' => [parent::V_EQUAL, 1, false], // match any / all filter
'ex' => [FILTER_V_EQUAL, 'on', false], // only match exact 'ex' => [parent::V_EQUAL, 'on', false], // only match exact
'si' => [FILTER_V_LIST, [1, 2], false], // side 'si' => [parent::V_LIST, [SIDE_ALLIANCE, SIDE_HORDE], false], // side
'ra' => [FILTER_V_LIST, [[1, 8], 10, 11], true ], // race 'ra' => [parent::V_LIST, [[1, 8], 10, 11], true ], // race
'cl' => [FILTER_V_LIST, [[1, 9], 11], true ], // class 'cl' => [parent::V_LIST, [[1, 9], 11], true ], // class
'minle' => [FILTER_V_RANGE, [1, MAX_LEVEL], false], // min level 'minle' => [parent::V_RANGE, [1, MAX_LEVEL], false], // min level
'maxle' => [FILTER_V_RANGE, [1, MAX_LEVEL], false], // max level 'maxle' => [parent::V_RANGE, [1, MAX_LEVEL], false], // max level
'rg' => [FILTER_V_CALLBACK, 'cbRegionCheck', false], // region 'rg' => [parent::V_CALLBACK, 'cbRegionCheck', false], // region
'sv' => [FILTER_V_CALLBACK, 'cbServerCheck', false], // server 'sv' => [parent::V_CALLBACK, 'cbServerCheck', false], // server
); );
/* heads up! /* heads up!
@@ -332,9 +332,9 @@ class ProfileListFilter extends Filter
// side [list] // side [list]
if (!empty($_v['si'])) if (!empty($_v['si']))
{ {
if ($_v['si'] == 1) if ($_v['si'] == SIDE_ALLIANCE)
$parts[] = [$k.'.race', [1, 3, 4, 7, 11]]; $parts[] = [$k.'.race', [1, 3, 4, 7, 11]];
else if ($_v['si'] == 2) else if ($_v['si'] == SIDE_HORDE)
$parts[] = [$k.'.race', [2, 5, 6, 8, 10]]; $parts[] = [$k.'.race', [2, 5, 6, 8, 10]];
} }
@@ -417,7 +417,7 @@ class ProfileListFilter extends Filter
if (!Util::checkNumeric($cr[2], NUM_CAST_INT)) if (!Util::checkNumeric($cr[2], NUM_CAST_INT))
return false; return false;
if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_achievement WHERE id = ?d', $cr[2])) if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_achievement WHERE `id` = ?d', $cr[2]))
return false; return false;
$k = 'acv_'.Util::createHash(12); $k = 'acv_'.Util::createHash(12);

View File

@@ -439,53 +439,53 @@ class QuestListFilter extends Filter
); );
protected $genericFilter = array( protected $genericFilter = array(
1 => [FILTER_CR_CALLBACK, 'cbReputation', '>', null], // increasesrepwith 1 => [parent::CR_CALLBACK, 'cbReputation', '>', null], // increasesrepwith
2 => [FILTER_CR_NUMERIC, 'rewardXP', NUM_CAST_INT ], // experiencegained 2 => [parent::CR_NUMERIC, 'rewardXP', NUM_CAST_INT ], // experiencegained
3 => [FILTER_CR_NUMERIC, 'rewardOrReqMoney', NUM_CAST_INT ], // moneyrewarded 3 => [parent::CR_NUMERIC, 'rewardOrReqMoney', NUM_CAST_INT ], // moneyrewarded
4 => [FILTER_CR_CALLBACK, 'cbSpellRewards', null, null], // spellrewarded [yn] 4 => [parent::CR_CALLBACK, 'cbSpellRewards', null, null], // spellrewarded [yn]
5 => [FILTER_CR_FLAG, 'flags', QUEST_FLAG_SHARABLE ], // sharable 5 => [parent::CR_FLAG, 'flags', QUEST_FLAG_SHARABLE ], // sharable
6 => [FILTER_CR_NUMERIC, 'timeLimit', NUM_CAST_INT ], // timer 6 => [parent::CR_NUMERIC, 'timeLimit', NUM_CAST_INT ], // timer
7 => [FILTER_CR_NYI_PH, null, 1 ], // firstquestseries 7 => [parent::CR_NYI_PH, null, 1 ], // firstquestseries
9 => [FILTER_CR_CALLBACK, 'cbEarnReputation', null, null], // objectiveearnrepwith [enum] 9 => [parent::CR_CALLBACK, 'cbEarnReputation', null, null], // objectiveearnrepwith [enum]
10 => [FILTER_CR_CALLBACK, 'cbReputation', '<', null], // decreasesrepwith 10 => [parent::CR_CALLBACK, 'cbReputation', '<', null], // decreasesrepwith
11 => [FILTER_CR_NUMERIC, 'suggestedPlayers', NUM_CAST_INT ], // suggestedplayers 11 => [parent::CR_NUMERIC, 'suggestedPlayers', NUM_CAST_INT ], // suggestedplayers
15 => [FILTER_CR_NYI_PH, null, 1 ], // lastquestseries 15 => [parent::CR_NYI_PH, null, 1 ], // lastquestseries
16 => [FILTER_CR_NYI_PH, null, 1 ], // partseries 16 => [parent::CR_NYI_PH, null, 1 ], // partseries
18 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots 18 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
19 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 0x1, null], // startsfrom [enum] 19 => [parent::CR_CALLBACK, 'cbQuestRelation', 0x1, null], // startsfrom [enum]
21 => [FILTER_CR_CALLBACK, 'cbQuestRelation', 0x2, null], // endsat [enum] 21 => [parent::CR_CALLBACK, 'cbQuestRelation', 0x2, null], // endsat [enum]
22 => [FILTER_CR_CALLBACK, 'cbItemRewards', null, null], // itemrewards [op] [int] 22 => [parent::CR_CALLBACK, 'cbItemRewards', null, null], // itemrewards [op] [int]
23 => [FILTER_CR_CALLBACK, 'cbItemChoices', null, null], // itemchoices [op] [int] 23 => [parent::CR_CALLBACK, 'cbItemChoices', null, null], // itemchoices [op] [int]
24 => [FILTER_CR_CALLBACK, 'cbLacksStartEnd', null, null], // lacksstartend [yn] 24 => [parent::CR_CALLBACK, 'cbLacksStartEnd', null, null], // lacksstartend [yn]
25 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 25 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
27 => [FILTER_CR_FLAG, 'flags', QUEST_FLAG_DAILY ], // daily 27 => [parent::CR_FLAG, 'flags', QUEST_FLAG_DAILY ], // daily
28 => [FILTER_CR_FLAG, 'flags', QUEST_FLAG_WEEKLY ], // weekly 28 => [parent::CR_FLAG, 'flags', QUEST_FLAG_WEEKLY ], // weekly
29 => [FILTER_CR_CALLBACK, 'cbRepeatable', null ], // repeatable 29 => [parent::CR_CALLBACK, 'cbRepeatable', null ], // repeatable
30 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true], // id 30 => [parent::CR_NUMERIC, 'id', NUM_CAST_INT, true], // id
33 => [FILTER_CR_ENUM, 'e.holidayId', true, true], // relatedevent 33 => [parent::CR_ENUM, 'e.holidayId', true, true], // relatedevent
34 => [FILTER_CR_CALLBACK, 'cbAvailable', null, null], // availabletoplayers [yn] 34 => [parent::CR_CALLBACK, 'cbAvailable', null, null], // availabletoplayers [yn]
36 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 36 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
37 => [FILTER_CR_CALLBACK, 'cbClassSpec', null, null], // classspecific [enum] 37 => [parent::CR_CALLBACK, 'cbClassSpec', null, null], // classspecific [enum]
38 => [FILTER_CR_CALLBACK, 'cbRaceSpec', null, null], // racespecific [enum] 38 => [parent::CR_CALLBACK, 'cbRaceSpec', null, null], // racespecific [enum]
42 => [FILTER_CR_STAFFFLAG, 'flags' ], // flags 42 => [parent::CR_STAFFFLAG, 'flags' ], // flags
43 => [FILTER_CR_CALLBACK, 'cbCurrencyReward', null, null], // currencyrewarded [enum] 43 => [parent::CR_CALLBACK, 'cbCurrencyReward', null, null], // currencyrewarded [enum]
44 => [FILTER_CR_CALLBACK, 'cbLoremaster', null, null], // countsforloremaster_stc [yn] 44 => [parent::CR_CALLBACK, 'cbLoremaster', null, null], // countsforloremaster_stc [yn]
45 => [FILTER_CR_BOOLEAN, 'rewardTitleId' ] // titlerewarded 45 => [parent::CR_BOOLEAN, 'rewardTitleId' ] // titlerewarded
); );
protected $inputFields = array( protected $inputFields = array(
'cr' => [FILTER_V_RANGE, [1, 45], true ], // criteria ids 'cr' => [parent::V_RANGE, [1, 45], true ], // criteria ids
'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 99999]], true ], // criteria operators 'crs' => [parent::V_LIST, [parent::ENUM_NONE, parent::ENUM_ANY, [0, 99999]], true ], // criteria operators
'crv' => [FILTER_V_REGEX, parent::PATTERN_INT, true ], // criteria values - only numerals 'crv' => [parent::V_REGEX, parent::PATTERN_INT, true ], // criteria values - only numerals
'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name / text - only printable chars, no delimiter 'na' => [parent::V_REGEX, parent::PATTERN_NAME, false], // name / text - only printable chars, no delimiter
'ex' => [FILTER_V_EQUAL, 'on', false], // also match subname 'ex' => [parent::V_EQUAL, 'on', false], // also match subname
'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'ma' => [parent::V_EQUAL, 1, false], // match any / all filter
'minle' => [FILTER_V_RANGE, [1, 99], false], // min quest level 'minle' => [parent::V_RANGE, [1, 99], false], // min quest level
'maxle' => [FILTER_V_RANGE, [1, 99], false], // max quest level 'maxle' => [parent::V_RANGE, [1, 99], false], // max quest level
'minrl' => [FILTER_V_RANGE, [1, 99], false], // min required level 'minrl' => [parent::V_RANGE, [1, 99], false], // min required level
'maxrl' => [FILTER_V_RANGE, [1, 99], false], // max required level 'maxrl' => [parent::V_RANGE, [1, 99], false], // max required level
'si' => [FILTER_V_LIST, [-2, -1, 1, 2, 3], false], // siede 'si' => [parent::V_LIST, [-SIDE_HORDE, -SIDE_ALLIANCE, SIDE_ALLIANCE, SIDE_HORDE, SIDE_BOTH], false], // side
'ty' => [FILTER_V_LIST, [0, 1, 21, 41, 62, [81, 85], 88, 89], true ] // type 'ty' => [parent::V_LIST, [0, 1, 21, 41, 62, [81, 85], 88, 89], true ] // type
); );
protected function createSQLForValues() protected function createSQLForValues()
@@ -530,19 +530,19 @@ class QuestListFilter extends Filter
switch ($_v['si']) switch ($_v['si'])
{ {
case 3: case SIDE_BOTH:
$parts[] = $notEx; $parts[] = $notEx;
break; break;
case 2: case SIDE_HORDE:
$parts[] = ['OR', $notEx, ['reqRaceMask', RACE_MASK_HORDE, '&']]; $parts[] = ['OR', $notEx, ['reqRaceMask', RACE_MASK_HORDE, '&']];
break; break;
case -2: case -SIDE_HORDE:
$parts[] = ['AND', $ex, ['reqRaceMask', RACE_MASK_HORDE, '&']]; $parts[] = ['AND', $ex, ['reqRaceMask', RACE_MASK_HORDE, '&']];
break; break;
case 1: case SIDE_ALLIANCE:
$parts[] = ['OR', $notEx, ['reqRaceMask', RACE_MASK_ALLIANCE, '&']]; $parts[] = ['OR', $notEx, ['reqRaceMask', RACE_MASK_ALLIANCE, '&']];
break; break;
case -1: case -SIDE_ALLIANCE:
$parts[] = ['AND', $ex, ['reqRaceMask', RACE_MASK_ALLIANCE, '&']]; $parts[] = ['AND', $ex, ['reqRaceMask', RACE_MASK_ALLIANCE, '&']];
break; break;
} }
@@ -563,7 +563,7 @@ class QuestListFilter extends Filter
if (!in_array($cr[1], $this->enums[$cr[0]])) if (!in_array($cr[1], $this->enums[$cr[0]]))
return false; return false;
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE id = ?d', $cr[1])) if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_factions WHERE `id` = ?d', $cr[1]))
$this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')]; $this->formData['reputationCols'][] = [$cr[1], Util::localizedString($_, 'name')];
return [ return [
@@ -578,17 +578,13 @@ class QuestListFilter extends Filter
protected function cbQuestRelation($cr, $flags) protected function cbQuestRelation($cr, $flags)
{ {
switch ($cr[1]) return match($cr[1])
{ {
case 1: // npc Type::NPC,
return ['AND', ['qse.type', Type::NPC], ['qse.method', $flags, '&']]; Type::OBJECT,
case 2: // object Type::ITEM => ['AND', ['qse.type', $cr[1]], ['qse.method', $flags, '&']],
return ['AND', ['qse.type', Type::OBJECT], ['qse.method', $flags, '&']]; default => false
case 3: // item };
return ['AND', ['qse.type', Type::ITEM], ['qse.method', $flags, '&']];
}
return false;
} }
protected function cbCurrencyReward($cr) protected function cbCurrencyReward($cr)
@@ -675,9 +671,9 @@ class QuestListFilter extends Filter
if (!Util::checkNumeric($cr[1], NUM_CAST_INT)) if (!Util::checkNumeric($cr[1], NUM_CAST_INT))
return false; return false;
if ($cr[1] == FILTER_ENUM_ANY) // any if ($cr[1] == parent::ENUM_ANY) // any
return ['OR', ['reqFactionId1', 0, '>'], ['reqFactionId2', 0, '>']]; return ['OR', ['reqFactionId1', 0, '>'], ['reqFactionId2', 0, '>']];
else if ($cr[1] == FILTER_ENUM_NONE) // none else if ($cr[1] == parent::ENUM_NONE) // none
return ['AND', ['reqFactionId1', 0], ['reqFactionId2', 0]]; return ['AND', ['reqFactionId1', 0], ['reqFactionId2', 0]];
else if (in_array($cr[1], $this->enums[$cr[0]])) else if (in_array($cr[1], $this->enums[$cr[0]]))
return ['OR', ['reqFactionId1', $cr[1]], ['reqFactionId2', $cr[1]]]; return ['OR', ['reqFactionId1', $cr[1]], ['reqFactionId2', $cr[1]]];
@@ -722,7 +718,7 @@ class QuestListFilter extends Filter
if (!$this->int2Bool($cr[1])) if (!$this->int2Bool($cr[1]))
return false; return false;
$missing = DB::Aowow()->selectCol('SELECT questId, max(method) a, min(method) b FROM ?_quests_startend GROUP BY questId HAVING (a | b) <> 3'); $missing = DB::Aowow()->selectCol('SELECT `questId`, BIT_OR(`method`) AS "se" FROM ?_quests_startend GROUP BY `questId` HAVING "se" <> 3');
if ($cr[1]) if ($cr[1])
return ['id', $missing]; return ['id', $missing];
else else

View File

@@ -43,12 +43,12 @@ class SoundList extends BaseType
if ($this->fileBuffer) if ($this->fileBuffer)
{ {
$files = DB::Aowow()->select('SELECT id AS ARRAY_KEY, `id`, `file` AS title, CAST(`type` AS UNSIGNED) AS type, `path` FROM ?_sounds_files sf WHERE id IN (?a)', array_keys($this->fileBuffer)); $files = DB::Aowow()->select('SELECT `id` AS ARRAY_KEY, `id`, `file` AS "title", CAST(`type` AS UNSIGNED) AS "type", `path` FROM ?_sounds_files sf WHERE `id` IN (?a)', array_keys($this->fileBuffer));
foreach ($files as $id => $data) foreach ($files as $id => $data)
{ {
// 3.3.5 bandaid - need fullpath to play via wow API, remove for cata and later // 3.3.5 bandaid - need fullpath to play via wow API, remove for cata and later
$data['path'] = str_replace('\\', '\\\\', $data['path'] ? $data['path'] . '\\' . $data['title'] : $data['title']); $data['path'] = str_replace('\\', '\\\\', $data['path'] ? $data['path'] . '\\' . $data['title'] : $data['title']);
// skipp file extension // skip file extension
$data['title'] = substr($data['title'], 0, -4); $data['title'] = substr($data['title'], 0, -4);
// enum to string // enum to string
$data['type'] = self::$fileTypes[$data['type']]; $data['type'] = self::$fileTypes[$data['type']];
@@ -97,8 +97,8 @@ class SoundList extends BaseType
class SoundListFilter extends Filter class SoundListFilter extends Filter
{ {
protected $inputFields = array( protected $inputFields = array(
'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter 'na' => [parent::V_REGEX, parent::PATTERN_NAME, false], // name - only printable chars, no delimiter
'ty' => [FILTER_V_LIST, [[1, 4], 6, 9, 10, 12, 13, 14, 16, 17, [19, 23], [25, 31], 50, 52, 53], true ] // type 'ty' => [parent::V_LIST, [[1, 4], 6, 9, 10, 12, 13, 14, 16, 17, [19, 23], [25, 31], 50, 52, 53], true ] // type
); );
protected function createSQLForValues() protected function createSQLForValues()

View File

@@ -2321,124 +2321,124 @@ class SpellListFilter extends Filter
); );
protected $genericFilter = array( protected $genericFilter = array(
1 => [FILTER_CR_CALLBACK, 'cbCost', ], // costAbs [op] [int] 1 => [parent::CR_CALLBACK, 'cbCost', ], // costAbs [op] [int]
2 => [FILTER_CR_NUMERIC, 'powerCostPercent', NUM_CAST_INT ], // prcntbasemanarequired 2 => [parent::CR_NUMERIC, 'powerCostPercent', NUM_CAST_INT ], // prcntbasemanarequired
3 => [FILTER_CR_BOOLEAN, 'spellFocusObject' ], // requiresnearbyobject 3 => [parent::CR_BOOLEAN, 'spellFocusObject' ], // requiresnearbyobject
4 => [FILTER_CR_NUMERIC, 'trainingcost', NUM_CAST_INT ], // trainingcost 4 => [parent::CR_NUMERIC, 'trainingcost', NUM_CAST_INT ], // trainingcost
5 => [FILTER_CR_BOOLEAN, 'reqSpellId' ], // requiresprofspec 5 => [parent::CR_BOOLEAN, 'reqSpellId' ], // requiresprofspec
8 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots 8 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
9 => [FILTER_CR_CALLBACK, 'cbSource', ], // source [enum] 9 => [parent::CR_CALLBACK, 'cbSource', ], // source [enum]
10 => [FILTER_CR_FLAG, 'cuFlags', SPELL_CU_FIRST_RANK ], // firstrank 10 => [parent::CR_FLAG, 'cuFlags', SPELL_CU_FIRST_RANK ], // firstrank
11 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments 11 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_COMMENT ], // hascomments
12 => [FILTER_CR_FLAG, 'cuFlags', SPELL_CU_LAST_RANK ], // lastrank 12 => [parent::CR_FLAG, 'cuFlags', SPELL_CU_LAST_RANK ], // lastrank
13 => [FILTER_CR_NUMERIC, 'rankNo', NUM_CAST_INT ], // rankno 13 => [parent::CR_NUMERIC, 'rankNo', NUM_CAST_INT ], // rankno
14 => [FILTER_CR_NUMERIC, 'id', NUM_CAST_INT, true ], // id 14 => [parent::CR_NUMERIC, 'id', NUM_CAST_INT, true ], // id
15 => [FILTER_CR_STRING, 'ic.name', ], // icon 15 => [parent::CR_STRING, 'ic.name', ], // icon
17 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos 17 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
19 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION ], // scaling 19 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION ], // scaling
20 => [FILTER_CR_CALLBACK, 'cbReagents', ], // has Reagents [yn] 20 => [parent::CR_CALLBACK, 'cbReagents', ], // has Reagents [yn]
// 22 => [FILTER_CR_NYI_PH, null, null, null ], // proficiencytype [proficiencytype] pointless // 22 => [parent::CR_NYI_PH, null, null, null ], // proficiencytype [proficiencytype] pointless
25 => [FILTER_CR_BOOLEAN, 'skillLevelYellow' ], // rewardsskillups 25 => [parent::CR_BOOLEAN, 'skillLevelYellow' ], // rewardsskillups
27 => [FILTER_CR_FLAG, 'attributes1', SPELL_ATTR1_CHANNELED_1, true ], // channeled [yn] 27 => [parent::CR_FLAG, 'attributes1', SPELL_ATTR1_CHANNELED_1, true ], // channeled [yn]
28 => [FILTER_CR_NUMERIC, 'castTime', NUM_CAST_FLOAT ], // casttime [num] 28 => [parent::CR_NUMERIC, 'castTime', NUM_CAST_FLOAT ], // casttime [num]
29 => [FILTER_CR_CALLBACK, 'cbAuraNames', ], // appliesaura [effectauranames] 29 => [parent::CR_CALLBACK, 'cbAuraNames', ], // appliesaura [effectauranames]
// 31 => [FILTER_CR_NYI_PH, null, null, null ], // usablewhenshapeshifted [yn] pointless // 31 => [parent::CR_NYI_PH, null, null, null ], // usablewhenshapeshifted [yn] pointless
33 => [FILTER_CR_CALLBACK, 'cbInverseFlag', 'attributes0', SPELL_ATTR0_CANT_USED_IN_COMBAT], // combatcastable [yn] 33 => [parent::CR_CALLBACK, 'cbInverseFlag', 'attributes0', SPELL_ATTR0_CANT_USED_IN_COMBAT], // combatcastable [yn]
34 => [FILTER_CR_CALLBACK, 'cbInverseFlag', 'attributes2', SPELL_ATTR2_CANT_CRIT ], // chancetocrit [yn] 34 => [parent::CR_CALLBACK, 'cbInverseFlag', 'attributes2', SPELL_ATTR2_CANT_CRIT ], // chancetocrit [yn]
35 => [FILTER_CR_CALLBACK, 'cbInverseFlag', 'attributes3', SPELL_ATTR3_IGNORE_HIT_RESULT ], // chancetomiss [yn] 35 => [parent::CR_CALLBACK, 'cbInverseFlag', 'attributes3', SPELL_ATTR3_IGNORE_HIT_RESULT ], // chancetomiss [yn]
36 => [FILTER_CR_FLAG, 'attributes3', SPELL_ATTR3_DEATH_PERSISTENT ], // persiststhroughdeath [yn] 36 => [parent::CR_FLAG, 'attributes3', SPELL_ATTR3_DEATH_PERSISTENT ], // persiststhroughdeath [yn]
38 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_ONLY_STEALTHED ], // requiresstealth [yn] 38 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_ONLY_STEALTHED ], // requiresstealth [yn]
39 => [FILTER_CR_CALLBACK, 'cbSpellstealable', 'attributes4', SPELL_ATTR4_NOT_STEALABLE ], // spellstealable [yn] 39 => [parent::CR_CALLBACK, 'cbSpellstealable', 'attributes4', SPELL_ATTR4_NOT_STEALABLE ], // spellstealable [yn]
40 => [FILTER_CR_ENUM, 'damageClass' ], // damagetype [damagetype] 40 => [parent::CR_ENUM, 'damageClass' ], // damagetype [damagetype]
41 => [FILTER_CR_FLAG, 'stanceMask', (1 << (22 - 1)) ], // requiresmetamorphosis [yn] 41 => [parent::CR_FLAG, 'stanceMask', (1 << (22 - 1)) ], // requiresmetamorphosis [yn]
42 => [FILTER_CR_FLAG, 'attributes5', SPELL_ATTR5_USABLE_WHILE_STUNNED ], // usablewhenstunned [yn] 42 => [parent::CR_FLAG, 'attributes5', SPELL_ATTR5_USABLE_WHILE_STUNNED ], // usablewhenstunned [yn]
44 => [FILTER_CR_CALLBACK, 'cbUsableInArena' ], // usableinarenas [yn] 44 => [parent::CR_CALLBACK, 'cbUsableInArena' ], // usableinarenas [yn]
45 => [FILTER_CR_ENUM, 'powerType' ], // resourcetype [resourcetype] 45 => [parent::CR_ENUM, 'powerType' ], // resourcetype [resourcetype]
// 46 => [FILTER_CR_NYI_PH, null, null, null ], // disregardimmunity [yn] // 46 => [parent::CR_NYI_PH, null, null, null ], // disregardimmunity [yn]
47 => [FILTER_CR_FLAG, 'attributes1', SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE ], // disregardschoolimmunity [yn] 47 => [parent::CR_FLAG, 'attributes1', SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE ], // disregardschoolimmunity [yn]
48 => [FILTER_CR_CALLBACK, 'cbEquippedWeapon', 0x0004000C, false ], // reqrangedweapon [yn] 48 => [parent::CR_CALLBACK, 'cbEquippedWeapon', 0x0004000C, false ], // reqrangedweapon [yn]
49 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_ON_NEXT_SWING ], // onnextswingplayers [yn] 49 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_ON_NEXT_SWING ], // onnextswingplayers [yn]
50 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_PASSIVE ], // passivespell [yn] 50 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_PASSIVE ], // passivespell [yn]
51 => [FILTER_CR_FLAG, 'attributes1', SPELL_ATTR1_DONT_DISPLAY_IN_AURA_BAR ], // hiddenaura [yn] 51 => [parent::CR_FLAG, 'attributes1', SPELL_ATTR1_DONT_DISPLAY_IN_AURA_BAR ], // hiddenaura [yn]
52 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_ON_NEXT_SWING_2 ], // onnextswingnpcs [yn] 52 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_ON_NEXT_SWING_2 ], // onnextswingnpcs [yn]
53 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_DAYTIME_ONLY ], // daytimeonly [yn] 53 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_DAYTIME_ONLY ], // daytimeonly [yn]
54 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_NIGHT_ONLY ], // nighttimeonly [yn] 54 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_NIGHT_ONLY ], // nighttimeonly [yn]
55 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_INDOORS_ONLY ], // indoorsonly [yn] 55 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_INDOORS_ONLY ], // indoorsonly [yn]
56 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_OUTDOORS_ONLY ], // outdoorsonly [yn] 56 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_OUTDOORS_ONLY ], // outdoorsonly [yn]
57 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_CANT_CANCEL ], // uncancellableaura [yn] 57 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_CANT_CANCEL ], // uncancellableaura [yn]
58 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION ], // damagedependsonlevel [yn] 58 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION ], // damagedependsonlevel [yn]
59 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_STOP_ATTACK_TARGET ], // stopsautoattack [yn] 59 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_STOP_ATTACK_TARGET ], // stopsautoattack [yn]
60 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_IMPOSSIBLE_DODGE_PARRY_BLOCK ], // cannotavoid [yn] 60 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_IMPOSSIBLE_DODGE_PARRY_BLOCK ], // cannotavoid [yn]
61 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_CASTABLE_WHILE_DEAD ], // usabledead [yn] 61 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_CASTABLE_WHILE_DEAD ], // usabledead [yn]
62 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_CASTABLE_WHILE_MOUNTED ], // usablemounted [yn] 62 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_CASTABLE_WHILE_MOUNTED ], // usablemounted [yn]
63 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_DISABLED_WHILE_ACTIVE ], // delayedrecoverystarttime [yn] 63 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_DISABLED_WHILE_ACTIVE ], // delayedrecoverystarttime [yn]
64 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_CASTABLE_WHILE_SITTING ], // usablesitting [yn] 64 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_CASTABLE_WHILE_SITTING ], // usablesitting [yn]
65 => [FILTER_CR_FLAG, 'attributes1', SPELL_ATTR1_DRAIN_ALL_POWER ], // usesallpower [yn] 65 => [parent::CR_FLAG, 'attributes1', SPELL_ATTR1_DRAIN_ALL_POWER ], // usesallpower [yn]
66 => [FILTER_CR_FLAG, 'attributes1', SPELL_ATTR1_CHANNELED_2, true ], // channeled [yn] 66 => [parent::CR_FLAG, 'attributes1', SPELL_ATTR1_CHANNELED_2, true ], // channeled [yn]
67 => [FILTER_CR_FLAG, 'attributes1', SPELL_ATTR1_CANT_BE_REFLECTED ], // cannotreflect [yn] 67 => [parent::CR_FLAG, 'attributes1', SPELL_ATTR1_CANT_BE_REFLECTED ], // cannotreflect [yn]
68 => [FILTER_CR_FLAG, 'attributes1', SPELL_ATTR1_NOT_BREAK_STEALTH ], // usablestealthed [yn] 68 => [parent::CR_FLAG, 'attributes1', SPELL_ATTR1_NOT_BREAK_STEALTH ], // usablestealthed [yn]
69 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_NEGATIVE_1 ], // harmful [yn] 69 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_NEGATIVE_1 ], // harmful [yn]
70 => [FILTER_CR_FLAG, 'attributes1', SPELL_ATTR1_CANT_TARGET_IN_COMBAT ], // targetnotincombat [yn] 70 => [parent::CR_FLAG, 'attributes1', SPELL_ATTR1_CANT_TARGET_IN_COMBAT ], // targetnotincombat [yn]
71 => [FILTER_CR_FLAG, 'attributes1', SPELL_ATTR1_NO_THREAT ], // nothreat [yn] 71 => [parent::CR_FLAG, 'attributes1', SPELL_ATTR1_NO_THREAT ], // nothreat [yn]
72 => [FILTER_CR_FLAG, 'attributes1', SPELL_ATTR1_IS_PICKPOCKET ], // pickpocket [yn] 72 => [parent::CR_FLAG, 'attributes1', SPELL_ATTR1_IS_PICKPOCKET ], // pickpocket [yn]
73 => [FILTER_CR_FLAG, 'attributes1', SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY ], // dispelauraonimmunity [yn] 73 => [parent::CR_FLAG, 'attributes1', SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY ], // dispelauraonimmunity [yn]
74 => [FILTER_CR_CALLBACK, 'cbEquippedWeapon', 0x00100000, false ], // reqfishingpole [yn] 74 => [parent::CR_CALLBACK, 'cbEquippedWeapon', 0x00100000, false ], // reqfishingpole [yn]
75 => [FILTER_CR_FLAG, 'attributes2', SPELL_ATTR2_CANT_TARGET_TAPPED ], // requntappedtarget [yn] 75 => [parent::CR_FLAG, 'attributes2', SPELL_ATTR2_CANT_TARGET_TAPPED ], // requntappedtarget [yn]
// 76 => [FILTER_CR_NYI_PH, null, null, null ], // targetownitem [yn] // the flag for this has to be somewhere.... // 76 => [parent::CR_NYI_PH, null, null, null ], // targetownitem [yn] // the flag for this has to be somewhere....
77 => [FILTER_CR_FLAG, 'attributes2', SPELL_ATTR2_NOT_NEED_SHAPESHIFT ], // doesntreqshapeshift [yn] 77 => [parent::CR_FLAG, 'attributes2', SPELL_ATTR2_NOT_NEED_SHAPESHIFT ], // doesntreqshapeshift [yn]
78 => [FILTER_CR_FLAG, 'attributes2', SPELL_ATTR2_FOOD_BUFF ], // foodbuff [yn] 78 => [parent::CR_FLAG, 'attributes2', SPELL_ATTR2_FOOD_BUFF ], // foodbuff [yn]
79 => [FILTER_CR_FLAG, 'attributes3', SPELL_ATTR3_ONLY_TARGET_PLAYERS ], // targetonlyplayer [yn] 79 => [parent::CR_FLAG, 'attributes3', SPELL_ATTR3_ONLY_TARGET_PLAYERS ], // targetonlyplayer [yn]
80 => [FILTER_CR_CALLBACK, 'cbEquippedWeapon', 1 << INVTYPE_WEAPONMAINHAND, true ], // reqmainhand [yn] 80 => [parent::CR_CALLBACK, 'cbEquippedWeapon', 1 << INVTYPE_WEAPONMAINHAND, true ], // reqmainhand [yn]
81 => [FILTER_CR_FLAG, 'attributes3', SPELL_ATTR3_NO_INITIAL_AGGRO ], // doesntengagetarget [yn] 81 => [parent::CR_FLAG, 'attributes3', SPELL_ATTR3_NO_INITIAL_AGGRO ], // doesntengagetarget [yn]
82 => [FILTER_CR_CALLBACK, 'cbEquippedWeapon', 0x00080000, false ], // reqwand [yn] 82 => [parent::CR_CALLBACK, 'cbEquippedWeapon', 0x00080000, false ], // reqwand [yn]
83 => [FILTER_CR_CALLBACK, 'cbEquippedWeapon', 1 << INVTYPE_WEAPONOFFHAND, true ], // reqoffhand [yn] 83 => [parent::CR_CALLBACK, 'cbEquippedWeapon', 1 << INVTYPE_WEAPONOFFHAND, true ], // reqoffhand [yn]
84 => [FILTER_CR_FLAG, 'attributes0', SPELL_ATTR0_HIDE_IN_COMBAT_LOG ], // nolog [yn] 84 => [parent::CR_FLAG, 'attributes0', SPELL_ATTR0_HIDE_IN_COMBAT_LOG ], // nolog [yn]
85 => [FILTER_CR_FLAG, 'attributes4', SPELL_ATTR4_FADES_WHILE_LOGGED_OUT ], // auratickswhileloggedout [yn] 85 => [parent::CR_FLAG, 'attributes4', SPELL_ATTR4_FADES_WHILE_LOGGED_OUT ], // auratickswhileloggedout [yn]
87 => [FILTER_CR_FLAG, 'attributes5', SPELL_ATTR5_START_PERIODIC_AT_APPLY ], // startstickingatapplication [yn] 87 => [parent::CR_FLAG, 'attributes5', SPELL_ATTR5_START_PERIODIC_AT_APPLY ], // startstickingatapplication [yn]
88 => [FILTER_CR_FLAG, 'attributes5', SPELL_ATTR5_USABLE_WHILE_CONFUSED ], // usableconfused [yn] 88 => [parent::CR_FLAG, 'attributes5', SPELL_ATTR5_USABLE_WHILE_CONFUSED ], // usableconfused [yn]
89 => [FILTER_CR_FLAG, 'attributes5', SPELL_ATTR5_USABLE_WHILE_FEARED ], // usablefeared [yn] 89 => [parent::CR_FLAG, 'attributes5', SPELL_ATTR5_USABLE_WHILE_FEARED ], // usablefeared [yn]
90 => [FILTER_CR_FLAG, 'attributes6', SPELL_ATTR6_ONLY_IN_ARENA ], // onlyarena [yn] 90 => [parent::CR_FLAG, 'attributes6', SPELL_ATTR6_ONLY_IN_ARENA ], // onlyarena [yn]
91 => [FILTER_CR_FLAG, 'attributes6', SPELL_ATTR6_NOT_IN_RAID_INSTANCE ], // notinraid [yn] 91 => [parent::CR_FLAG, 'attributes6', SPELL_ATTR6_NOT_IN_RAID_INSTANCE ], // notinraid [yn]
92 => [FILTER_CR_FLAG, 'attributes7', SPELL_ATTR7_REACTIVATE_AT_RESURRECT ], // paladinaura [yn] 92 => [parent::CR_FLAG, 'attributes7', SPELL_ATTR7_REACTIVATE_AT_RESURRECT ], // paladinaura [yn]
93 => [FILTER_CR_FLAG, 'attributes7', SPELL_ATTR7_SUMMON_PLAYER_TOTEM ], // totemspell [yn] 93 => [parent::CR_FLAG, 'attributes7', SPELL_ATTR7_SUMMON_PLAYER_TOTEM ], // totemspell [yn]
95 => [FILTER_CR_CALLBACK, 'cbBandageSpell' ], // bandagespell [yn] ...don't ask 95 => [parent::CR_CALLBACK, 'cbBandageSpell' ], // bandagespell [yn] ...don't ask
96 => [FILTER_CR_STAFFFLAG, 'attributes0' ], // flags1 [flags] 96 => [parent::CR_STAFFFLAG, 'attributes0' ], // flags1 [flags]
97 => [FILTER_CR_STAFFFLAG, 'attributes1' ], // flags2 [flags] 97 => [parent::CR_STAFFFLAG, 'attributes1' ], // flags2 [flags]
98 => [FILTER_CR_STAFFFLAG, 'attributes2' ], // flags3 [flags] 98 => [parent::CR_STAFFFLAG, 'attributes2' ], // flags3 [flags]
99 => [FILTER_CR_STAFFFLAG, 'attributes3' ], // flags4 [flags] 99 => [parent::CR_STAFFFLAG, 'attributes3' ], // flags4 [flags]
100 => [FILTER_CR_STAFFFLAG, 'attributes4' ], // flags5 [flags] 100 => [parent::CR_STAFFFLAG, 'attributes4' ], // flags5 [flags]
101 => [FILTER_CR_STAFFFLAG, 'attributes5' ], // flags6 [flags] 101 => [parent::CR_STAFFFLAG, 'attributes5' ], // flags6 [flags]
102 => [FILTER_CR_STAFFFLAG, 'attributes6' ], // flags7 [flags] 102 => [parent::CR_STAFFFLAG, 'attributes6' ], // flags7 [flags]
103 => [FILTER_CR_STAFFFLAG, 'attributes7' ], // flags8 [flags] 103 => [parent::CR_STAFFFLAG, 'attributes7' ], // flags8 [flags]
104 => [FILTER_CR_STAFFFLAG, 'targets' ], // flags9 [flags] 104 => [parent::CR_STAFFFLAG, 'targets' ], // flags9 [flags]
105 => [FILTER_CR_STAFFFLAG, 'stanceMaskNot' ], // flags10 [flags] 105 => [parent::CR_STAFFFLAG, 'stanceMaskNot' ], // flags10 [flags]
106 => [FILTER_CR_STAFFFLAG, 'spellFamilyFlags1' ], // flags11 [flags] 106 => [parent::CR_STAFFFLAG, 'spellFamilyFlags1' ], // flags11 [flags]
107 => [FILTER_CR_STAFFFLAG, 'spellFamilyFlags2' ], // flags12 [flags] 107 => [parent::CR_STAFFFLAG, 'spellFamilyFlags2' ], // flags12 [flags]
108 => [FILTER_CR_STAFFFLAG, 'spellFamilyFlags3' ], // flags13 [flags] 108 => [parent::CR_STAFFFLAG, 'spellFamilyFlags3' ], // flags13 [flags]
109 => [FILTER_CR_CALLBACK, 'cbEffectNames', ], // effecttype [effecttype] 109 => [parent::CR_CALLBACK, 'cbEffectNames', ], // effecttype [effecttype]
// 110 => [FILTER_CR_NYI_PH, null, null, null ], // scalingap [yn] // unreasonably complex for now // 110 => [parent::CR_NYI_PH, null, null, null ], // scalingap [yn] // unreasonably complex for now
// 111 => [FILTER_CR_NYI_PH, null, null, null ], // scalingsp [yn] // unreasonably complex for now // 111 => [parent::CR_NYI_PH, null, null, null ], // scalingsp [yn] // unreasonably complex for now
114 => [FILTER_CR_CALLBACK, 'cbReqFaction' ], // requiresfaction [side] 114 => [parent::CR_CALLBACK, 'cbReqFaction' ], // requiresfaction [side]
116 => [FILTER_CR_BOOLEAN, 'startRecoveryTime' ] // onGlobalCooldown [yn] 116 => [parent::CR_BOOLEAN, 'startRecoveryTime' ] // onGlobalCooldown [yn]
); );
protected $inputFields = array( protected $inputFields = array(
'cr' => [FILTER_V_RANGE, [1, 116], true ], // criteria ids 'cr' => [parent::V_RANGE, [1, 116], true ], // criteria ids
'crs' => [FILTER_V_LIST, [FILTER_ENUM_NONE, FILTER_ENUM_ANY, [0, 99999]], true ], // criteria operators 'crs' => [parent::V_LIST, [parent::ENUM_NONE, parent::ENUM_ANY, [0, 99999]], true ], // criteria operators
'crv' => [FILTER_V_REGEX, parent::PATTERN_CRV, true ], // criteria values - only printable chars, no delimiters 'crv' => [parent::V_REGEX, parent::PATTERN_CRV, true ], // criteria values - only printable chars, no delimiters
'na' => [FILTER_V_REGEX, parent::PATTERN_NAME, false], // name / text - only printable chars, no delimiter 'na' => [parent::V_REGEX, parent::PATTERN_NAME, false], // name / text - only printable chars, no delimiter
'ex' => [FILTER_V_EQUAL, 'on', false], // extended name search 'ex' => [parent::V_EQUAL, 'on', false], // extended name search
'ma' => [FILTER_V_EQUAL, 1, false], // match any / all filter 'ma' => [parent::V_EQUAL, 1, false], // match any / all filter
'minle' => [FILTER_V_RANGE, [1, 99], false], // spell level min 'minle' => [parent::V_RANGE, [1, 99], false], // spell level min
'maxle' => [FILTER_V_RANGE, [1, 99], false], // spell level max 'maxle' => [parent::V_RANGE, [1, 99], false], // spell level max
'minrs' => [FILTER_V_RANGE, [1, 999], false], // required skill level min 'minrs' => [parent::V_RANGE, [1, 999], false], // required skill level min
'maxrs' => [FILTER_V_RANGE, [1, 999], false], // required skill level max 'maxrs' => [parent::V_RANGE, [1, 999], false], // required skill level max
'ra' => [FILTER_V_LIST, [[1, 8], 10, 11], false], // races 'ra' => [parent::V_LIST, [[1, 8], 10, 11], false], // races
'cl' => [FILTER_V_CALLBACK, 'cbClasses', true ], // classes 'cl' => [parent::V_CALLBACK, 'cbClasses', true ], // classes
'gl' => [FILTER_V_CALLBACK, 'cbGlyphs', true ], // glyph type 'gl' => [parent::V_CALLBACK, 'cbGlyphs', true ], // glyph type
'sc' => [FILTER_V_RANGE, [0, 6], true ], // magic schools 'sc' => [parent::V_RANGE, [0, 6], true ], // magic schools
'dt' => [FILTER_V_LIST, [[1, 6], 9], false], // dispel types 'dt' => [parent::V_LIST, [[1, 6], 9], false], // dispel types
'me' => [FILTER_V_RANGE, [1, 31], false] // mechanics 'me' => [parent::V_RANGE, [1, 31], false] // mechanics
); );
protected function createSQLForValues() protected function createSQLForValues()
@@ -2515,7 +2515,7 @@ class SpellListFilter extends Filter
if (!Util::checkNumeric($val, NUM_CAST_INT)) if (!Util::checkNumeric($val, NUM_CAST_INT))
return false; return false;
$type = FILTER_V_LIST; $type = parent::V_LIST;
$valid = [[1, 9], 11]; $valid = [[1, 9], 11];
return $this->checkInput($type, $valid, $val); return $this->checkInput($type, $valid, $val);
@@ -2529,7 +2529,7 @@ class SpellListFilter extends Filter
if (!Util::checkNumeric($val, NUM_CAST_INT)) if (!Util::checkNumeric($val, NUM_CAST_INT))
return false; return false;
$type = FILTER_V_LIST; $type = parent::V_LIST;
$valid = [1, 2]; $valid = [1, 2];
return $this->checkInput($type, $valid, $val); return $this->checkInput($type, $valid, $val);
@@ -2575,7 +2575,7 @@ class SpellListFilter extends Filter
protected function cbAuraNames($cr) protected function cbAuraNames($cr)
{ {
if (!$this->checkInput(FILTER_V_RANGE, [1, self::MAX_SPELL_AURA], $cr[1])) if (!$this->checkInput(parent::V_RANGE, [1, self::MAX_SPELL_AURA], $cr[1]))
return false; return false;
return ['OR', ['effect1AuraId', $cr[1]], ['effect2AuraId', $cr[1]], ['effect3AuraId', $cr[1]]]; return ['OR', ['effect1AuraId', $cr[1]], ['effect2AuraId', $cr[1]], ['effect3AuraId', $cr[1]]];
@@ -2583,7 +2583,7 @@ class SpellListFilter extends Filter
protected function cbEffectNames($cr) protected function cbEffectNames($cr)
{ {
if (!$this->checkInput(FILTER_V_RANGE, [1, self::MAX_SPELL_EFFECT], $cr[1])) if (!$this->checkInput(parent::V_RANGE, [1, self::MAX_SPELL_EFFECT], $cr[1]))
return false; return false;
return ['OR', ['effect1Id', $cr[1]], ['effect2Id', $cr[1]], ['effect3Id', $cr[1]]]; return ['OR', ['effect1Id', $cr[1]], ['effect2Id', $cr[1]], ['effect3Id', $cr[1]]];
@@ -2606,9 +2606,9 @@ class SpellListFilter extends Filter
return false; return false;
if ($cr[1]) if ($cr[1])
return ['AND', [[$field, $flag, '&'], 0], ['dispelType', 1]]; return ['AND', [[$field, $flag, '&'], 0], ['dispelType', SPELL_DAMAGE_CLASS_MAGIC]];
else else
return ['OR', [$field, $flag, '&'], ['dispelType', 1, '!']]; return ['OR', [$field, $flag, '&'], ['dispelType', SPELL_DAMAGE_CLASS_MAGIC, '!']];
} }
protected function cbReqFaction($cr) protected function cbReqFaction($cr)

View File

@@ -966,7 +966,7 @@ abstract class Util
} }
// doesn't handle scientific notation .. why would you input 3e3 for 3000..? // doesn't handle scientific notation .. why would you input 3e3 for 3000..?
public static function checkNumeric(&$data, $typeCast = NUM_ANY) : bool public static function checkNumeric(mixed &$data, int $typeCast = NUM_ANY) : bool
{ {
if ($data === null) if ($data === null)
return false; return false;
@@ -1770,7 +1770,7 @@ abstract class Type
public static function getJSGlobalTemplate(int $type) : array public static function getJSGlobalTemplate(int $type) : array
{ {
if (!self::exists($type)) if (!self::exists($type) || !self::$data[$type][self::IDX_JSG_TPL])
return []; return [];
// [key, [data], [extraData]] // [key, [data], [extraData]]

View File

@@ -2288,7 +2288,7 @@ class SpellPage extends GenericPage
{ {
$cbBandageSpell = function() $cbBandageSpell = function()
{ {
return ($this->subject->getField('attributes1') & 0x00004044) && ($this->subject->getField('effect1ImplicitTargetA') == 21); return ($this->subject->getField('attributes1') & (SPELL_ATTR1_CHANNELED_1 | SPELL_ATTR1_CHANNELED_2 | SPELL_ATTR1_CHANNEL_TRACK_TARGET)) && ($this->subject->getField('effect1ImplicitTargetA') == 21);
}; };
$cbInverseFlag = function($field, $flag) $cbInverseFlag = function($field, $flag)
@@ -2305,7 +2305,7 @@ class SpellPage extends GenericPage
$cbSpellstealable = function($field, $flag) $cbSpellstealable = function($field, $flag)
{ {
return !($this->subject->getField($field) & $flag) && ($this->subject->getField('dispelType') == 1); return !($this->subject->getField($field) & $flag) && ($this->subject->getField('dispelType') == SPELL_DAMAGE_CLASS_MAGIC);
}; };
$list = []; $list = [];
@@ -2314,14 +2314,14 @@ class SpellPage extends GenericPage
{ {
if ($cr = $fi->getGenericFilter($idx)) if ($cr = $fi->getGenericFilter($idx))
{ {
if ($cr[0] == FILTER_CR_CALLBACK) if ($cr[0] == Filter::CR_CALLBACK)
{ {
if (!isset($cr[1])) if (!isset($cr[1]))
trigger_error('SpellDetailPage::createAttributesList - callback handler '.$cr[1].' not defined for IDX #'.$idx, E_USER_WARNING); trigger_error('SpellDetailPage::createAttributesList - callback handler '.$cr[1].' not defined for IDX #'.$idx, E_USER_WARNING);
else if (${$cr[1]}($cr[2] ?? null, $cr[3] ?? null)) else if (${$cr[1]}($cr[2] ?? null, $cr[3] ?? null))
$list[] = $idx; $list[] = $idx;
} }
else if ($cr[0] == FILTER_CR_FLAG) else if ($cr[0] == Filter::CR_FLAG)
{ {
if ($this->subject->getField($cr[1]) & $cr[2]) if ($this->subject->getField($cr[1]) & $cr[2])
$list[] = $idx; $list[] = $idx;