MySQL/Compat

* fixed several deprecation notices and warnings from MySQL8, most notably:
   - SQL_CALC_FOUND_ROWS: stopped using DBSimple::selectPage and query 'SELECT COUNT(*) ...' separately where needed
   - ON DUPLICATE KEY UPDATE ... VALUES(): use row alias for new values instead of VALUES function
   - boolean shorthands to long form (&& -> AND, etc)
This commit is contained in:
Sarjuuk
2024-07-31 00:40:11 +02:00
parent 1b2b773663
commit 481a3dc63f
49 changed files with 250 additions and 197 deletions

View File

@@ -55,12 +55,15 @@ abstract class BaseType
* results in * results in
* WHERE ((`id` = 45) OR (`name` NOT LIKE "test%") OR ((`flags` & 255) AND (`flags2` & 15)) OR ((`mask` & 3) = 0)) OR (`joinedTbl`.`field` IS NULL) LIMIT 5 * WHERE ((`id` = 45) OR (`name` NOT LIKE "test%") OR ((`flags` & 255) AND (`flags2` & 15)) OR ((`mask` & 3) = 0)) OR (`joinedTbl`.`field` IS NULL) LIMIT 5
*/ */
public function __construct($conditions = [], $miscData = null) public function __construct(array $conditions = [], array $miscData = [])
{ {
$where = []; $where = [];
$linking = ' AND '; $linking = ' AND ';
$limit = Cfg::get('SQL_LIMIT_DEFAULT'); $limit = Cfg::get('SQL_LIMIT_DEFAULT');
$calcTotal = false;
$totalQuery = '';
if (!$this->queryBase || $conditions === null) if (!$this->queryBase || $conditions === null)
return; return;
@@ -70,10 +73,13 @@ abstract class BaseType
else else
$prefixes['base'] = ''; $prefixes['base'] = '';
if ($miscData && !empty($miscData['extraOpts'])) if (!empty($miscData['extraOpts']))
$this->extendQueryOpts($miscData['extraOpts']); $this->extendQueryOpts($miscData['extraOpts']);
$resolveCondition = function ($c, $supLink) use (&$resolveCondition, &$prefixes, $miscData) if (!empty($miscData['calcTotal']))
$calcTotal = true;
$resolveCondition = function ($c, $supLink) use (&$resolveCondition, &$prefixes)
{ {
$subLink = ''; $subLink = '';
@@ -253,20 +259,28 @@ abstract class BaseType
if ($o = array_filter(array_column($this->queryOpts, 'o'))) if ($o = array_filter(array_column($this->queryOpts, 'o')))
$this->queryBase .= ' ORDER BY '.implode(', ', $o); $this->queryBase .= ' ORDER BY '.implode(', ', $o);
// without applied LIMIT
if ($calcTotal)
$totalQuery = $this->queryBase;
// apply limit // apply limit
if ($limit) if ($limit)
$this->queryBase .= ' LIMIT '.$limit; $this->queryBase .= ' LIMIT '.$limit;
// execute query (finally) // execute query (finally)
$mtch = 0;
$rows = []; $rows = [];
// this is purely because of multiple realms per server // this is purely because of multiple realms per server
foreach ($this->dbNames as $dbIdx => $n) foreach ($this->dbNames as $dbIdx => $n)
{ {
$query = str_replace('DB_IDX', $dbIdx, $this->queryBase); $query = str_replace('DB_IDX', $dbIdx, $this->queryBase);
if ($rows = DB::{$n}($dbIdx)->SelectPage($mtch, $query)) if ($rows = DB::{$n}($dbIdx)->select($query))
{ {
$this->matches += $mtch; if ($calcTotal)
{
$totalQuery = substr_replace($totalQuery, 'SELECT COUNT(*) ', 0, strpos($totalQuery, 'FROM'));
$this->matches += DB::{$n}($dbIdx)->selectCell($totalQuery);
}
foreach ($rows as $id => $row) foreach ($rows as $id => $row)
{ {
if (isset($this->templates[$id])) if (isset($this->templates[$id]))

View File

@@ -40,7 +40,7 @@ class CommunityContent
WHERE c.`replyTo` = ?d AND c.`type` = ?d AND c.`typeId` = ?d AND WHERE c.`replyTo` = ?d AND c.`type` = ?d AND c.`typeId` = ?d AND
((c.`flags` & ?d) = 0 OR c.`userId` = ?d OR ?d) ((c.`flags` & ?d) = 0 OR c.`userId` = ?d OR ?d)
GROUP BY c.`id` GROUP BY c.`id`
ORDER BY `date` ASC'; ORDER BY c.`date` ASC';
private static string $ssQuery = private static string $ssQuery =
'SELECT s.`id` AS ARRAY_KEY, s.`id`, a.`displayName` AS `user`, s.`date`, s.`width`, s.`height`, s.`caption`, IF(s.`status` & ?d, 1, 0) AS "sticky", s.`type`, s.`typeId` 'SELECT s.`id` AS ARRAY_KEY, s.`id`, a.`displayName` AS `user`, s.`date`, s.`width`, s.`height`, s.`caption`, IF(s.`status` & ?d, 1, 0) AS "sticky", s.`type`, s.`typeId`
@@ -75,8 +75,8 @@ class CommunityContent
WHERE %s WHERE %s
((c.`flags` & ?d) = 0 OR c.`userId` = ?d OR ?d) ((c.`flags` & ?d) = 0 OR c.`userId` = ?d OR ?d)
GROUP BY c.`id` GROUP BY c.`id`
ORDER BY `date` DESC ORDER BY c.`date` DESC
LIMIT ?d'; { LIMIT ?d }';
private static function addSubject(int $type, int $typeId) : void private static function addSubject(int $type, int $typeId) : void
{ {
@@ -123,9 +123,10 @@ class CommunityContent
// else // else
// pick both and no extra constraint needed for that // pick both and no extra constraint needed for that
$comments = DB::Aowow()->selectPage( $query = sprintf(self::$previewQuery, implode(' ', $w));
$nFound,
sprintf(self::$previewQuery, implode(' ', $w)), $comments = DB::Aowow()->select(
$query,
CC_FLAG_DELETED, CC_FLAG_DELETED,
CC_FLAG_DELETED, CC_FLAG_DELETED,
User::$id, User::$id,
@@ -133,6 +134,18 @@ class CommunityContent
Cfg::get('SQL_LIMIT_DEFAULT') Cfg::get('SQL_LIMIT_DEFAULT')
); );
if (!$comments)
return [];
$nFound = DB::Aowow()->selectCell(
substr_replace($query, 'SELECT COUNT(*) ', 0, strpos($query, 'FROM')),
CC_FLAG_DELETED,
CC_FLAG_DELETED,
User::$id,
User::isInGroup(U_GROUP_COMMENTS_MODERATOR),
DBSIMPLE_SKIP
);
foreach ($comments as $c) foreach ($comments as $c)
self::addSubject($c['type'], $c['typeId']); self::addSubject($c['type'], $c['typeId']);
@@ -172,31 +185,38 @@ class CommunityContent
$query = $limit > 0 ? self::$coQuery.' LIMIT '.$limit : self::$coQuery; $query = $limit > 0 ? self::$coQuery.' LIMIT '.$limit : self::$coQuery;
// get replies // get replies
$results = DB::Aowow()->selectPage($nFound, $query, User::$id, RATING_COMMENT, Report::MODE_COMMENT, User::$id, $commentId, 0, 0, CC_FLAG_DELETED, User::$id, User::isInGroup(U_GROUP_COMMENTS_MODERATOR)); if ($results = DB::Aowow()->select($query, User::$id, RATING_COMMENT, Report::MODE_COMMENT, User::$id, $commentId, 0, 0, CC_FLAG_DELETED, User::$id, User::isInGroup(U_GROUP_COMMENTS_MODERATOR)))
foreach ($results as $r)
{ {
(new Markup($r['body']))->parseGlobalsFromText(self::$jsGlobals); $nFound = DB::Aowow()->selectCell(
substr_replace(self::$coQuery, 'SELECT COUNT(*) ', 0, strpos(self::$coQuery, 'FROM')),
$reply = array( User::$id, RATING_COMMENT, Report::MODE_COMMENT, User::$id, $commentId, 0, 0, CC_FLAG_DELETED, User::$id, User::isInGroup(U_GROUP_COMMENTS_MODERATOR)
'commentid' => $commentId,
'id' => $r['id'],
'body' => $r['body'],
'username' => $r['user'],
'roles' => $r['roles'],
'creationdate' => date(Util::$dateFormatInternal, $r['date']),
'lasteditdate' => date(Util::$dateFormatInternal, $r['editDate']),
'rating' => (string)$r['rating']
); );
if ($r['userReported']) foreach ($results as $r)
$reply['reportedByUser'] = true; {
(new Markup($r['body']))->parseGlobalsFromText(self::$jsGlobals);
if ($r['userRating'] > 0) $reply = array(
$reply['votedByUser'] = true; 'commentid' => $commentId,
else if ($r['userRating'] < 0) 'id' => $r['id'],
$reply['downvotedByUser'] = true; 'body' => $r['body'],
'username' => $r['user'],
'roles' => $r['roles'],
'creationdate' => date(Util::$dateFormatInternal, $r['date']),
'lasteditdate' => date(Util::$dateFormatInternal, $r['editDate']),
'rating' => (string)$r['rating']
);
$replies[] = $reply; if ($r['userReported'])
$reply['reportedByUser'] = true;
if ($r['userRating'] > 0)
$reply['votedByUser'] = true;
else if ($r['userRating'] < 0)
$reply['downvotedByUser'] = true;
$replies[] = $reply;
}
} }
return $replies; return $replies;
@@ -383,9 +403,9 @@ class CommunityContent
return $comments; return $comments;
} }
public static function getVideos(int $typeOrUser = 0, int $typeId = 0, int &$nFound = 0, bool $dateFmt = true) : array public static function getVideos(int $typeOrUser = 0, int $typeId = 0, ?int &$nFound = 0, bool $dateFmt = true) : array
{ {
$videos = DB::Aowow()->selectPage($nFound, self::$viQuery, $videos = DB::Aowow()->select(self::$viQuery,
CC_FLAG_STICKY, CC_FLAG_STICKY,
$typeOrUser < 0 ? -$typeOrUser : DBSIMPLE_SKIP, $typeOrUser < 0 ? -$typeOrUser : DBSIMPLE_SKIP,
$typeOrUser > 0 ? $typeOrUser : DBSIMPLE_SKIP, $typeOrUser > 0 ? $typeOrUser : DBSIMPLE_SKIP,
@@ -396,6 +416,21 @@ class CommunityContent
!$typeOrUser ? Cfg::get('SQL_LIMIT_SEARCH') : DBSIMPLE_SKIP !$typeOrUser ? Cfg::get('SQL_LIMIT_SEARCH') : DBSIMPLE_SKIP
); );
if (!$videos)
return [];
$nFound = DB::Aowow()->selectCell(
substr_replace(self::$viQuery, 'SELECT COUNT(*) ', 0, strpos(self::$viQuery, 'FROM')),
CC_FLAG_STICKY,
$typeOrUser < 0 ? -$typeOrUser : DBSIMPLE_SKIP,
$typeOrUser > 0 ? $typeOrUser : DBSIMPLE_SKIP,
$typeOrUser > 0 ? $typeId : DBSIMPLE_SKIP,
CC_FLAG_APPROVED,
CC_FLAG_DELETED,
!$typeOrUser ? 'date' : DBSIMPLE_SKIP,
DBSIMPLE_SKIP
);
if ($typeOrUser <= 0) // not for search by type/typeId if ($typeOrUser <= 0) // not for search by type/typeId
{ {
foreach ($videos as $v) foreach ($videos as $v)
@@ -428,9 +463,9 @@ class CommunityContent
return array_values($videos); return array_values($videos);
} }
public static function getScreenshots(int $typeOrUser = 0, int $typeId = 0, int &$nFound = 0, bool $dateFmt = true) : array public static function getScreenshots(int $typeOrUser = 0, int $typeId = 0, ?int &$nFound = 0, bool $dateFmt = true) : array
{ {
$screenshots = DB::Aowow()->selectPage($nFound, self::$ssQuery, $screenshots = DB::Aowow()->select(self::$ssQuery,
CC_FLAG_STICKY, CC_FLAG_STICKY,
$typeOrUser < 0 ? -$typeOrUser : DBSIMPLE_SKIP, $typeOrUser < 0 ? -$typeOrUser : DBSIMPLE_SKIP,
$typeOrUser > 0 ? $typeOrUser : DBSIMPLE_SKIP, $typeOrUser > 0 ? $typeOrUser : DBSIMPLE_SKIP,
@@ -441,6 +476,21 @@ class CommunityContent
!$typeOrUser ? Cfg::get('SQL_LIMIT_SEARCH') : DBSIMPLE_SKIP !$typeOrUser ? Cfg::get('SQL_LIMIT_SEARCH') : DBSIMPLE_SKIP
); );
if (!$screenshots)
return [];
$nFound = DB::Aowow()->selectCell(
substr_replace(self::$ssQuery, 'SELECT COUNT(*) ', 0, strpos(self::$ssQuery, 'FROM')),
CC_FLAG_STICKY,
$typeOrUser < 0 ? -$typeOrUser : DBSIMPLE_SKIP,
$typeOrUser > 0 ? $typeOrUser : DBSIMPLE_SKIP,
$typeOrUser > 0 ? $typeId : DBSIMPLE_SKIP,
CC_FLAG_APPROVED,
CC_FLAG_DELETED,
!$typeOrUser ? 'date' : DBSIMPLE_SKIP,
DBSIMPLE_SKIP
);
if ($typeOrUser <= 0) // not for search by type/typeId if ($typeOrUser <= 0) // not for search by type/typeId
{ {
foreach ($screenshots as $s) foreach ($screenshots as $s)

View File

@@ -614,7 +614,7 @@ class Profiler
$skAllowed = DB::Aowow()->selectCol('SELECT `id` FROM ?_skillline WHERE `typeCat` IN (9, 11) AND (`cuFlags` & ?d) = 0', CUSTOM_EXCLUDE_FOR_LISTVIEW); $skAllowed = DB::Aowow()->selectCol('SELECT `id` FROM ?_skillline WHERE `typeCat` IN (9, 11) AND (`cuFlags` & ?d) = 0', CUSTOM_EXCLUDE_FOR_LISTVIEW);
$skills = DB::Characters($realmId)->select('SELECT ?d AS `id`, `skill` AS `skillId`, `value`, `max` FROM character_skills WHERE `guid` = ?d AND `skill` IN (?a)', $profileId, $char['guid'], $skAllowed); $skills = DB::Characters($realmId)->select('SELECT ?d AS `id`, `skill` AS `skillId`, `value`, `max` FROM character_skills WHERE `guid` = ?d AND `skill` IN (?a)', $profileId, $char['guid'], $skAllowed);
$racials = DB::Aowow()->select('SELECT `effect1MiscValue` AS ARRAY_KEY, `effect1DieSides` + `effect1BasePoints` AS qty, `reqRaceMask`, `reqClassMask` FROM ?_spell WHERE `typeCat` = -4 AND `effect1Id` = 6 AND `effect1AuraId` = 98'); $racials = DB::Aowow()->select('SELECT `effect1MiscValue` AS ARRAY_KEY, `effect1DieSides` + `effect1BasePoints` AS qty, `reqRaceMask`, `reqClassMask` FROM ?_spell WHERE `typeCat` = -4 AND `effect1Id` = ?d AND `effect1AuraId` = ?d', SPELL_EFFECT_APPLY_AURA, SPELL_AURA_MOD_SKILL_TALENT);
foreach ($skills as &$sk) // apply racial profession bonuses foreach ($skills as &$sk) // apply racial profession bonuses
{ {
@@ -644,14 +644,10 @@ class Profiler
// get base values for this race/class // get base values for this race/class
$reputation = []; $reputation = [];
$baseRep = DB::Aowow()->selectCol( $baseRep = DB::Aowow()->selectCol(
'SELECT `id` AS ARRAY_KEY, `baseRepValue1` FROM aowow_factions WHERE `baseRepValue1` && (`baseRepRaceMask1` & ?d || (!`baseRepRaceMask1` AND `baseRepClassMask1`)) && 'SELECT `id` AS ARRAY_KEY, `baseRepValue1` FROM aowow_factions WHERE `baseRepValue1` AND (`baseRepRaceMask1` & ?d OR (`baseRepClassMask1` AND NOT `baseRepRaceMask1`)) AND ((`baseRepClassMask1` & ?d) OR NOT `baseRepClassMask1`) UNION
((`baseRepClassMask1` & ?d) || !`baseRepClassMask1`) UNION SELECT `id` AS ARRAY_KEY, `baseRepValue2` FROM aowow_factions WHERE `baseRepValue2` AND (`baseRepRaceMask2` & ?d OR (`baseRepClassMask2` AND NOT `baseRepRaceMask2`)) AND ((`baseRepClassMask2` & ?d) OR NOT `baseRepClassMask2`) UNION
SELECT `id` AS ARRAY_KEY, `baseRepValue2` FROM aowow_factions WHERE `baseRepValue2` && (`baseRepRaceMask2` & ?d || (!`baseRepRaceMask2` AND `baseRepClassMask2`)) && SELECT `id` AS ARRAY_KEY, `baseRepValue3` FROM aowow_factions WHERE `baseRepValue3` AND (`baseRepRaceMask3` & ?d OR (`baseRepClassMask3` AND NOT `baseRepRaceMask3`)) AND ((`baseRepClassMask3` & ?d) OR NOT `baseRepClassMask3`) UNION
((`baseRepClassMask2` & ?d) || !`baseRepClassMask2`) UNION SELECT `id` AS ARRAY_KEY, `baseRepValue4` FROM aowow_factions WHERE `baseRepValue4` AND (`baseRepRaceMask4` & ?d OR (`baseRepClassMask4` AND NOT `baseRepRaceMask4`)) AND ((`baseRepClassMask4` & ?d) OR NOT `baseRepClassMask4`)',
SELECT `id` AS ARRAY_KEY, `baseRepValue3` FROM aowow_factions WHERE `baseRepValue3` && (`baseRepRaceMask3` & ?d || (!`baseRepRaceMask3` AND `baseRepClassMask3`)) &&
((`baseRepClassMask3` & ?d) || !`baseRepClassMask3`) UNION
SELECT `id` AS ARRAY_KEY, `baseRepValue4` FROM aowow_factions WHERE `baseRepValue4` && (`baseRepRaceMask4` & ?d || (!`baseRepRaceMask4` AND `baseRepClassMask4`)) &&
((`baseRepClassMask4` & ?d) || !`baseRepClassMask4`)',
$ra, $cl, $ra, $cl, $ra, $cl, $ra, $cl $ra, $cl, $ra, $cl, $ra, $cl, $ra, $cl
); );
@@ -760,7 +756,7 @@ class Profiler
/****************/ /****************/
// guilds // guilds
if ($guild = DB::Characters($realmId)->selectRow('SELECT g.name AS name, g.guildid AS id, gm.rank FROM guild_member gm JOIN guild g ON g.guildid = gm.guildid WHERE gm.guid = ?d', $char['guid'])) if ($guild = DB::Characters($realmId)->selectRow('SELECT g.`name` AS `name`, g.`guildid` AS `id`, gm.`rank` FROM guild_member gm JOIN guild g ON g.`guildid` = gm.`guildid` WHERE gm.`guid` = ?d', $char['guid']))
{ {
$guildId = 0; $guildId = 0;
if (!($guildId = DB::Aowow()->selectCell('SELECT id FROM ?_profiler_guild WHERE realm = ?d AND realmGUID = ?d', $realmId, $guild['id']))) if (!($guildId = DB::Aowow()->selectCell('SELECT id FROM ?_profiler_guild WHERE realm = ?d AND realmGUID = ?d', $realmId, $guild['id'])))
@@ -784,11 +780,11 @@ class Profiler
// arena teams // arena teams
$teams = DB::Characters($realmId)->select('SELECT at.arenaTeamId AS ARRAY_KEY, at.name, at.type, IF(at.captainGuid = atm.guid, 1, 0) AS captain, atm.* FROM arena_team at JOIN arena_team_member atm ON atm.arenaTeamId = at.arenaTeamId WHERE atm.guid = ?d', $char['guid']); $teams = DB::Characters($realmId)->select('SELECT at.`arenaTeamId` AS ARRAY_KEY, at.`name`, at.`type`, IF(at.`captainGuid` = atm.`guid`, 1, 0) AS `captain`, atm.* FROM arena_team at JOIN arena_team_member atm ON atm.`arenaTeamId` = at.`arenaTeamId` WHERE atm.`guid` = ?d', $char['guid']);
foreach ($teams as $rGuid => $t) foreach ($teams as $rGuid => $t)
{ {
$teamId = 0; $teamId = 0;
if (!($teamId = DB::Aowow()->selectCell('SELECT id FROM ?_profiler_arena_team WHERE realm = ?d AND realmGUID = ?d', $realmId, $rGuid))) if (!($teamId = DB::Aowow()->selectCell('SELECT `id` FROM ?_profiler_arena_team WHERE `realm` = ?d AND `realmGUID` = ?d', $realmId, $rGuid)))
{ {
$team = array( // only most basic data $team = array( // only most basic data
'realm' => $realmId, 'realm' => $realmId,
@@ -832,15 +828,15 @@ class Profiler
/* mark char as done */ /* mark char as done */
/*********************/ /*********************/
if (DB::Aowow()->query('UPDATE ?_profiler_profiles SET ?a WHERE realm = ?d AND realmGUID = ?d', $data, $realmId, $charGuid) !== null) if (DB::Aowow()->query('UPDATE ?_profiler_profiles SET ?a WHERE `realm` = ?d AND `realmGUID` = ?d', $data, $realmId, $charGuid) !== null)
DB::Aowow()->query('UPDATE ?_profiler_profiles SET cuFlags = cuFlags & ?d WHERE id = ?d', ~PROFILER_CU_NEEDS_RESYNC, $profileId); DB::Aowow()->query('UPDATE ?_profiler_profiles SET `cuFlags` = `cuFlags` & ?d WHERE `id` = ?d', ~PROFILER_CU_NEEDS_RESYNC, $profileId);
return true; return true;
} }
public static function getGuildFromRealm($realmId, $guildGuid) public static function getGuildFromRealm($realmId, $guildGuid)
{ {
$guild = DB::Characters($realmId)->selectRow('SELECT guildId, name, createDate, info, backgroundColor, emblemStyle, emblemColor, borderStyle, borderColor FROM guild WHERE guildId = ?d', $guildGuid); $guild = DB::Characters($realmId)->selectRow('SELECT `guildId`, `name`, `createDate`, `info`, `backgroundColor`, `emblemStyle`, `emblemColor`, `borderStyle`, `borderColor` FROM guild WHERE `guildId` = ?d', $guildGuid);
if (!$guild) if (!$guild)
return false; return false;
@@ -851,7 +847,7 @@ class Profiler
} }
// reminder: this query should not fail: a placeholder entry is created as soon as a team listview is created or team detail page is called // reminder: this query should not fail: a placeholder entry is created as soon as a team listview is created or team detail page is called
$guildId = DB::Aowow()->selectCell('SELECT id FROM ?_profiler_guild WHERE realm = ?d AND realmGUID = ?d', $realmId, $guild['guildId']); $guildId = DB::Aowow()->selectCell('SELECT `id` FROM ?_profiler_guild WHERE `realm` = ?d AND `realmGUID` = ?d', $realmId, $guild['guildId']);
CLI::write('fetching guild #'.$guildGuid.' from realm #'.$realmId); CLI::write('fetching guild #'.$guildGuid.' from realm #'.$realmId);
CLI::write('writing...'); CLI::write('writing...');
@@ -867,8 +863,8 @@ class Profiler
DB::Aowow()->query('UPDATE ?_profiler_guild SET ?a WHERE realm = ?d AND realmGUID = ?d', $guild, $realmId, $guildGuid); DB::Aowow()->query('UPDATE ?_profiler_guild SET ?a WHERE realm = ?d AND realmGUID = ?d', $guild, $realmId, $guildGuid);
// ranks // ranks
DB::Aowow()->query('DELETE FROM ?_profiler_guild_rank WHERE guildId = ?d', $guildId); DB::Aowow()->query('DELETE FROM ?_profiler_guild_rank WHERE `guildId` = ?d', $guildId);
if ($ranks = DB::Characters($realmId)->select('SELECT ?d AS guildId, rid AS `rank`, rname AS name FROM guild_rank WHERE guildid = ?d', $guildId, $guildGuid)) if ($ranks = DB::Characters($realmId)->select('SELECT ?d AS `guildId`, `rid` AS `rank`, `rname` AS `name` FROM guild_rank WHERE `guildid` = ?d', $guildId, $guildGuid))
foreach (Util::createSqlBatchInsert($ranks) as $r) foreach (Util::createSqlBatchInsert($ranks) as $r)
DB::Aowow()->query('INSERT INTO ?_profiler_guild_rank (?#) VALUES '.$r, array_keys(reset($ranks))); DB::Aowow()->query('INSERT INTO ?_profiler_guild_rank (?#) VALUES '.$r, array_keys(reset($ranks)));
@@ -900,14 +896,14 @@ class Profiler
/* mark guild as done */ /* mark guild as done */
/*********************/ /*********************/
DB::Aowow()->query('UPDATE ?_profiler_guild SET cuFlags = cuFlags & ?d WHERE id = ?d', ~PROFILER_CU_NEEDS_RESYNC, $guildId); DB::Aowow()->query('UPDATE ?_profiler_guild SET `cuFlags` = `cuFlags` & ?d WHERE `id` = ?d', ~PROFILER_CU_NEEDS_RESYNC, $guildId);
return true; return true;
} }
public static function getArenaTeamFromRealm($realmId, $teamGuid) public static function getArenaTeamFromRealm($realmId, $teamGuid)
{ {
$team = DB::Characters($realmId)->selectRow('SELECT arenaTeamId, name, type, captainGuid, rating, seasonGames, seasonWins, weekGames, weekWins, `rank`, backgroundColor, emblemStyle, emblemColor, borderStyle, borderColor FROM arena_team WHERE arenaTeamId = ?d', $teamGuid); $team = DB::Characters($realmId)->selectRow('SELECT `arenaTeamId`, `name`, `type`, `captainGuid`, `rating`, `seasonGames`, `seasonWins`, `weekGames`, `weekWins`, `rank`, `backgroundColor`, `emblemStyle`, `emblemColor`, `borderStyle`, `borderColor` FROM arena_team WHERE `arenaTeamId` = ?d', $teamGuid);
if (!$team) if (!$team)
return false; return false;
@@ -933,7 +929,7 @@ class Profiler
unset($team['arenaTeamId']); unset($team['arenaTeamId']);
$team['nameUrl'] = self::urlize($team['name']); $team['nameUrl'] = self::urlize($team['name']);
DB::Aowow()->query('UPDATE ?_profiler_arena_team SET ?a WHERE realm = ?d AND realmGUID = ?d', $team, $realmId, $teamGuid); DB::Aowow()->query('UPDATE ?_profiler_arena_team SET ?a WHERE `realm` = ?d AND `realmGUID` = ?d', $team, $realmId, $teamGuid);
CLI::write(' ..team data'); CLI::write(' ..team data');
@@ -942,18 +938,14 @@ class Profiler
/* Member Data */ /* Member Data */
/***************/ /***************/
$members = DB::Characters($realmId)->select(' $members = DB::Characters($realmId)->select(
SELECT 'SELECT atm.`guid` AS ARRAY_KEY, atm.`arenaTeamId`, atm.`weekGames`, atm.`weekWins`, atm.`seasonGames`, atm.`seasonWins`, atm.`personalrating`
atm.guid AS ARRAY_KEY, atm.arenaTeamId, atm.weekGames, atm.weekWins, atm.seasonGames, atm.seasonWins, atm.personalrating FROM arena_team_member atm
FROM JOIN characters c ON c.`guid` = atm.`guid` AND
arena_team_member atm c.`deleteInfos_Account` IS NULL AND
JOIN c.`level` <= ?d AND
characters c ON c.guid = atm.guid AND (c.`extra_flags` & ?d) = 0
c.deleteInfos_Account IS NULL AND WHERE `arenaTeamId` = ?d',
c.level <= ?d AND
(c.extra_flags & ?d) = 0
WHERE
arenaTeamId = ?d',
MAX_LEVEL, MAX_LEVEL,
self::CHAR_GMFLAGS, self::CHAR_GMFLAGS,
$teamGuid $teamGuid
@@ -991,7 +983,7 @@ class Profiler
); );
// ...and purge this teams member // ...and purge this teams member
DB::Aowow()->query('DELETE FROM ?_profiler_arena_team_member WHERE arenaTeamId = ?d', $teamId); DB::Aowow()->query('DELETE FROM ?_profiler_arena_team_member WHERE `arenaTeamId` = ?d', $teamId);
foreach (Util::createSqlBatchInsert($members) as $m) foreach (Util::createSqlBatchInsert($members) as $m)
DB::Aowow()->query('INSERT INTO ?_profiler_arena_team_member (?#) VALUES '.$m, array_keys(reset($members))); DB::Aowow()->query('INSERT INTO ?_profiler_arena_team_member (?#) VALUES '.$m, array_keys(reset($members)));
@@ -1005,7 +997,7 @@ class Profiler
/* mark team as done */ /* mark team as done */
/*********************/ /*********************/
DB::Aowow()->query('UPDATE ?_profiler_arena_team SET cuFlags = cuFlags & ?d WHERE id = ?d', ~PROFILER_CU_NEEDS_RESYNC, $teamId); DB::Aowow()->query('UPDATE ?_profiler_arena_team SET `cuFlags` = `cuFlags` & ?d WHERE `id` = ?d', ~PROFILER_CU_NEEDS_RESYNC, $teamId);
return true; return true;
} }

View File

@@ -25,7 +25,7 @@ class AchievementList extends BaseType
todo: evaluate TC custom-data-tables: a*_criteria_data should be merged on installation todo: evaluate TC custom-data-tables: a*_criteria_data should be merged on installation
*/ */
public function __construct($conditions = [], $miscData = null) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions, $miscData); parent::__construct($conditions, $miscData);

View File

@@ -19,9 +19,9 @@ class AreaTriggerList extends BaseType
's' => ['j' => ['?_spawns s ON s.type = 503 AND s.typeId = a.id', true], 's' => ', s.areaId'] 's' => ['j' => ['?_spawns s ON s.type = 503 AND s.typeId = a.id', true], 's' => ', s.areaId']
); );
public function __construct($conditions) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions); parent::__construct($conditions, $miscData);
foreach ($this->iterate() as $id => &$_curTpl) foreach ($this->iterate() as $id => &$_curTpl)
if (!$_curTpl['name']) if (!$_curTpl['name'])

View File

@@ -126,7 +126,7 @@ class RemoteArenaTeamList extends ArenaTeamList
private $members = []; private $members = [];
private $rankOrder = []; private $rankOrder = [];
public function __construct($conditions = [], $miscData = null) public function __construct(array $conditions = [], array $miscData = [])
{ {
// select DB by realm // select DB by realm
if (!$this->selectRealms($miscData)) if (!$this->selectRealms($miscData))
@@ -324,7 +324,7 @@ class LocalArenaTeamList extends ArenaTeamList
{ {
protected $queryBase = 'SELECT at.*, at.id AS ARRAY_KEY FROM ?_profiler_arena_team at'; protected $queryBase = 'SELECT at.*, at.id AS ARRAY_KEY FROM ?_profiler_arena_team at';
public function __construct($conditions = [], $miscData = null) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions, $miscData); parent::__construct($conditions, $miscData);

View File

@@ -12,9 +12,9 @@ class CharClassList extends BaseType
protected $queryBase = 'SELECT c.*, id AS ARRAY_KEY FROM ?_classes c'; protected $queryBase = 'SELECT c.*, id AS ARRAY_KEY FROM ?_classes c';
public function __construct($conditions = []) public function __construct($conditions = [], array $miscData = [])
{ {
parent::__construct($conditions); parent::__construct($conditions, $miscData);
foreach ($this->iterate() as $k => &$_curTpl) foreach ($this->iterate() as $k => &$_curTpl)
$_curTpl['skills'] = explode(' ', $_curTpl['skills']); $_curTpl['skills'] = explode(' ', $_curTpl['skills']);

View File

@@ -24,7 +24,7 @@ class CreatureList extends BaseType
's' => ['j' => ['?_spawns s ON s.type = 1 AND s.typeId = ct.id', true]] 's' => ['j' => ['?_spawns s ON s.type = 1 AND s.typeId = ct.id', true]]
); );
public function __construct($conditions = [], $miscData = null) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions, $miscData); parent::__construct($conditions, $miscData);

View File

@@ -16,9 +16,9 @@ class CurrencyList extends BaseType
'ic' => ['j' => ['?_icons ic ON ic.id = c.iconId', true], 's' => ', ic.name AS iconString'] 'ic' => ['j' => ['?_icons ic ON ic.id = c.iconId', true], 's' => ', ic.name AS iconString']
); );
public function __construct($conditions = []) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions); parent::__construct($conditions, $miscData);
foreach ($this->iterate() as &$_curTpl) foreach ($this->iterate() as &$_curTpl)
$_curTpl['iconString'] = $_curTpl['iconString'] ?: DEFAULT_ICON; $_curTpl['iconString'] = $_curTpl['iconString'] ?: DEFAULT_ICON;

View File

@@ -12,9 +12,9 @@ class EmoteList extends BaseType
protected $queryBase = 'SELECT e.*, e.id AS ARRAY_KEY FROM ?_emotes e'; protected $queryBase = 'SELECT e.*, e.id AS ARRAY_KEY FROM ?_emotes e';
public function __construct($conditions = []) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions); parent::__construct($conditions, $miscData);
// post processing // post processing
foreach ($this->iterate() as &$curTpl) foreach ($this->iterate() as &$curTpl)

View File

@@ -22,9 +22,9 @@ class EnchantmentList extends BaseType
'is' => ['j' => ['?_item_stats `is` ON `is`.`type` = 502 AND `is`.`typeId` = `ie`.`id`', true], 's' => ', `is`.*'], 'is' => ['j' => ['?_item_stats `is` ON `is`.`type` = 502 AND `is`.`typeId` = `ie`.`id`', true], 's' => ', `is`.*'],
); );
public function __construct($conditions = []) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions); parent::__construct($conditions, $miscData);
// post processing // post processing
foreach ($this->iterate() as &$curTpl) foreach ($this->iterate() as &$curTpl)

View File

@@ -17,9 +17,9 @@ class FactionList extends BaseType
'ft' => ['j' => '?_factiontemplate ft ON ft.factionId = f.id'] 'ft' => ['j' => '?_factiontemplate ft ON ft.factionId = f.id']
); );
public function __construct($conditions = []) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions); parent::__construct($conditions, $miscData);
if ($this->error) if ($this->error)
return; return;

View File

@@ -21,7 +21,7 @@ class GameObjectList extends BaseType
's' => ['j' => '?_spawns s ON s.type = 2 AND s.typeId = o.id'] 's' => ['j' => '?_spawns s ON s.type = 2 AND s.typeId = o.id']
); );
public function __construct($conditions = [], $miscData = null) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions, $miscData); parent::__construct($conditions, $miscData);

View File

@@ -31,9 +31,9 @@ class GuideList extends BaseType
'c' => ['j' => ['?_comments c ON c.`type` = '.Type::GUIDE.' AND c.`typeId` = g.`id` AND (c.`flags` & '.CC_FLAG_DELETED.') = 0', true], 's' => ', COUNT(c.`id`) AS `comments`'] 'c' => ['j' => ['?_comments c ON c.`type` = '.Type::GUIDE.' AND c.`typeId` = g.`id` AND (c.`flags` & '.CC_FLAG_DELETED.') = 0', true], 's' => ', COUNT(c.`id`) AS `comments`']
); );
public function __construct($conditions = []) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions); parent::__construct($conditions, $miscData);
if ($this->error) if ($this->error)
return; return;

View File

@@ -161,7 +161,7 @@ class RemoteGuildList extends GuildList
'c' => ['j' => 'characters c ON c.guid = gm.guid', 's' => ', BIT_OR(IF(c.race IN (1, 3, 4, 7, 11), 1, 2)) - 1 AS faction'] 'c' => ['j' => 'characters c ON c.guid = gm.guid', 's' => ', BIT_OR(IF(c.race IN (1, 3, 4, 7, 11), 1, 2)) - 1 AS faction']
); );
public function __construct($conditions = [], $miscData = null) public function __construct(array $conditions = [], array $miscData = [])
{ {
// select DB by realm // select DB by realm
if (!$this->selectRealms($miscData)) if (!$this->selectRealms($miscData))
@@ -273,7 +273,7 @@ class LocalGuildList extends GuildList
{ {
protected $queryBase = 'SELECT g.*, g.id AS ARRAY_KEY FROM ?_profiler_guild g'; protected $queryBase = 'SELECT g.*, g.id AS ARRAY_KEY FROM ?_profiler_guild g';
public function __construct($conditions = [], $miscData = null) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions, $miscData); parent::__construct($conditions, $miscData);

View File

@@ -34,9 +34,9 @@ class IconList extends BaseType
); );
*/ */
public function __construct($conditions) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions); parent::__construct($conditions, $miscData);
if (!$this->getFoundIDs()) if (!$this->getFoundIDs())
return; return;

