From 3a982018372e1f9adac6ddb75b4aa3e49a0e4c23 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Tue, 8 Mar 2022 18:52:01 +0100 Subject: [PATCH 1/2] Zones/Locations * fixed Quick Info defaulting expansion maps to have [0, 0, 0] as parent * corrected looking for custom excluded flag when collecting instances for area --- pages/zone.php | 2 +- setup/tools/sqlgen/zones.func.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/zone.php b/pages/zone.php index 9158663f..45c3ac20 100644 --- a/pages/zone.php +++ b/pages/zone.php @@ -109,7 +109,7 @@ class ZonePage extends GenericPage } // Instances - if ($_ = DB::Aowow()->selectCol('SELECT id FROM ?_zones WHERE parentAreaId = ?d AND (flags & ?d) = 0', $this->typeId, CUSTOM_EXCLUDE_FOR_LISTVIEW)) + if ($_ = DB::Aowow()->selectCol('SELECT `id` FROM ?_zones WHERE `parentAreaId` = ?d AND (`cuFlags` & ?d) = 0', $this->typeId, CUSTOM_EXCLUDE_FOR_LISTVIEW)) { $this->extendGlobalIds(TYPE_ZONE, ...$_); $infobox[] = Lang::maps('Instances').Lang::main('colon')."\n[zone=".implode("], \n[zone=", $_).']'; diff --git a/setup/tools/sqlgen/zones.func.php b/setup/tools/sqlgen/zones.func.php index d2c45337..bfb54299 100644 --- a/setup/tools/sqlgen/zones.func.php +++ b/setup/tools/sqlgen/zones.func.php @@ -115,7 +115,7 @@ SqlGen::register(new class extends SetupScript foreach ($baseData as &$bd) { - if (!in_array($bd['parentMapId'], [0, 1, 530, 571])) + if (in_array($bd['mapBak'], [0, 1, 530, 571])) continue; if ($gPos = Game::worldPosToZonePos($bd['parentMapId'], $bd['parentY'], $bd['parentX'])) From 65bfd9376156f5681b1f09ada82e5cf242ba3410 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sun, 6 Feb 2022 19:05:55 +0100 Subject: [PATCH 2/2] Profiler * truncate local profile if sync with game server fails (entry deleted) * do not use chars/guilds/arena teams with empty names --- includes/profiler.class.php | 20 +++++++++++++++++++- includes/types/arenateam.class.php | 10 +++++++++- includes/types/guild.class.php | 10 +++++++++- includes/types/profile.class.php | 10 +++++++++- prQueue | 9 +++++---- 5 files changed, 51 insertions(+), 8 deletions(-) diff --git a/includes/profiler.class.php b/includes/profiler.class.php index 76db217b..55fd44f3 100644 --- a/includes/profiler.class.php +++ b/includes/profiler.class.php @@ -300,6 +300,12 @@ class Profiler if (!$char) return false; + if (!$char['name']) + { + trigger_error('char #'.$charGuid.' on realm #'.$realmId.' has empty name. skipping...', E_USER_WARNING); + return false; + } + // reminder: this query should not fail: a placeholder entry is created as soon as a char listview is created or profile detail page is called $profile = DB::Aowow()->selectRow('SELECT id, lastupdated FROM ?_profiler_profiles WHERE realm = ?d AND realmGUID = ?d', $realmId, $char['guid']); if (!$profile) @@ -431,7 +437,7 @@ class Profiler // char is flagged for rename if ($char['at_login'] & 0x1) { - $ri = DB::Aowow()->selectCell('SELECT MAX(renameItr) FROM ?_profiler_profiles WHERE realm = ?d AND realmGUID = ?d AND name = ?', $realmId, $charGuid, $char['name']); + $ri = DB::Aowow()->selectCell('SELECT MAX(renameItr) FROM ?_profiler_profiles WHERE realm = ?d AND realmGUID IS NOT NULL AND name = ?', $realmId, $char['name']); $data['renameItr'] = $ri ? ++$ri : 1; } @@ -773,6 +779,12 @@ class Profiler if (!$guild) return false; + if (!$guild['name']) + { + trigger_error('guild #'.$guildGuid.' on realm #'.$realmId.' has empty name. skipping...', E_USER_WARNING); + return false; + } + // 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']); @@ -834,6 +846,12 @@ class Profiler if (!$team) return false; + if (!$team['name']) + { + trigger_error('arena team #'.$teamGuid.' on realm #'.$realmId.' has empty name. skipping...', E_USER_WARNING); + return false; + } + // 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 $teamId = DB::Aowow()->selectCell('SELECT id FROM ?_profiler_arena_team WHERE realm = ?d AND realmGUID = ?d', $realmId, $team['arenaTeamId']); diff --git a/includes/types/arenateam.class.php b/includes/types/arenateam.class.php index a2e8bcc2..8007107d 100644 --- a/includes/types/arenateam.class.php +++ b/includes/types/arenateam.class.php @@ -167,7 +167,15 @@ class RemoteArenaTeamList extends ArenaTeamList } else { - trigger_error('arena team "'.$curTpl['name'].'" belongs to nonexistant realm #'.$r, E_USER_WARNING); + trigger_error('arena team #'.$guid.' belongs to nonexistant realm #'.$r, E_USER_WARNING); + unset($this->templates[$guid]); + continue; + } + + // empty name + if (!$curTpl['name']) + { + trigger_error('arena team #'.$guid.' on realm #'.$r.' has empty name.', E_USER_WARNING); unset($this->templates[$guid]); continue; } diff --git a/includes/types/guild.class.php b/includes/types/guild.class.php index c219e360..981cc3bf 100644 --- a/includes/types/guild.class.php +++ b/includes/types/guild.class.php @@ -196,7 +196,15 @@ class RemoteGuildList extends GuildList } else { - trigger_error('character "'.$curTpl['name'].'" belongs to nonexistant realm #'.$r, E_USER_WARNING); + trigger_error('guild #'.$guid.' belongs to nonexistant realm #'.$r, E_USER_WARNING); + unset($this->templates[$guid]); + continue; + } + + // empty name + if (!$curTpl['name']) + { + trigger_error('guild #'.$guid.' on realm #'.$r.' has empty name.', E_USER_WARNING); unset($this->templates[$guid]); continue; } diff --git a/includes/types/profile.class.php b/includes/types/profile.class.php index 77cd62c3..b760d90b 100644 --- a/includes/types/profile.class.php +++ b/includes/types/profile.class.php @@ -573,7 +573,15 @@ class RemoteProfileList extends ProfileList } else { - trigger_error('character "'.$curTpl['name'].'" belongs to nonexistant realm #'.$r, E_USER_WARNING); + trigger_error('char #'.$guid.' belongs to nonexistant realm #'.$r, E_USER_WARNING); + unset($this->templates[$guid]); + continue; + } + + // empty name + if (!$curTpl['name']) + { + trigger_error('char #'.$guid.' on realm #'.$r.' has empty name.', E_USER_WARNING); unset($this->templates[$guid]); continue; } diff --git a/prQueue b/prQueue index 0ed859a2..716a6e8a 100755 --- a/prQueue +++ b/prQueue @@ -33,11 +33,10 @@ $error = function ($type, $realmGUID, $realmId) if ($type == TYPE_GUILD) $what = 'guild'; if ($type == TYPE_ARENA_TEAM) - $what = 'arena team'; + $what = 'arena team'; DB::Aowow()->query('UPDATE ?_profiler_sync SET status = ?d, errorCode = ?d WHERE realm = ?d AND realmGUID = ?d AND type = ?d', PR_QUEUE_STATUS_ERROR, PR_QUEUE_ERROR_CHAR, $realmId, $realmGUID, $type); - trigger_error('prQueue - unknown '.$what.' guid #'.$realmGUID.' on realm #'.$realmId.' to sync into profiler.', E_USER_WARNING); - CLI::write('unknown '.$what.' guid #'.$realmGUID.' on realm #'.$realmId.' to sync into profiler.', CLI::LOG_WARN); + trigger_error('prQueue - '.$what.' #'.$realmGUID.' on realm #'.$realmId.' not found. Truncating local placeholder.', E_USER_WARNING); }; @@ -78,6 +77,7 @@ while (DB::Aowow()->selectCell('SELECT value FROM ?_config WHERE `key` = "profil if (!Profiler::getCharFromRealm($row['realm'], $row['realmGUID'])) { $error(TYPE_PROFILE, $row['realmGUID'], $row['realm']); + DB::Aowow()->query('DELETE FROM ?_profiler_profiles WHERE realm = ?d AND realmGUID = ?d', $row['realm'], $row['realmGUID']); continue 2; } @@ -86,6 +86,7 @@ while (DB::Aowow()->selectCell('SELECT value FROM ?_config WHERE `key` = "profil if (!Profiler::getGuildFromRealm($row['realm'], $row['realmGUID'])) { $error(TYPE_GUILD, $row['realmGUID'], $row['realm']); + DB::Aowow()->query('DELETE FROM ?_profiler_guild WHERE realm = ?d AND realmGUID = ?d', $row['realm'], $row['realmGUID']); continue 2; } @@ -94,6 +95,7 @@ while (DB::Aowow()->selectCell('SELECT value FROM ?_config WHERE `key` = "profil if (!Profiler::getArenaTeamFromRealm($row['realm'], $row['realmGUID'])) { $error(TYPE_ARENA_TEAM, $row['realmGUID'], $row['realm']); + DB::Aowow()->query('DELETE FROM ?_profiler_arena_team WHERE realm = ?d AND realmGUID = ?d', $row['realm'], $row['realmGUID']); continue 2; } @@ -101,7 +103,6 @@ while (DB::Aowow()->selectCell('SELECT value FROM ?_config WHERE `key` = "profil default: DB::Aowow()->query('DELETE FROM ?_profiler_sync WHERE realm = ?d AND type = ?d AND typeId = ?d', $row['realm'], $row['type'], $row['typeId']); trigger_error('prQueue - unknown type #'.$row['type'].' to sync into profiler. Removing from queue...', E_USER_ERROR); - CLI::write('unknown type #'.$row['type'].' to sync into profiler. Removing from queue...', CLI::LOG_ERROR); } $tCycle = microtime(true);