View File

@@ -35,7 +35,7 @@ class ItemList extends BaseType
'src' => ['j' => ['?_source `src` ON `src`.`type` = 3 AND `src`.`typeId` = `i`.`id`', true], 's' => ', moreType, moreTypeId, moreZoneId, moreMask, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10, src11, src12, src13, src14, src15, src16, src17, src18, src19, src20, src21, src22, src23, src24'] 'src' => ['j' => ['?_source `src` ON `src`.`type` = 3 AND `src`.`typeId` = `i`.`id`', true], 's' => ', moreType, moreTypeId, moreZoneId, moreMask, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10, src11, src12, src13, src14, src15, src16, src17, src18, src19, src20, src21, src22, src23, src24']
); );
public function __construct($conditions = [], $miscData = null) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions, $miscData); parent::__construct($conditions, $miscData);
@@ -1037,15 +1037,12 @@ class ItemList extends BaseType
// handle special cases where: // handle special cases where:
// > itemset has items of different qualities (handled by not limiting for this in the initial query) // > itemset has items of different qualities (handled by not limiting for this in the initial query)
// > itemset is virtual and multiple instances have the same itemLevel but not quality (filter below) // > itemset is virtual and multiple instances have the same itemLevel but not quality (filter below)
if ($itemset->getMatches() > 1) foreach ($itemset->iterate() as $id => $__)
{ {
foreach ($itemset->iterate() as $id => $__) if ($itemset->getField('quality') == $this->curTpl['quality'])
{ {
if ($itemset->getField('quality') == $this->curTpl['quality']) $itemset->pieceToSet = array_filter($itemset->pieceToSet, function($x) use ($id) { return $id == $x; });
{ break;
$itemset->pieceToSet = array_filter($itemset->pieceToSet, function($x) use ($id) { return $id == $x; });
break;
}
} }
} }

View File

@@ -22,9 +22,9 @@ class ItemsetList extends BaseType
'src' => ['j' => ['?_source src ON `src`.`typeId` = `set`.`id` AND `src`.`type` = 4', true], 's' => ', src1, src2, src3, src4, src5, src6, src7, src8, src9, src10, src11, src12, src13, src14, src15, src16, src17, src18, src19, src20, src21, src22, src23, src24'] 'src' => ['j' => ['?_source src ON `src`.`typeId` = `set`.`id` AND `src`.`type` = 4', true], 's' => ', src1, src2, src3, src4, src5, src6, src7, src8, src9, src10, src11, src12, src13, src14, src15, src16, src17, src18, src19, src20, src21, src22, src23, src24']
); );
public function __construct($conditions = []) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions); parent::__construct($conditions, $miscData);
// post processing // post processing
foreach ($this->iterate() as &$_curTpl) foreach ($this->iterate() as &$_curTpl)

View File

@@ -13,9 +13,9 @@ class MailList extends BaseType
protected $queryBase = 'SELECT m.*, m.id AS ARRAY_KEY FROM ?_mails m'; protected $queryBase = 'SELECT m.*, m.id AS ARRAY_KEY FROM ?_mails m';
protected $queryOpts = []; protected $queryOpts = [];
public function __construct($conditions = []) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions); parent::__construct($conditions, $miscData);
if ($this->error) if ($this->error)
return; return;

View File

@@ -513,7 +513,7 @@ class RemoteProfileList extends ProfileList
private $rnItr = []; // rename iterator [name => nCharsWithThisName] private $rnItr = []; // rename iterator [name => nCharsWithThisName]
public function __construct($conditions = [], $miscData = null) public function __construct(array $conditions = [], array $miscData = [])
{ {
// select DB by realm // select DB by realm
if (!$this->selectRealms($miscData)) if (!$this->selectRealms($miscData))
@@ -708,7 +708,7 @@ class RemoteProfileList extends ProfileList
if ($baseData) if ($baseData)
{ {
foreach (Util::createSqlBatchInsert($baseData) as $ins) foreach (Util::createSqlBatchInsert($baseData) as $ins)
DB::Aowow()->query('INSERT INTO ?_profiler_profiles (?#) VALUES '.$ins.' ON DUPLICATE KEY UPDATE name = VALUES(name), renameItr = VALUES(renameItr)', array_keys(reset($baseData))); DB::Aowow()->query('INSERT INTO ?_profiler_profiles (?#) VALUES '.$ins.' AS newP(`r`, `rg`, `na`, `itr`, `ra`, `cl`, `lvl`, `ge`, `g`, `gr`, `cf`) ON DUPLICATE KEY UPDATE `name` = newP.`na`, `renameItr` = newP.`itr`', array_keys(reset($baseData)));
// merge back local ids // merge back local ids
$localIds = DB::Aowow()->select( $localIds = DB::Aowow()->select(
@@ -737,7 +737,7 @@ class LocalProfileList extends ProfileList
'g' => ['j' => ['?_profiler_guild g ON g.id = p.guild', true], 's' => ', g.name AS guildname'] 'g' => ['j' => ['?_profiler_guild g ON g.id = p.guild', true], 's' => ', g.name AS guildname']
); );
public function __construct($conditions = [], $miscData = null) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions, $miscData); parent::__construct($conditions, $miscData);

View File

@@ -22,7 +22,7 @@ class QuestList extends BaseType
'e' => ['j' => ['?_events e ON e.id = `q`.eventId', true], 's' => ', e.holidayId'] 'e' => ['j' => ['?_events e ON e.id = `q`.eventId', true], 's' => ', e.holidayId']
); );
public function __construct($conditions = [], $miscData = null) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions, $miscData); parent::__construct($conditions, $miscData);

View File

@@ -16,9 +16,9 @@ class SkillList extends BaseType
'ic' => ['j' => ['?_icons ic ON ic.id = sl.iconId', true], 's' => ', ic.name AS iconString'], 'ic' => ['j' => ['?_icons ic ON ic.id = sl.iconId', true], 's' => ', ic.name AS iconString'],
); );
public function __construct($conditions = []) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions); parent::__construct($conditions, $miscData);
// post processing // post processing
foreach ($this->iterate() as &$_curTpl) foreach ($this->iterate() as &$_curTpl)

View File

@@ -21,9 +21,9 @@ class SoundList extends BaseType
SOUND_TYPE_MP3 => 'audio/mpeg' SOUND_TYPE_MP3 => 'audio/mpeg'
); );
public function __construct($conditions = []) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions); parent::__construct($conditions, $miscData);
// post processing // post processing
foreach ($this->iterate() as $id => &$_curTpl) foreach ($this->iterate() as $id => &$_curTpl)

View File

@@ -102,9 +102,9 @@ class SpellList extends BaseType
'src' => ['j' => ['?_source src ON type = 6 AND typeId = s.id', true], 's' => ', moreType, moreTypeId, moreZoneId, moreMask, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10, src11, src12, src13, src14, src15, src16, src17, src18, src19, src20, src21, src22, src23, src24'] 'src' => ['j' => ['?_source src ON type = 6 AND typeId = s.id', true], 's' => ', moreType, moreTypeId, moreZoneId, moreMask, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10, src11, src12, src13, src14, src15, src16, src17, src18, src19, src20, src21, src22, src23, src24']
); );
public function __construct($conditions = [], $miscData = []) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions); parent::__construct($conditions, $miscData);
if ($this->error) if ($this->error)
return; return;

View File

@@ -20,9 +20,9 @@ class TitleList extends BaseType
'src' => ['j' => ['?_source src ON type = 11 AND typeId = t.id', true], 's' => ', src13, moreType, moreTypeId'] 'src' => ['j' => ['?_source src ON type = 11 AND typeId = t.id', true], 's' => ', src13, moreType, moreTypeId']
); );
public function __construct($conditions = []) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions); parent::__construct($conditions, $miscData);
// post processing // post processing
foreach ($this->iterate() as $id => &$_curTpl) foreach ($this->iterate() as $id => &$_curTpl)

View File

@@ -16,9 +16,9 @@ class WorldEventList extends BaseType
'h' => ['j' => ['?_holidays h ON e.holidayId = h.id', true], 'o' => '-e.id ASC'] 'h' => ['j' => ['?_holidays h ON e.holidayId = h.id', true], 'o' => '-e.id ASC']
); );
public function __construct($conditions = []) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions); parent::__construct($conditions, $miscData);
// unseting elements while we iterate over the array will cause the pointer to reset // unseting elements while we iterate over the array will cause the pointer to reset
$replace = []; $replace = [];

View File

@@ -14,7 +14,7 @@ class ZoneList extends BaseType
protected $queryBase = 'SELECT z.*, id AS ARRAY_KEY FROM ?_zones z'; protected $queryBase = 'SELECT z.*, id AS ARRAY_KEY FROM ?_zones z';
public function __construct($conditions = [], $miscData = null) public function __construct(array $conditions = [], array $miscData = [])
{ {
parent::__construct($conditions, $miscData); parent::__construct($conditions, $miscData);

View File

@@ -76,7 +76,7 @@ class AchievementsPage extends GenericPage
if ($fiCnd = $this->filterObj->getConditions()) if ($fiCnd = $this->filterObj->getConditions())
$conditions[] = $fiCnd; $conditions[] = $fiCnd;
$acvList = new AchievementList($conditions); $acvList = new AchievementList($conditions, ['calcTotal' => true]);
if (!$acvList->getMatches()) if (!$acvList->getMatches())
{ {
$category = [!empty($this->category) ? (int)end($this->category) : 0]; $category = [!empty($this->category) ? (int)end($this->category) : 0];
@@ -86,7 +86,7 @@ class AchievementsPage extends GenericPage
if ($catList = DB::Aowow()->SelectCol('SELECT Id FROM ?_achievementcategory WHERE parentCat IN (?a) OR parentCat2 IN (?a) ', $category, $category)) if ($catList = DB::Aowow()->SelectCol('SELECT Id FROM ?_achievementcategory WHERE parentCat IN (?a) OR parentCat2 IN (?a) ', $category, $category))
$conditions[] = ['category', $catList]; $conditions[] = ['category', $catList];
$acvList = new AchievementList($conditions); $acvList = new AchievementList($conditions, ['calcTotal' => true]);
} }
$tabData = []; $tabData = [];

View File

@@ -49,7 +49,7 @@ class AreaTriggersPage extends GenericPage
$conditions[] = $_; $conditions[] = $_;
$tabData = []; $tabData = [];
$trigger = new AreaTriggerList($conditions); $trigger = new AreaTriggerList($conditions, ['calcTotal' => true]);
if (!$trigger->error) if (!$trigger->error)
{ {
$tabData['data'] = array_values($trigger->getListviewData()); $tabData['data'] = array_values($trigger->getListviewData());

View File

@@ -93,7 +93,7 @@ class ArenaTeamsPage extends GenericPage
if (empty($this->filter['sz'])) if (empty($this->filter['sz']))
$tabData['visibleCols'][] = 'size'; $tabData['visibleCols'][] = 'size';
$miscParams = []; $miscParams = ['calcTotal' => true];
if ($this->realm) if ($this->realm)
$miscParams['sv'] = $this->realm; $miscParams['sv'] = $this->realm;
if ($this->region) if ($this->region)

View File

@@ -45,7 +45,7 @@ class EnchantmentsPage extends GenericPage
if ($_ = $this->filterObj->getConditions()) if ($_ = $this->filterObj->getConditions())
$conditions[] = $_; $conditions[] = $_;
$ench = new EnchantmentList($conditions); $ench = new EnchantmentList($conditions, ['calcTotal' => true]);
$tabData['data'] = array_values($ench->getListviewData()); $tabData['data'] = array_values($ench->getListviewData());
$this->extendGlobalData($ench->getJSGlobals()); $this->extendGlobalData($ench->getJSGlobals());

View File

@@ -173,7 +173,7 @@ class FactionPage extends GenericPage
/**************/ /**************/
// tab: items // tab: items
$items = new ItemList(array(['requiredFaction', $this->typeId])); $items = new ItemList(array(['requiredFaction', $this->typeId]), ['calcTotal' => true]);
if (!$items->error) if (!$items->error)
{ {
$this->extendGlobalData($items->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($items->getJSGlobals(GLOBALINFO_SELF));
@@ -204,7 +204,7 @@ class FactionPage extends GenericPage
if ($cRep) if ($cRep)
{ {
$killCreatures = new CreatureList(array(['id', array_keys($cRep)])); $killCreatures = new CreatureList(array(['id', array_keys($cRep)]), ['calcTotal' => true]);
if (!$killCreatures->error) if (!$killCreatures->error)
{ {
$data = $killCreatures->getListviewData(); $data = $killCreatures->getListviewData();
@@ -228,7 +228,7 @@ class FactionPage extends GenericPage
// tab: members // tab: members
if ($_ = $this->subject->getField('templateIds')) if ($_ = $this->subject->getField('templateIds'))
{ {
$members = new CreatureList(array(['faction', $_])); $members = new CreatureList(array(['faction', $_]), ['calcTotal' => true]);
if (!$members->error) if (!$members->error)
{ {
$tabData = array( $tabData = array(
@@ -261,7 +261,7 @@ class FactionPage extends GenericPage
['AND', ['rewardFactionId5', $this->typeId], ['rewardFactionValue5', 0, '>']], ['AND', ['rewardFactionId5', $this->typeId], ['rewardFactionValue5', 0, '>']],
'OR' 'OR'
); );
$quests = new QuestList($conditions); $quests = new QuestList($conditions, ['calcTotal' => true]);
if (!$quests->error) if (!$quests->error)
{ {
$this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_ANY)); $this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_ANY));

View File

@@ -86,7 +86,7 @@ class GuildsPage extends GenericPage
'hiddenCols' => ['guild'], 'hiddenCols' => ['guild'],
); );
$miscParams = []; $miscParams = ['calcTotal' => true];
if ($this->realm) if ($this->realm)
$miscParams['sv'] = $this->realm; $miscParams['sv'] = $this->realm;
if ($this->region) if ($this->region)

View File

@@ -44,7 +44,7 @@ class IconsPage extends GenericPage
if ($_ = $this->filterObj->getConditions()) if ($_ = $this->filterObj->getConditions())
$conditions[] = $_; $conditions[] = $_;
$icons = new IconList($conditions); $icons = new IconList($conditions, ['calcTotal' => true]);
$tabData['data'] = array_values($icons->getListviewData()); $tabData['data'] = array_values($icons->getListviewData());
$this->extendGlobalData($icons->getJSGlobals()); $this->extendGlobalData($icons->getJSGlobals());

View File

@@ -315,7 +315,7 @@ class ItemsPage extends GenericPage
$finalCnd = $conditions; $finalCnd = $conditions;
} }
$items = new ItemList($finalCnd, ['extraOpts' => array_merge($extraOpts, $this->filterObj->extraOpts)]); $items = new ItemList($finalCnd, ['extraOpts' => array_merge($extraOpts, $this->filterObj->extraOpts), 'calcTotal' => true]);
if ($items->error) if ($items->error)
continue; continue;

View File

@@ -41,7 +41,7 @@ class ItemsetsPage extends GenericPage
if ($_ = $this->filterObj->getConditions()) if ($_ = $this->filterObj->getConditions())
$conditions[] = $_; $conditions[] = $_;
$itemsets = new ItemsetList($conditions); $itemsets = new ItemsetList($conditions, ['calcTotal' => true]);
$this->extendGlobalData($itemsets->getJSGlobals()); $this->extendGlobalData($itemsets->getJSGlobals());
// recreate form selection // recreate form selection

View File

@@ -52,7 +52,7 @@ class NpcsPage extends GenericPage
$conditions[] = $_; $conditions[] = $_;
// beast subtypes are selected via filter // beast subtypes are selected via filter
$npcs = new CreatureList($conditions, ['extraOpts' => $this->filterObj->extraOpts]); $npcs = new CreatureList($conditions, ['extraOpts' => $this->filterObj->extraOpts, 'calcTotal' => true]);
// recreate form selection // recreate form selection
$this->filter = $this->filterObj->getForm(); $this->filter = $this->filterObj->getForm();

View File

@@ -424,7 +424,7 @@ class ObjectPage extends GenericPage
// tab: Spell Focus for // tab: Spell Focus for
if ($sfId = $this->subject->getField('spellFocusId')) if ($sfId = $this->subject->getField('spellFocusId'))
{ {
$focusSpells = new SpellList(array(['spellFocusObject', $sfId])); $focusSpells = new SpellList(array(['spellFocusObject', $sfId]), ['calcTotal' => true]);
if (!$focusSpells->error) if (!$focusSpells->error)
{ {
$tabData = array( $tabData = array(

View File

@@ -55,7 +55,7 @@ class ObjectsPage extends GenericPage
$conditions[] = $_; $conditions[] = $_;
$tabData = ['data' => []]; $tabData = ['data' => []];
$objects = new GameObjectList($conditions, ['extraOpts' => $this->filterObj->extraOpts]); $objects = new GameObjectList($conditions, ['extraOpts' => $this->filterObj->extraOpts, 'calcTotal' => true]);
if (!$objects->error) if (!$objects->error)
{ {
$tabData['data'] = array_values($objects->getListviewData()); $tabData['data'] = array_values($objects->getListviewData());

View File

@@ -117,7 +117,7 @@ class ProfilesPage extends GenericPage
$tabData['extraCols'] = $xc; $tabData['extraCols'] = $xc;
} }
$miscParams = []; $miscParams = ['calcTotal' => true];
if ($this->realm) if ($this->realm)
$miscParams['sv'] = $this->realm; $miscParams['sv'] = $this->realm;
if ($this->region) if ($this->region)

View File

@@ -121,7 +121,7 @@ class QuestPage extends GenericPage
$loremaster = new AchievementList($conditions); $loremaster = new AchievementList($conditions);
$this->extendGlobalData($loremaster->getJSGlobals(GLOBALINFO_SELF)); $this->extendGlobalData($loremaster->getJSGlobals(GLOBALINFO_SELF));
switch ($loremaster->getMatches()) switch (count($loremaster->getFoundIds()))
{ {
case 0: case 0:
break; break;

View File

@@ -47,7 +47,7 @@ class QuestsPage extends GenericPage
if ($_ = $this->filterObj->getConditions()) if ($_ = $this->filterObj->getConditions())
$conditions[] = $_; $conditions[] = $_;
$quests = new QuestList($conditions, ['extraOpts' => $this->filterObj->extraOpts]); $quests = new QuestList($conditions, ['extraOpts' => $this->filterObj->extraOpts, 'calcTotal' => true]);
$this->extendGlobalData($quests->getJSGlobals()); $this->extendGlobalData($quests->getJSGlobals());

View File

@@ -378,7 +378,7 @@ class SearchPage extends GenericPage
private function _searchCharClass($cndBase) // 0 Classes: $searchMask & 0x00000001 private function _searchCharClass($cndBase) // 0 Classes: $searchMask & 0x00000001
{ {
$cnd = array_merge($cndBase, [$this->createLookup()]); $cnd = array_merge($cndBase, [$this->createLookup()]);
$classes = new CharClassList($cnd); $classes = new CharClassList($cnd, ['calcTotal' => true]);
if ($data = $classes->getListviewData()) if ($data = $classes->getListviewData())
{ {
@@ -404,7 +404,7 @@ class SearchPage extends GenericPage
private function _searchCharRace($cndBase) // 1 Races: $searchMask & 0x00000002 private function _searchCharRace($cndBase) // 1 Races: $searchMask & 0x00000002
{ {
$cnd = array_merge($cndBase, [$this->createLookup()]); $cnd = array_merge($cndBase, [$this->createLookup()]);
$races = new CharRaceList($cnd); $races = new CharRaceList($cnd, ['calcTotal' => true]);
if ($data = $races->getListviewData()) if ($data = $races->getListviewData())
{ {
@@ -430,7 +430,7 @@ class SearchPage extends GenericPage
private function _searchTitle($cndBase) // 2 Titles: $searchMask & 0x00000004 private function _searchTitle($cndBase) // 2 Titles: $searchMask & 0x00000004
{ {
$cnd = array_merge($cndBase, [$this->createLookup(['male_loc'.User::$localeId, 'female_loc'.User::$localeId])]); $cnd = array_merge($cndBase, [$this->createLookup(['male_loc'.User::$localeId, 'female_loc'.User::$localeId])]);
$titles = new TitleList($cnd); $titles = new TitleList($cnd, ['calcTotal' => true]);
if ($data = $titles->getListviewData()) if ($data = $titles->getListviewData())
{ {
@@ -462,7 +462,7 @@ class SearchPage extends GenericPage
['AND', $this->createLookup(['e.description']), ['e.holidayId', 0]] ['AND', $this->createLookup(['e.description']), ['e.holidayId', 0]]
) )
)); ));
$wEvents = new WorldEventList($cnd); $wEvents = new WorldEventList($cnd, ['calcTotal' => true]);
if ($data = $wEvents->getListviewData()) if ($data = $wEvents->getListviewData())
{ {
@@ -489,7 +489,7 @@ class SearchPage extends GenericPage
private function _searchCurrency($cndBase) // 4 Currencies $searchMask & 0x0000010 private function _searchCurrency($cndBase) // 4 Currencies $searchMask & 0x0000010
{ {
$cnd = array_merge($cndBase, [$this->createLookup()]); $cnd = array_merge($cndBase, [$this->createLookup()]);
$money = new CurrencyList($cnd); $money = new CurrencyList($cnd, ['calcTotal' => true]);
if ($data = $money->getListviewData()) if ($data = $money->getListviewData())
{ {
@@ -515,7 +515,7 @@ class SearchPage extends GenericPage
private function _searchItemset($cndBase, &$shared) // 5 Itemsets $searchMask & 0x0000020 private function _searchItemset($cndBase, &$shared) // 5 Itemsets $searchMask & 0x0000020
{ {
$cnd = array_merge($cndBase, [is_int($this->query) ? ['id', $this->query] : $this->createLookup()]); $cnd = array_merge($cndBase, [is_int($this->query) ? ['id', $this->query] : $this->createLookup()]);
$sets = new ItemsetList($cnd); $sets = new ItemsetList($cnd, ['calcTotal' => true]);
if ($data = $sets->getListviewData()) if ($data = $sets->getListviewData())
{ {
@@ -550,7 +550,7 @@ class SearchPage extends GenericPage
private function _searchItem($cndBase, &$shared) // 6 Items $searchMask & 0x0000040 private function _searchItem($cndBase, &$shared) // 6 Items $searchMask & 0x0000040
{ {
$miscData = []; $miscData = ['calcTotal' => true];
$cndAdd = empty($this->query) ? [] : (is_int($this->query) ? ['id', $this->query] : $this->createLookup()); $cndAdd = empty($this->query) ? [] : (is_int($this->query) ? ['id', $this->query] : $this->createLookup());
if (($this->searchMask & SEARCH_TYPE_JSON) && ($this->searchMask & 0x20) && !empty($shared['pcsToSet'])) if (($this->searchMask & SEARCH_TYPE_JSON) && ($this->searchMask & 0x20) && !empty($shared['pcsToSet']))
@@ -630,7 +630,7 @@ class SearchPage extends GenericPage
[['s.attributes0', 0x80, '&'], 0], [['s.attributes0', 0x80, '&'], 0],
$this->createLookup() $this->createLookup()
)); ));
$abilities = new SpellList($cnd); $abilities = new SpellList($cnd, ['calcTotal' => true]);
if ($data = $abilities->getListviewData()) if ($data = $abilities->getListviewData())
{ {
@@ -695,7 +695,7 @@ class SearchPage extends GenericPage
['s.typeCat', [-7, -2]], ['s.typeCat', [-7, -2]],
$this->createLookup() $this->createLookup()
)); ));
$talents = new SpellList($cnd); $talents = new SpellList($cnd, ['calcTotal' => true]);
if ($data = $talents->getListviewData()) if ($data = $talents->getListviewData())
{ {
@@ -746,7 +746,7 @@ class SearchPage extends GenericPage
['s.typeCat', -13], ['s.typeCat', -13],
$this->createLookup() $this->createLookup()
)); ));
$glyphs = new SpellList($cnd); $glyphs = new SpellList($cnd, ['calcTotal' => true]);
if ($data = $glyphs->getListviewData()) if ($data = $glyphs->getListviewData())
{ {
@@ -788,7 +788,7 @@ class SearchPage extends GenericPage
['s.typeCat', -11], ['s.typeCat', -11],
$this->createLookup() $this->createLookup()
)); ));
$prof = new SpellList($cnd); $prof = new SpellList($cnd, ['calcTotal' => true]);
if ($data = $prof->getListviewData()) if ($data = $prof->getListviewData())
{ {
@@ -830,7 +830,7 @@ class SearchPage extends GenericPage
['s.typeCat', [9, 11]], ['s.typeCat', [9, 11]],
$this->createLookup() $this->createLookup()
)); ));
$prof = new SpellList($cnd); $prof = new SpellList($cnd, ['calcTotal' => true]);
if ($data = $prof->getListviewData()) if ($data = $prof->getListviewData())
{ {
@@ -872,7 +872,7 @@ class SearchPage extends GenericPage
['s.typeCat', -6], ['s.typeCat', -6],
$this->createLookup() $this->createLookup()
)); ));
$vPets = new SpellList($cnd); $vPets = new SpellList($cnd, ['calcTotal' => true]);
if ($data = $vPets->getListviewData()) if ($data = $vPets->getListviewData())
{ {
@@ -914,7 +914,7 @@ class SearchPage extends GenericPage
['s.typeCat', -5], ['s.typeCat', -5],
$this->createLookup() $this->createLookup()
)); ));
$mounts = new SpellList($cnd); $mounts = new SpellList($cnd, ['calcTotal' => true]);
if ($data = $mounts->getListviewData()) if ($data = $mounts->getListviewData())
{ {
@@ -956,7 +956,7 @@ class SearchPage extends GenericPage
[['cuFlags', NPC_CU_DIFFICULTY_DUMMY, '&'], 0], // exclude difficulty entries [['cuFlags', NPC_CU_DIFFICULTY_DUMMY, '&'], 0], // exclude difficulty entries
$this->createLookup() $this->createLookup()
)); ));
$npcs = new CreatureList($cnd); $npcs = new CreatureList($cnd, ['calcTotal' => true]);
if ($data = $npcs->getListviewData()) if ($data = $npcs->getListviewData())
{ {
@@ -990,7 +990,7 @@ class SearchPage extends GenericPage
[['flags', CUSTOM_UNAVAILABLE | CUSTOM_DISABLED, '&'], 0], [['flags', CUSTOM_UNAVAILABLE | CUSTOM_DISABLED, '&'], 0],
$this->createLookup() $this->createLookup()
)); ));
$quests = new QuestList($cnd); $quests = new QuestList($cnd, ['calcTotal' => true]);
if ($data = $quests->getListviewData()) if ($data = $quests->getListviewData())
{ {
@@ -1023,7 +1023,7 @@ class SearchPage extends GenericPage
[['flags', ACHIEVEMENT_FLAG_COUNTER, '&'], 0], // not a statistic [['flags', ACHIEVEMENT_FLAG_COUNTER, '&'], 0], // not a statistic
$this->createLookup() $this->createLookup()
)); ));
$acvs = new AchievementList($cnd); $acvs = new AchievementList($cnd, ['calcTotal' => true]);
if ($data = $acvs->getListviewData()) if ($data = $acvs->getListviewData())
{ {
@@ -1063,7 +1063,7 @@ class SearchPage extends GenericPage
['flags', ACHIEVEMENT_FLAG_COUNTER, '&'], // is a statistic ['flags', ACHIEVEMENT_FLAG_COUNTER, '&'], // is a statistic
$this->createLookup() $this->createLookup()
)); ));
$stats = new AchievementList($cnd); $stats = new AchievementList($cnd, ['calcTotal' => true]);
if ($data = $stats->getListviewData()) if ($data = $stats->getListviewData())
{ {
@@ -1099,7 +1099,7 @@ class SearchPage extends GenericPage
private function _searchZone($cndBase) // 18 Zones $searchMask & 0x0040000 private function _searchZone($cndBase) // 18 Zones $searchMask & 0x0040000
{ {
$cnd = array_merge($cndBase, [$this->createLookup()]); $cnd = array_merge($cndBase, [$this->createLookup()]);
$zones = new ZoneList($cnd); $zones = new ZoneList($cnd, ['calcTotal' => true]);
if ($data = $zones->getListviewData()) if ($data = $zones->getListviewData())
{ {
@@ -1124,7 +1124,7 @@ class SearchPage extends GenericPage
private function _searchObject($cndBase) // 19 Objects $searchMask & 0x0080000 private function _searchObject($cndBase) // 19 Objects $searchMask & 0x0080000
{ {
$cnd = array_merge($cndBase, [$this->createLookup()]); $cnd = array_merge($cndBase, [$this->createLookup()]);
$objects = new GameObjectList($cnd); $objects = new GameObjectList($cnd, ['calcTotal' => true]);
if ($data = $objects->getListviewData()) if ($data = $objects->getListviewData())
{ {
@@ -1154,7 +1154,7 @@ class SearchPage extends GenericPage
private function _searchFaction($cndBase) // 20 Factions $searchMask & 0x0100000 private function _searchFaction($cndBase) // 20 Factions $searchMask & 0x0100000
{ {
$cnd = array_merge($cndBase, [$this->createLookup()]); $cnd = array_merge($cndBase, [$this->createLookup()]);
$factions = new FactionList($cnd); $factions = new FactionList($cnd, ['calcTotal' => true]);
if ($data = $factions->getListviewData()) if ($data = $factions->getListviewData())
{ {
@@ -1176,7 +1176,7 @@ class SearchPage extends GenericPage
private function _searchSkill($cndBase) // 21 Skills $searchMask & 0x0200000 private function _searchSkill($cndBase) // 21 Skills $searchMask & 0x0200000
{ {
$cnd = array_merge($cndBase, [$this->createLookup()]); $cnd = array_merge($cndBase, [$this->createLookup()]);
$skills = new SkillList($cnd); $skills = new SkillList($cnd, ['calcTotal' => true]);
if ($data = $skills->getListviewData()) if ($data = $skills->getListviewData())
{ {
@@ -1202,7 +1202,7 @@ class SearchPage extends GenericPage
private function _searchPet($cndBase) // 22 Pets $searchMask & 0x0400000 private function _searchPet($cndBase) // 22 Pets $searchMask & 0x0400000
{ {
$cnd = array_merge($cndBase, [$this->createLookup()]); $cnd = array_merge($cndBase, [$this->createLookup()]);
$pets = new PetList($cnd); $pets = new PetList($cnd, ['calcTotal' => true]);
if ($data = $pets->getListviewData()) if ($data = $pets->getListviewData())
{ {
@@ -1234,7 +1234,7 @@ class SearchPage extends GenericPage
['s.typeCat', -8], ['s.typeCat', -8],
$this->createLookup() $this->createLookup()
)); ));
$npcAbilities = new SpellList($cnd); $npcAbilities = new SpellList($cnd, ['calcTotal' => true]);
if ($data = $npcAbilities->getListviewData()) if ($data = $npcAbilities->getListviewData())
{ {
@@ -1283,7 +1283,7 @@ class SearchPage extends GenericPage
], ],
$this->createLookup() $this->createLookup()
)); ));
$misc = new SpellList($cnd); $misc = new SpellList($cnd, ['calcTotal' => true]);
if ($data = $misc->getListviewData()) if ($data = $misc->getListviewData())
{ {
@@ -1322,7 +1322,7 @@ class SearchPage extends GenericPage
private function _searchEmote($cndBase) // 25 Emotes $searchMask & 0x2000000 private function _searchEmote($cndBase) // 25 Emotes $searchMask & 0x2000000
{ {
$cnd = array_merge($cndBase, [$this->createLookup(['cmd', 'meToExt_loc'.User::$localeId, 'meToNone_loc'.User::$localeId, 'extToMe_loc'.User::$localeId, 'extToExt_loc'.User::$localeId, 'extToNone_loc'.User::$localeId])]); $cnd = array_merge($cndBase, [$this->createLookup(['cmd', 'meToExt_loc'.User::$localeId, 'meToNone_loc'.User::$localeId, 'extToMe_loc'.User::$localeId, 'extToExt_loc'.User::$localeId, 'extToNone_loc'.User::$localeId])]);
$emote = new EmoteList($cnd); $emote = new EmoteList($cnd, ['calcTotal' => true]);
if ($data = $emote->getListviewData()) if ($data = $emote->getListviewData())
{ {
@@ -1341,7 +1341,7 @@ class SearchPage extends GenericPage
private function _searchEnchantment($cndBase) // 26 Enchantments $searchMask & 0x4000000 private function _searchEnchantment($cndBase) // 26 Enchantments $searchMask & 0x4000000
{ {
$cnd = array_merge($cndBase, [$this->createLookup(['name_loc'.User::$localeId])]); $cnd = array_merge($cndBase, [$this->createLookup(['name_loc'.User::$localeId])]);
$enchantment = new EnchantmentList($cnd); $enchantment = new EnchantmentList($cnd, ['calcTotal' => true]);
if ($data = $enchantment->getListviewData()) if ($data = $enchantment->getListviewData())
{ {
@@ -1374,7 +1374,7 @@ class SearchPage extends GenericPage
private function _searchSound($cndBase) // 27 Sounds $searchMask & 0x8000000 private function _searchSound($cndBase) // 27 Sounds $searchMask & 0x8000000
{ {
$cnd = array_merge($cndBase, [$this->createLookup(['name'])]); $cnd = array_merge($cndBase, [$this->createLookup(['name'])]);
$sounds = new SoundList($cnd); $sounds = new SoundList($cnd, ['calcTotal' => true]);
if ($data = $sounds->getListviewData()) if ($data = $sounds->getListviewData())
{ {

View File

@@ -48,7 +48,7 @@ class SoundsPage extends GenericPage
$this->filter['query'] = $this->_get['filter']; $this->filter['query'] = $this->_get['filter'];
$tabData = []; $tabData = [];
$sounds = new SoundList($conditions); $sounds = new SoundList($conditions, ['calcTotal' => true]);
if (!$sounds->error) if (!$sounds->error)
{ {
$tabData['data'] = array_values($sounds->getListviewData()); $tabData['data'] = array_values($sounds->getListviewData());

View File

@@ -386,7 +386,7 @@ class SpellsPage extends GenericPage
if ($_ = $this->filterObj->getConditions()) if ($_ = $this->filterObj->getConditions())
$conditions[] = $_; $conditions[] = $_;
$spells = new SpellList($conditions); $spells = new SpellList($conditions, ['calcTotal' => true]);
$this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED)); $this->extendGlobalData($spells->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));

View File

@@ -179,8 +179,8 @@ class ZonePage extends GenericPage
if (!User::isInGroup(U_GROUP_STAFF)) if (!User::isInGroup(U_GROUP_STAFF))
$conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0]; $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
$objectSpawns = new GameObjectList($conditions); $objectSpawns = new GameObjectList($conditions, ['calcTotal' => true]);
$creatureSpawns = new CreatureList($conditions); $creatureSpawns = new CreatureList($conditions, ['calcTotal' => true]);
$atSpawns = new AreaTriggerList($conditions); $atSpawns = new AreaTriggerList($conditions);
$questsLV = $rewardsLV = []; $questsLV = $rewardsLV = [];

View File

@@ -53,7 +53,7 @@ CLISetup::registerSetup("build", new class extends SetupScript
sleep(2); sleep(2);
$tTabs = DB::Aowow()->select('SELECT tt.creatureFamilyMask, tt.textureFile, tt.tabNumber, cc.fileString FROM dbc_talenttab tt LEFT JOIN dbc_chrclasses cc ON cc.id = (LOG(2, tt.classMask) + 1)'); $tTabs = DB::Aowow()->select('SELECT tt.`creatureFamilyMask`, tt.`textureFile`, tt.`tabNumber`, cc.`fileString` FROM dbc_talenttab tt LEFT JOIN dbc_chrclasses cc ON cc.`id` = IF(tt.`classMask`, LOG(2, tt.`classMask`) + 1, 0)');
if (!$tTabs) if (!$tTabs)
{ {
CLI::write(' - TalentTab.dbc or ChrClasses.dbc is empty...?', CLI::LOG_ERROR); CLI::write(' - TalentTab.dbc or ChrClasses.dbc is empty...?', CLI::LOG_ERROR);

View File

@@ -18,16 +18,16 @@ CLISetup::registerSetup("sql", new class extends SetupScript
public function generate(array $ids = []) : bool public function generate(array $ids = []) : bool
{ {
$query['NPC'] = $query['NPC'] =
'SELECT 1 AS type, id AS typeId, quest AS questId, 1 AS method, 0 AS eventId FROM creature_queststarter UNION 'SELECT 1 AS `type`, `id` AS `typeId`, `quest` AS `questId`, 1 AS `method`, 0 AS `eventId` FROM creature_queststarter UNION
SELECT 1 AS type, id AS typeId, quest AS questId, 2 AS method, 0 AS eventId FROM creature_questender UNION SELECT 1 AS `type`, `id` AS `typeId`, `quest` AS `questId`, 2 AS `method`, 0 AS `eventId` FROM creature_questender UNION
SELECT 1 AS type, id AS typeId, quest AS questId, 1 AS method, eventEntry AS eventId FROM game_event_creature_quest'; SELECT 1 AS `type`, `id` AS `typeId`, `quest` AS `questId`, 1 AS `method`, `eventEntry` AS `eventId` FROM game_event_creature_quest';
$query['Object'] = $query['Object'] =
'SELECT 2 AS type, id AS typeId, quest AS questId, 1 AS method, 0 AS eventId FROM gameobject_queststarter UNION 'SELECT 2 AS `type`, `id` AS `typeId`, `quest` AS `questId`, 1 AS `method`, 0 AS `eventId` FROM gameobject_queststarter UNION
SELECT 2 AS type, id AS typeId, quest AS questId, 2 AS method, 0 AS eventId FROM gameobject_questender UNION SELECT 2 AS `type`, `id` AS `typeId`, `quest` AS `questId`, 2 AS `method`, 0 AS `eventId` FROM gameobject_questender UNION
SELECT 2 AS type, id AS typeId, quest AS questId, 1 AS method, eventEntry AS eventId FROM game_event_gameobject_quest'; SELECT 2 AS `type`, `id` AS `typeId`, `quest` AS `questId`, 1 AS `method`, `eventEntry` AS `eventId` FROM game_event_gameobject_quest';
$query['Item'] = 'SELECT 3 AS type, entry AS typeId, startquest AS questId, 1 AS method, 0 AS eventId FROM item_template WHERE startquest <> 0'; $query['Item'] = 'SELECT 3 AS `type`, `entry` AS `typeId`, `startquest` AS `questId`, 1 AS `method`, 0 AS `eventId` FROM item_template WHERE `startquest` <> 0';
DB::Aowow()->query('TRUNCATE ?_quests_startend'); DB::Aowow()->query('TRUNCATE ?_quests_startend');
@@ -37,11 +37,11 @@ CLISetup::registerSetup("sql", new class extends SetupScript
$data = DB::World()->select($q); $data = DB::World()->select($q);
foreach ($data as $d) foreach ($data as $d)
DB::Aowow()->query('INSERT INTO ?_quests_startend (?#) VALUES (?a) ON DUPLICATE KEY UPDATE method = method | VALUES(method), eventId = IF(eventId = 0, VALUES(eventId), eventId)', array_keys($d), array_values($d)); DB::Aowow()->query('INSERT INTO ?_quests_startend (?#) VALUES (?a) AS newQSE(`t`, `ti`, `qi`, `m`, `ei`) ON DUPLICATE KEY UPDATE `method` = `method` | newQSE.`m`, `eventId` = IF(`eventId` = 0, newQSE.`ei`, `eventId`)', array_keys($d), array_values($d));
} }
// update quests without start as unavailable // update quests without start as unavailable
Db::Aowow()->query('UPDATE ?_quests q LEFT JOIN ?_quests_startend qse ON qse.questId = q.id AND qse.method & 1 SET q.cuFlags = q.cuFlags | ?d WHERE qse.questId IS NULL', CUSTOM_UNAVAILABLE); Db::Aowow()->query('UPDATE ?_quests q LEFT JOIN ?_quests_startend qse ON qse.`questId` = q.`id` AND qse.`method` & 1 SET q.`cuFlags` = q.`cuFlags` | ?d WHERE qse.`questId` IS NULL', CUSTOM_UNAVAILABLE);
return true; return true;
} }

View File

@@ -434,17 +434,17 @@ CLISetup::registerSetup("sql", new class extends SetupScript
$quests = DB::World()->select( $quests = DB::World()->select(
'SELECT n.`item` AS ARRAY_KEY, n.`Id` AS `quest`, SUM(n.`qty`) AS `qty`, BIT_OR(n.`side`) AS `side`, IF(COUNT(DISTINCT `zone`) > 1, 0, `zone`) AS `zone`, it.`class`, it.`subclass`, it.`spellid_1`, it.`spelltrigger_1`, it.`spellid_2`, it.`spelltrigger_2` 'SELECT n.`item` AS ARRAY_KEY, n.`Id` AS `quest`, SUM(n.`qty`) AS `qty`, BIT_OR(n.`side`) AS `side`, IF(COUNT(DISTINCT `zone`) > 1, 0, `zone`) AS `zone`, it.`class`, it.`subclass`, it.`spellid_1`, it.`spelltrigger_1`, it.`spellid_2`, it.`spelltrigger_2`
FROM (SELECT `RewardChoiceItemID1` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardChoiceItemID1` > 0 GROUP BY `item` UNION FROM (SELECT `RewardChoiceItemID1` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardChoiceItemID1` > 0 GROUP BY `item` UNION
SELECT `RewardChoiceItemID2` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardChoiceItemID2` > 0 GROUP BY `item` UNION SELECT `RewardChoiceItemID2` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardChoiceItemID2` > 0 GROUP BY `item` UNION
SELECT `RewardChoiceItemID3` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardChoiceItemID3` > 0 GROUP BY `item` UNION SELECT `RewardChoiceItemID3` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardChoiceItemID3` > 0 GROUP BY `item` UNION
SELECT `RewardChoiceItemID4` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardChoiceItemID4` > 0 GROUP BY `item` UNION SELECT `RewardChoiceItemID4` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardChoiceItemID4` > 0 GROUP BY `item` UNION
SELECT `RewardChoiceItemID5` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardChoiceItemID5` > 0 GROUP BY `item` UNION SELECT `RewardChoiceItemID5` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardChoiceItemID5` > 0 GROUP BY `item` UNION
SELECT `RewardChoiceItemID6` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardChoiceItemID6` > 0 GROUP BY `item` UNION SELECT `RewardChoiceItemID6` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardChoiceItemID6` > 0 GROUP BY `item` UNION
SELECT `RewardItem1` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardItem1` > 0 GROUP BY `item` UNION SELECT `RewardItem1` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardItem1` > 0 GROUP BY `item` UNION
SELECT `RewardItem2` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardItem2` > 0 GROUP BY `item` UNION SELECT `RewardItem2` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardItem2` > 0 GROUP BY `item` UNION
SELECT `RewardItem3` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardItem3` > 0 GROUP BY `item` UNION SELECT `RewardItem3` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardItem3` > 0 GROUP BY `item` UNION
SELECT `RewardItem4` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardItem4` > 0 GROUP BY `item` UNION SELECT `RewardItem4` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `RewardItem4` > 0 GROUP BY `item` UNION
SELECT `StartItem` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `StartItem` > 0 GROUP BY `item`) n SELECT `StartItem` AS `item`, `ID`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, ?d)) AS `side`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone` FROM quest_template WHERE `StartItem` > 0 GROUP BY `item`) n
JOIN item_template it ON it.`entry` = n.`item` JOIN item_template it ON it.`entry` = n.`item`
GROUP BY `item`', GROUP BY `item`',
RACE_MASK_HORDE, RACE_MASK_ALLIANCE, SIDE_HORDE, RACE_MASK_ALLIANCE, RACE_MASK_HORDE, SIDE_ALLIANCE, SIDE_BOTH, RACE_MASK_HORDE, RACE_MASK_ALLIANCE, SIDE_HORDE, RACE_MASK_ALLIANCE, RACE_MASK_HORDE, SIDE_ALLIANCE, SIDE_BOTH,
@@ -473,7 +473,7 @@ CLISetup::registerSetup("sql", new class extends SetupScript
} }
$mailLoot = DB::World()->select( $mailLoot = DB::World()->select(
'SELECT IF(mlt.`Reference` > 0, -mlt.`Reference`, mlt.`Item`) AS ARRAY_KEY, qt.`Id` AS `entry`, it.`class`, it.`subclass`, it.`spellid_1`, it.`spelltrigger_1`, it.`spellid_2`, it.`spelltrigger_2`, COUNT(1) AS `qty`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone`, BIT_OR(IF(qt.`AllowableRaces` & ?d AND !(qt.`AllowableRaces` & ?d), ?d, IF(qt.`AllowableRaces` & ?d AND !(qt.`AllowableRaces` & ?d), ?d, ?d))) AS `side` 'SELECT IF(mlt.`Reference` > 0, -mlt.`Reference`, mlt.`Item`) AS ARRAY_KEY, qt.`Id` AS `entry`, it.`class`, it.`subclass`, it.`spellid_1`, it.`spelltrigger_1`, it.`spellid_2`, it.`spelltrigger_2`, COUNT(1) AS `qty`, IF(COUNT(DISTINCT `QuestSortID`) > 1, 0, GREATEST(`QuestSortID`, 0)) AS `zone`, BIT_OR(IF(qt.`AllowableRaces` & ?d AND NOT (qt.`AllowableRaces` & ?d), ?d, IF(qt.`AllowableRaces` & ?d AND NOT (qt.`AllowableRaces` & ?d), ?d, ?d))) AS `side`
FROM mail_loot_template mlt FROM mail_loot_template mlt
JOIN quest_template_addon qta ON qta.`RewardMailTemplateId` = mlt.`entry` JOIN quest_template_addon qta ON qta.`RewardMailTemplateId` = mlt.`entry`
JOIN quest_template qt ON qt.`ID` = qta.`ID` JOIN quest_template qt ON qt.`ID` = qta.`ID`
@@ -1009,8 +1009,8 @@ CLISetup::registerSetup("sql", new class extends SetupScript
$quests = DB::World()->select( $quests = DB::World()->select(
'SELECT `spell` AS ARRAY_KEY, `id`, SUM(`qty`) AS `qty`, BIT_OR(`side`) AS `side`, IF(COUNT(DISTINCT `zone`) > 1, 0, `zone`) AS `zone` 'SELECT `spell` AS ARRAY_KEY, `id`, SUM(`qty`) AS `qty`, BIT_OR(`side`) AS `side`, IF(COUNT(DISTINCT `zone`) > 1, 0, `zone`) AS `zone`
FROM (SELECT IF(`RewardSpell` = 0, `RewardDisplaySpell`, `RewardSpell`) AS `spell`, `Id`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, ?d)) AS `side`, GREATEST(`QuestSortID`, 0) AS `zone` FROM quest_template WHERE IF(`RewardSpell` = 0, `RewardDisplaySpell`, `RewardSpell`) > 0 GROUP BY `spell` UNION FROM (SELECT IF(`RewardSpell` = 0, `RewardDisplaySpell`, `RewardSpell`) AS `spell`, `Id`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, ?d)) AS `side`, GREATEST(`QuestSortID`, 0) AS `zone` FROM quest_template WHERE IF(`RewardSpell` = 0, `RewardDisplaySpell`, `RewardSpell`) > 0 GROUP BY `spell` UNION
SELECT qta.`SourceSpellId` AS `spell`, qt.`Id`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, ?d)) AS `side`, GREATEST(`QuestSortID`, 0) AS `zone` FROM quest_template qt JOIN quest_template_addon qta ON qta.ID = qt.ID WHERE qta.`SourceSpellId` > 0 GROUP BY `spell`) t SELECT qta.`SourceSpellId` AS `spell`, qt.`Id`, COUNT(1) AS `qty`, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, ?d)) AS `side`, GREATEST(`QuestSortID`, 0) AS `zone` FROM quest_template qt JOIN quest_template_addon qta ON qta.ID = qt.ID WHERE qta.`SourceSpellId` > 0 GROUP BY `spell`) t
GROUP BY `spell`', GROUP BY `spell`',
RACE_MASK_HORDE, RACE_MASK_ALLIANCE, SIDE_HORDE, RACE_MASK_ALLIANCE, RACE_MASK_HORDE, SIDE_ALLIANCE, SIDE_BOTH, RACE_MASK_HORDE, RACE_MASK_ALLIANCE, SIDE_HORDE, RACE_MASK_ALLIANCE, RACE_MASK_HORDE, SIDE_ALLIANCE, SIDE_BOTH,
RACE_MASK_HORDE, RACE_MASK_ALLIANCE, SIDE_HORDE, RACE_MASK_ALLIANCE, RACE_MASK_HORDE, SIDE_ALLIANCE, SIDE_BOTH RACE_MASK_HORDE, RACE_MASK_ALLIANCE, SIDE_HORDE, RACE_MASK_ALLIANCE, RACE_MASK_HORDE, SIDE_ALLIANCE, SIDE_BOTH
@@ -1140,7 +1140,7 @@ CLISetup::registerSetup("sql", new class extends SetupScript
$quests = DB::World()->select( $quests = DB::World()->select(
'SELECT `RewardTitle` AS ARRAY_KEY, `ID` AS `id`, SUM(`qty`) AS `qty`, BIT_OR(`side`) AS `side`, IF(COUNT(DISTINCT `zone`) > 1, 0, `zone`) AS `zone` 'SELECT `RewardTitle` AS ARRAY_KEY, `ID` AS `id`, SUM(`qty`) AS `qty`, BIT_OR(`side`) AS `side`, IF(COUNT(DISTINCT `zone`) > 1, 0, `zone`) AS `zone`
FROM (SELECT `RewardTitle`, `ID`, 1 AS `qty`, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND !(`AllowableRaces` & ?d), ?d, ?d)) AS `side`, GREATEST(`QuestSortID`, 0) AS `zone` FROM quest_template WHERE `RewardTitle` > 0) q FROM (SELECT `RewardTitle`, `ID`, 1 AS `qty`, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, IF(`AllowableRaces` & ?d AND NOT (`AllowableRaces` & ?d), ?d, ?d)) AS `side`, GREATEST(`QuestSortID`, 0) AS `zone` FROM quest_template WHERE `RewardTitle` > 0) q
GROUP BY `RewardTitle`', GROUP BY `RewardTitle`',
RACE_MASK_HORDE, RACE_MASK_ALLIANCE, SIDE_HORDE, RACE_MASK_ALLIANCE, RACE_MASK_HORDE, SIDE_ALLIANCE, SIDE_BOTH RACE_MASK_HORDE, RACE_MASK_ALLIANCE, SIDE_HORDE, RACE_MASK_ALLIANCE, RACE_MASK_HORDE, SIDE_ALLIANCE, SIDE_BOTH
); );