Setup/Log

* allow overwriting generic/fine log output
 * fix some errors
 * can't catch notices generated by mysqli_connect
 * removed some unnessecary ORDER from querys
This commit is contained in:
Sarjuuk
2023-04-25 20:34:27 +02:00
parent acb9c60c9a
commit 40014755e2
19 changed files with 122 additions and 112 deletions

View File

@@ -56,16 +56,15 @@ class DB
if (strstr($options['host'], ':')) if (strstr($options['host'], ':'))
[$options['host'], $port] = explode(':', $options['host']); [$options['host'], $port] = explode(':', $options['host']);
try { if ($link = @mysqli_connect($options['host'], $options['user'], $options['pass'], $options['db'], $port ?: $defPort))
$link = @mysqli_connect($options['host'], $options['user'], $options['pass'], $options['db'], $port ?: $defPort);
mysqli_close($link); mysqli_close($link);
} else
catch (Exception $e)
{ {
$err = '['.mysqli_connect_errno().'] '.mysqli_connect_error(); $err = '['.mysqli_connect_errno().'] '.mysqli_connect_error();
return false; return false;
} }
return true;
return true;
} }
public static function errorHandler($message, $data) public static function errorHandler($message, $data)

View File

@@ -141,6 +141,7 @@ abstract class CLI
private static $logHandle = null; private static $logHandle = null;
private static $hasReadline = null; private static $hasReadline = null;
private static $overwriteLast = false;
/********************/ /********************/
/* formatted output */ /* formatted output */
@@ -232,7 +233,7 @@ abstract class CLI
return OS_WIN ? $str : "\e[1m".$str."\e[0m"; return OS_WIN ? $str : "\e[1m".$str."\e[0m";
} }
public static function write(string $txt = '', int $lvl = self::LOG_BLANK, bool $timestamp = true) : void public static function write(string $txt = '', int $lvl = self::LOG_BLANK, bool $timestamp = true, bool $tmpRow = false) : void
{ {
$msg = ''; $msg = '';
if ($txt) if ($txt)
@@ -259,15 +260,16 @@ abstract class CLI
break; break;
} }
$msg .= $txt."\n"; $msg .= $txt;
} }
else
$msg = "\n"; $msg = (self::$overwriteLast && !OS_WIN ? "\e[1G\e[0K" : "\n") . $msg;
self::$overwriteLast = $tmpRow;
echo $msg; echo $msg;
if (self::$logHandle) // remove highlights for logging if (self::$logHandle) // remove control sequences from log
fwrite(self::$logHandle, preg_replace(["/\e\[\d+m/", "/\e\[0m/"], '', $msg)); fwrite(self::$logHandle, preg_replace(["/\e\[\d+[mK]/", "/\e\[\d+G/"], ['', "\n"], $msg));
flush(); flush();
} }

View File

@@ -313,7 +313,7 @@ class CLISetup
{ {
if (Util::writeFile($file, $content)) if (Util::writeFile($file, $content))
{ {
CLI::write(sprintf(ERR_NONE, CLI::bold($file)), CLI::LOG_OK); CLI::write(sprintf(ERR_NONE, CLI::bold($file)), CLI::LOG_OK, true, true);
return true; return true;
} }

View File

@@ -49,7 +49,6 @@ function dbconfig() : void
while (true) while (true)
{ {
CLI::write();
CLI::write("select a numerical index to use the corresponding entry"); CLI::write("select a numerical index to use the corresponding entry");
$nCharDBs = 0; $nCharDBs = 0;
@@ -63,6 +62,7 @@ function dbconfig() : void
} }
CLI::write("[".CLI::bold(3 + $nCharDBs)."] add an additional Character DB"); CLI::write("[".CLI::bold(3 + $nCharDBs)."] add an additional Character DB");
CLI::write();
while (true) while (true)
{ {
@@ -127,8 +127,8 @@ function dbconfig() : void
} }
else else
{ {
CLI::write();
CLI::write("edit canceled! returning to list...", CLI::LOG_INFO); CLI::write("edit canceled! returning to list...", CLI::LOG_INFO);
CLI::write();
sleep(1); sleep(1);
continue 2; continue 2;
} }
@@ -136,8 +136,8 @@ function dbconfig() : void
} }
else else
{ {
CLI::write();
CLI::write("leaving db setup...", CLI::LOG_INFO); CLI::write("leaving db setup...", CLI::LOG_INFO);
CLI::write();
break 2; break 2;
} }
} }

View File

@@ -18,8 +18,8 @@ function siteconfig() : void
if (!DB::isConnectable(DB_AOWOW)) if (!DB::isConnectable(DB_AOWOW))
{ {
CLI::write();
CLI::write("database not yet set up!\n Please use --dbconfig for setup", CLI::LOG_WARN); CLI::write("database not yet set up!\n Please use --dbconfig for setup", CLI::LOG_WARN);
CLI::write();
return; return;
} }
@@ -82,8 +82,8 @@ function siteconfig() : void
while (true) while (true)
{ {
CLI::write();
CLI::write('select a numerical index to use the corresponding entry'); CLI::write('select a numerical index to use the corresponding entry');
CLI::write();
$sumNum = 0; $sumNum = 0;
$cfgList = []; $cfgList = [];
@@ -161,11 +161,12 @@ function siteconfig() : void
CLI::write($b); CLI::write($b);
CLI::write(str_pad("[".CLI::bold($sumNum)."]", 21)."add another php configuration"); CLI::write(str_pad("[".CLI::bold($sumNum)."]", 21)."add another php configuration");
CLI::write();
if ($hasEmpty) if ($hasEmpty)
{ {
CLI::write("please configure the required empty settings", CLI::LOG_WARN);
CLI::write(); CLI::write();
CLI::write("please configure the required empty setings", CLI::LOG_WARN);
} }
$inp = ['idx' => ['', false, '/\d/']]; $inp = ['idx' => ['', false, '/\d/']];
@@ -174,8 +175,8 @@ function siteconfig() : void
// add new php setting // add new php setting
if ($inp['idx'] == $sumNum) if ($inp['idx'] == $sumNum)
{ {
CLI::write();
CLI::write("Adding additional php configuration."); CLI::write("Adding additional php configuration.");
CLI::write();
while (true) while (true)
{ {
@@ -185,8 +186,6 @@ function siteconfig() : void
); );
if (CLI::read($setting) && $setting) if (CLI::read($setting) && $setting)
{ {
CLI::write();
$key = strtolower($setting['key']); $key = strtolower($setting['key']);
if (ini_get($key) === false || ini_set($key, $setting['val']) === false) if (ini_get($key) === false || ini_set($key, $setting['val']) === false)
{ {
@@ -205,12 +204,13 @@ function siteconfig() : void
sleep(1); sleep(1);
} }
CLI::write();
break; break;
} }
else else
{ {
CLI::write();
CLI::write("edit canceled! returning to list...", CLI::LOG_INFO); CLI::write("edit canceled! returning to list...", CLI::LOG_INFO);
CLI::write();
sleep(1); sleep(1);
break; break;
} }
@@ -224,7 +224,6 @@ function siteconfig() : void
$key = strtolower($conf['key']); $key = strtolower($conf['key']);
$buff = ''; $buff = '';
CLI::write();
$buff .= $conf['flags'] & CON_FLAG_PHP ? " PHP: " : "AOWOW: "; $buff .= $conf['flags'] & CON_FLAG_PHP ? " PHP: " : "AOWOW: ";
$buff .= $conf['flags'] & CON_FLAG_PHP ? $key : strtoupper('cfg_'.$conf['key']); $buff .= $conf['flags'] & CON_FLAG_PHP ? $key : strtoupper('cfg_'.$conf['key']);
@@ -232,6 +231,7 @@ function siteconfig() : void
$buff .= " - ".$info[1]; $buff .= " - ".$info[1];
CLI::write($buff); CLI::write($buff);
CLI::write();
$buff = "VALUE: "; $buff = "VALUE: ";
@@ -270,6 +270,8 @@ function siteconfig() : void
if (strstr($info[0], 'default:')) if (strstr($info[0], 'default:'))
CLI::write("[".CLI::bold('R')."]estore Default - ".trim(explode('default:', $info[0])[1])); CLI::write("[".CLI::bold('R')."]estore Default - ".trim(explode('default:', $info[0])[1]));
CLI::write();
while (true) while (true)
{ {
$action = ['idx' => ['', true, '/[edr]/i']]; $action = ['idx' => ['', true, '/[edr]/i']];
@@ -306,7 +308,7 @@ function siteconfig() : void
CLI::write('['.CLI::bold(1 << $opt[0]).']'.str_pad('', 4-strlen(1 << $opt[0])).$opt[1]); CLI::write('['.CLI::bold(1 << $opt[0]).']'.str_pad('', 4-strlen(1 << $opt[0])).$opt[1]);
} }
$pattern = '/\d+/'; $pattern = '/\d+/';
$validate = function ($v) use($_valid) { $v = $v & $_valid; return $v; }; $validate = function ($v) use($_valid) { $v = ($v ?: 0) & $_valid; return $v; };
} }
else if ($conf['flags'] & CON_FLAG_TYPE_BOOL) else if ($conf['flags'] & CON_FLAG_TYPE_BOOL)
{ {
@@ -395,8 +397,8 @@ function siteconfig() : void
} }
else else
{ {
CLI::write();
CLI::write('edit canceled! returning to list...', CLI::LOG_INFO); CLI::write('edit canceled! returning to list...', CLI::LOG_INFO);
CLI::write();
sleep(1); sleep(1);
break; break;
} }
@@ -404,15 +406,15 @@ function siteconfig() : void
} }
else else
{ {
CLI::write();
CLI::write('invalid selection', CLI::LOG_ERROR); CLI::write('invalid selection', CLI::LOG_ERROR);
CLI::write();
sleep(1); sleep(1);
} }
} }
else else
{ {
CLI::write();
CLI::write('leaving site configuration...', CLI::LOG_INFO); CLI::write('leaving site configuration...', CLI::LOG_INFO);
CLI::write();
break; break;
} }

View File

@@ -143,7 +143,7 @@ if (!CLI)
if ($ok) if ($ok)
{ {
chmod($name.'.'.$ext, Util::FILE_ACCESS); chmod($name.'.'.$ext, Util::FILE_ACCESS);
CLI::write($done.' - image '.$name.'.'.$ext.' written', CLI::LOG_OK); CLI::write($done.' - image '.$name.'.'.$ext.' written', CLI::LOG_OK, true, true);
} }
else else
CLI::write($done.' - could not create image '.$name.'.'.$ext, CLI::LOG_ERROR); CLI::write($done.' - could not create image '.$name.'.'.$ext, CLI::LOG_ERROR);
@@ -314,7 +314,7 @@ if (!CLI)
if (!CLISetup::getOpt('force') && file_exists($name.'.jpg')) if (!CLISetup::getOpt('force') && file_exists($name.'.jpg'))
{ {
CLI::write($done.' - file '.$name.'.jpg was already processed'); CLI::write($done.' - file '.$name.'.jpg was already processed', CLI::LOG_BLANK, true, true);
continue; continue;
} }
@@ -566,7 +566,7 @@ if (!CLI)
if (!CLISetup::getOpt('force') && file_exists($outFile[$idx].'.'.$info[1])) if (!CLISetup::getOpt('force') && file_exists($outFile[$idx].'.'.$info[1]))
{ {
CLI::write($progress.' - file '.$outFile[$idx].'.'.$info[1].' was already processed'); CLI::write($progress.' - file '.$outFile[$idx].'.'.$info[1].' was already processed', CLI::LOG_BLANK, true, true);
$doSkip |= (1 << $idx); $doSkip |= (1 << $idx);
} }
} }
@@ -615,7 +615,7 @@ if (!CLI)
$outFile[$idx] = $destDir . sprintf($info[0], strtolower(Util::$localeStrings[$l]).'/') . $row['areaTableId']; $outFile[$idx] = $destDir . sprintf($info[0], strtolower(Util::$localeStrings[$l]).'/') . $row['areaTableId'];
if (!CLISetup::getOpt('force') && file_exists($outFile[$idx].'.'.$info[1])) if (!CLISetup::getOpt('force') && file_exists($outFile[$idx].'.'.$info[1]))
{ {
CLI::write($progress.' - file '.$outFile[$idx].'.'.$info[1].' was already processed'); CLI::write($progress.' - file '.$outFile[$idx].'.'.$info[1].' was already processed', CLI::LOG_BLANK, true, true);
$doSkip |= (1 << $idx); $doSkip |= (1 << $idx);
} }
} }
@@ -715,7 +715,7 @@ if (!CLI)
if (!CLISetup::getOpt('force') && file_exists($name.'.png')) if (!CLISetup::getOpt('force') && file_exists($name.'.png'))
{ {
CLI::write($done.' - file '.$name.'.png was already processed'); CLI::write($done.' - file '.$name.'.png was already processed', CLI::LOG_BLANK, true, true);
continue; continue;
} }

View File

@@ -171,7 +171,7 @@ if (!CLI)
if ($ok) if ($ok)
{ {
chmod($name.$ext, Util::FILE_ACCESS); chmod($name.$ext, Util::FILE_ACCESS);
CLI::write($done.' - image '.$name.$ext.' written', CLI::LOG_OK); CLI::write($done.' - image '.$name.$ext.' written', CLI::LOG_OK, true, true);
} }
else else
CLI::write($done.' - could not create image '.$name.$ext, CLI::LOG_ERROR); CLI::write($done.' - could not create image '.$name.$ext, CLI::LOG_ERROR);
@@ -347,7 +347,7 @@ if (!CLI)
if (!CLISetup::getOpt('force') && file_exists($destDir.$dest.$img.$ext)) if (!CLISetup::getOpt('force') && file_exists($destDir.$dest.$img.$ext))
{ {
CLI::write($done.' - file '.$dest.$img.$ext.' was already processed'); CLI::write($done.' - file '.$dest.$img.$ext.' was already processed', CLI::LOG_BLANK, true, true);
continue; continue;
} }
@@ -416,7 +416,7 @@ if (!CLI)
if (!CLISetup::getOpt('force') && file_exists($destDir.$dest.$img.$ext)) if (!CLISetup::getOpt('force') && file_exists($destDir.$dest.$img.$ext))
{ {
CLI::write($done.' - file '.$dest.$img.$ext.' was already processed'); CLI::write($done.' - file '.$dest.$img.$ext.' was already processed', CLI::LOG_BLANK, true, true);
continue; continue;
} }

View File

@@ -13,16 +13,21 @@ if (!CLI)
// ALL files // ALL files
$files = DB::Aowow()->selectCol('SELECT ABS(id) AS ARRAY_KEY, CONCAT(path, "/", `file`) FROM ?_sounds_files'); $files = DB::Aowow()->selectCol('SELECT ABS(id) AS ARRAY_KEY, CONCAT(path, "/", `file`) FROM ?_sounds_files');
$nFiles = count($files); $nFiles = count($files);
$itr = $i = 0; $qtLen = strlen($nFiles);
$step = 1000; $sum = 0;
$intv = 0.5;
$time = microtime(true);
$sum = 0;
foreach ($files as $fileId => $filePath) foreach ($files as $fileId => $filePath)
{ {
$i++; $sum++;
$itr++; $newTime = microtime(true);
if ($i == $step) if ($newTime > $time + $intv)
{ {
$i = 0; CLI::write(sprintf(' * %'.$qtLen.'d / %d (%4.1f%%)', $sum, $nFiles, round(100 * $sum / $nFiles, 1)), CLI::LOG_BLANK, true, true);
CLI::write(' - '.$itr.'/'.$nFiles.' ('.(intVal(100 * $itr / $nFiles).'%) done')); $time = $newTime;
DB::Aowow()->selectCell('SELECT 1'); // keep mysql busy or it may go away DB::Aowow()->selectCell('SELECT 1'); // keep mysql busy or it may go away
} }
@@ -42,6 +47,7 @@ if (!CLI)
{ {
$ok = false; $ok = false;
CLI::write(' - could not copy '.CLI::bold($p).' into '.CLI::bold('static/wowsounds/'.$fileId), CLI::LOG_ERROR); CLI::write(' - could not copy '.CLI::bold($p).' into '.CLI::bold('static/wowsounds/'.$fileId), CLI::LOG_ERROR);
$time = 0;
break 2; break 2;
} }
@@ -50,6 +56,7 @@ if (!CLI)
} }
CLI::write(' - did not find file: '.CLI::bold(CLI::nicePath($filePath, CLISetup::$srcDir, '['.implode(',', CLISetup::$locales).']')), CLI::LOG_WARN); CLI::write(' - did not find file: '.CLI::bold(CLI::nicePath($filePath, CLISetup::$srcDir, '['.implode(',', CLISetup::$locales).']')), CLI::LOG_WARN);
$time = 0;
// flag as unusable in DB // flag as unusable in DB
DB::Aowow()->query('UPDATE ?_sounds_files SET id = ?d WHERE ABS(id) = ?d', -$fileId, $fileId); DB::Aowow()->query('UPDATE ?_sounds_files SET id = ?d WHERE ABS(id) = ?d', -$fileId, $fileId);
} }

View File

@@ -80,7 +80,7 @@ if (!CLI)
} }
if (@imagejpeg($res, $outFile)) if (@imagejpeg($res, $outFile))
CLI::write(sprintf(ERR_NONE, CLI::bold($outFile)), CLI::LOG_OK); CLI::write(sprintf(ERR_NONE, CLI::bold($outFile)), CLI::LOG_OK, true, true);
else else
{ {
$success = false; $success = false;

View File

@@ -124,8 +124,6 @@ SqlGen::register(new class extends SetupScript
WHERE WHERE
ct.entry IN (?a) ct.entry IN (?a)
} }
ORDER BY
ct.entry ASC
LIMIT LIMIT
?d, ?d'; ?d, ?d';
@@ -160,7 +158,7 @@ SqlGen::register(new class extends SetupScript
DB::Aowow()->query('TRUNCATE ?_creature'); DB::Aowow()->query('TRUNCATE ?_creature');
while ($npcs = DB::World()->select($baseQuery, NPC_CU_INSTANCE_BOSS, $ids ?: DBSIMPLE_SKIP, SqlGen::$sqlBatchSize * $i, SqlGen::$sqlBatchSize)) while ($npcs = DB::World()->select($baseQuery, NPC_CU_INSTANCE_BOSS, $ids ?: DBSIMPLE_SKIP, SqlGen::$sqlBatchSize * $i, SqlGen::$sqlBatchSize))
{ {
CLI::write(' * batch #' . ++$i . ' (' . count($npcs) . ')'); CLI::write(' * batch #' . ++$i . ' (' . count($npcs) . ')', CLI::LOG_BLANK, true, true);
foreach ($npcs as $npc) foreach ($npcs as $npc)
DB::Aowow()->query('INSERT INTO ?_creature VALUES (?a)', array_values($npc)); DB::Aowow()->query('INSERT INTO ?_creature VALUES (?a)', array_values($npc));

View File

@@ -28,9 +28,7 @@ SqlGen::register(new class extends SetupScript
(SELECT LOWER(SUBSTRING_INDEX(iconString, "\\\\", -1)) AS x FROM dbc_creaturefamily WHERE iconString LIKE "%icons%") (SELECT LOWER(SUBSTRING_INDEX(iconString, "\\\\", -1)) AS x FROM dbc_creaturefamily WHERE iconString LIKE "%icons%")
) y ) y
GROUP BY GROUP BY
x x';
ORDER BY
x ASC';
DB::Aowow()->query($baseQuery); DB::Aowow()->query($baseQuery);

View File

@@ -252,18 +252,16 @@ SqlGen::register(new class extends SetupScript
CLI::write(' '.count($enchStats).' enchantments parsed'); CLI::write(' '.count($enchStats).' enchantments parsed');
CLI::write(' - applying stats for items'); CLI::write(' - applying stats for items');
$i = 0;
while (true) while (true)
{ {
$items = new ItemStatSetup($offset, SqlGen::$sqlBatchSize, $ids, $enchStats); $items = new ItemStatSetup($offset, SqlGen::$sqlBatchSize, $ids, $enchStats);
if ($items->error) if ($items->error)
break; break;
$max = max($items->getFoundIDs()); CLI::write(' * batch #' . ++$i . ' (' . count($items->getFoundIDs()) . ')', CLI::LOG_BLANK, true, true);
$num = count($items->getFoundIDs());
CLI::write(' * sets '.($offset + 1).' - '.($max)); $offset = max($items->getFoundIDs());
$offset = $max;
$items->writeStatsTable(); $items->writeStatsTable();
} }

View File

@@ -135,8 +135,6 @@ SqlGen::register(new class extends SetupScript
WHERE WHERE
it.entry IN (?a) it.entry IN (?a)
} }
ORDER BY
it.entry ASC
LIMIT LIMIT
?d, ?d'; ?d, ?d';
@@ -144,7 +142,7 @@ SqlGen::register(new class extends SetupScript
DB::Aowow()->query('TRUNCATE ?_items'); DB::Aowow()->query('TRUNCATE ?_items');
while ($items = DB::World()->select($baseQuery, $ids ?: DBSIMPLE_SKIP, SqlGen::$sqlBatchSize * $i, SqlGen::$sqlBatchSize)) while ($items = DB::World()->select($baseQuery, $ids ?: DBSIMPLE_SKIP, SqlGen::$sqlBatchSize * $i, SqlGen::$sqlBatchSize))
{ {
CLI::write(' * batch #' . ++$i . ' (' . count($items) . ')'); CLI::write(' * batch #' . ++$i . ' (' . count($items) . ')', CLI::LOG_BLANK, true, true);
foreach ($items as $item) foreach ($items as $item)
DB::Aowow()->query('INSERT INTO ?_items VALUES (?a)', array_values($item)); DB::Aowow()->query('INSERT INTO ?_items VALUES (?a)', array_values($item));

View File

@@ -82,8 +82,6 @@ SqlGen::register(new class extends SetupScript
} }
GROUP BY GROUP BY
go.entry go.entry
ORDER BY
go.entry ASC
LIMIT LIMIT
?d, ?d'; ?d, ?d';
@@ -107,7 +105,7 @@ SqlGen::register(new class extends SetupScript
DB::Aowow()->query('TRUNCATE ?_objects'); DB::Aowow()->query('TRUNCATE ?_objects');
while ($objects = DB::World()->select($baseQuery, $ids ?: DBSIMPLE_SKIP, SqlGen::$sqlBatchSize * $i, SqlGen::$sqlBatchSize)) while ($objects = DB::World()->select($baseQuery, $ids ?: DBSIMPLE_SKIP, SqlGen::$sqlBatchSize * $i, SqlGen::$sqlBatchSize))
{ {
CLI::write(' * batch #' . ++$i . ' (' . count($objects) . ')'); CLI::write(' * batch #' . ++$i . ' (' . count($objects) . ')', CLI::LOG_BLANK, true, true);
foreach ($objects as $object) foreach ($objects as $object)
DB::Aowow()->query('INSERT INTO ?_objects VALUES (?a)', array_values($object)); DB::Aowow()->query('INSERT INTO ?_objects VALUES (?a)', array_values($object));

View File

@@ -133,8 +133,6 @@ SqlGen::register(new class extends SetupScript
WHERE WHERE
q.ID IN (?a) q.ID IN (?a)
} }
ORDER BY
q.ID ASC
LIMIT LIMIT
?d, ?d'; ?d, ?d';
@@ -174,7 +172,7 @@ SqlGen::register(new class extends SetupScript
DB::Aowow()->query('TRUNCATE ?_quests'); DB::Aowow()->query('TRUNCATE ?_quests');
while ($quests = DB::World()->select($baseQuery, $ids ?: DBSIMPLE_SKIP, SqlGen::$sqlBatchSize * $i, SqlGen::$sqlBatchSize)) while ($quests = DB::World()->select($baseQuery, $ids ?: DBSIMPLE_SKIP, SqlGen::$sqlBatchSize * $i, SqlGen::$sqlBatchSize))
{ {
CLI::write(' * batch #' . ++$i . ' (' . count($quests) . ')'); CLI::write(' * batch #' . ++$i . ' (' . count($quests) . ')', CLI::LOG_BLANK, true, true);
foreach ($quests as $quest) foreach ($quests as $quest)
DB::Aowow()->query('INSERT INTO ?_quests VALUES (?a)', array_values($quest)); DB::Aowow()->query('INSERT INTO ?_quests VALUES (?a)', array_values($quest));

View File

@@ -72,11 +72,12 @@ SqlGen::register(new class extends SetupScript
$lastMax = 0; $lastMax = 0;
$soundFileIdx = 0; $soundFileIdx = 0;
$soundIndex = []; $soundIndex = [];
$j = 0;
while ($sounds = DB::Aowow()->select($query, $lastMax, SqlGen::$sqlBatchSize)) while ($sounds = DB::Aowow()->select($query, $lastMax, SqlGen::$sqlBatchSize))
{ {
$newMax = max(array_column($sounds, 'id')); $newMax = max(array_column($sounds, 'id'));
CLI::write(' * sets '.($lastMax + 1).' - '.$newMax); CLI::write(' * batch #' . ++$j . ' (' . count($sounds) . ')', CLI::LOG_BLANK, true, true);
$lastMax = $newMax; $lastMax = $newMax;

View File

@@ -88,7 +88,7 @@ SqlGen::register(new class extends SetupScript
# also everything from items that teach spells, is src of spell # also everything from items that teach spells, is src of spell
# todo: check if items have learn-spells (effect: 36) # todo: check if items have learn-spells (effect: 36)
CLI::write(' * resolve ref-loot tree'); CLI::write(' * resolve ref-loot tree', CLI::LOG_BLANK, true, true);
$refLoot = DB::World()->select(' $refLoot = DB::World()->select('
SELECT SELECT
rlt.Entry AS ARRAY_KEY, rlt.Entry AS ARRAY_KEY,
@@ -135,7 +135,7 @@ SqlGen::register(new class extends SetupScript
############### ###############
# 1: Crafted # # 1: Crafted #
############### ###############
CLI::write(' * #1 Crafted'); CLI::write(' * #1 Crafted', CLI::LOG_BLANK, true, true);
$spellBuff = []; $spellBuff = [];
$itemBuff = []; $itemBuff = [];
@@ -176,7 +176,7 @@ SqlGen::register(new class extends SetupScript
############ ############
# 2: Drop # # 2: Drop #
############ ############
CLI::write(' * #2 Drop'); CLI::write(' * #2 Drop', CLI::LOG_BLANK, true, true);
$spellBuff = []; $spellBuff = [];
$itemBuff = []; $itemBuff = [];
@@ -318,7 +318,7 @@ SqlGen::register(new class extends SetupScript
########### ###########
# 3: PvP # (Vendors w/ xCost Arena/Honor) # 3: PvP # (Vendors w/ xCost Arena/Honor)
########### ###########
CLI::write(' * #3 PvP'); CLI::write(' * #3 PvP', CLI::LOG_BLANK, true, true);
// var g_sources_pvp = { // var g_sources_pvp = {
// 1: 'Arena', // 1: 'Arena',
@@ -363,7 +363,7 @@ SqlGen::register(new class extends SetupScript
############# #############
# 4: Quest # # 4: Quest #
############# #############
CLI::write(' * #4 Quest'); CLI::write(' * #4 Quest', CLI::LOG_BLANK, true, true);
$spellBuff = []; $spellBuff = [];
$itemBuff = []; $itemBuff = [];
@@ -445,7 +445,7 @@ SqlGen::register(new class extends SetupScript
############## ##############
# 5: Vendor # (w/o xCost Arena/Honor) # 5: Vendor # (w/o xCost Arena/Honor)
############## ##############
CLI::write(' * #5 Vendor'); CLI::write(' * #5 Vendor', CLI::LOG_BLANK, true, true);
$spellBuff = []; $spellBuff = [];
$itemBuff = []; $itemBuff = [];
@@ -479,7 +479,7 @@ SqlGen::register(new class extends SetupScript
############### ###############
# 10: Starter # # 10: Starter #
############### ###############
CLI::write(' * #10 Starter'); CLI::write(' * #10 Starter', CLI::LOG_BLANK, true, true);
if ($pcii = DB::World()->select('SELECT ?d, itemid, 1 FROM playercreateinfo_item', Type::ITEM)) if ($pcii = DB::World()->select('SELECT ?d, itemid, 1 FROM playercreateinfo_item', Type::ITEM))
DB::Aowow()->query($this->queryfy($pcii, $insBasic), 10, 10, 10); DB::Aowow()->query($this->queryfy($pcii, $insBasic), 10, 10, 10);
@@ -491,7 +491,7 @@ SqlGen::register(new class extends SetupScript
################### ###################
# 12: Achievement # # 12: Achievement #
################### ###################
CLI::write(' * #12 Achievement'); CLI::write(' * #12 Achievement', CLI::LOG_BLANK, true, true);
$spellBuff = []; $spellBuff = [];
$itemBuff = []; $itemBuff = [];
@@ -553,7 +553,7 @@ SqlGen::register(new class extends SetupScript
#################### ####################
# 15: Disenchanted # # 15: Disenchanted #
#################### ####################
CLI::write(' * #15 Disenchanted'); CLI::write(' * #15 Disenchanted', CLI::LOG_BLANK, true, true);
$spellBuff = []; $spellBuff = [];
$itemBuff = []; $itemBuff = [];
@@ -606,7 +606,7 @@ SqlGen::register(new class extends SetupScript
############## ##############
# 16: Fished # # 16: Fished #
############## ##############
CLI::write(' * #16 Fished'); CLI::write(' * #16 Fished', CLI::LOG_BLANK, true, true);
$spellBuff = []; $spellBuff = [];
$itemBuff = []; $itemBuff = [];
@@ -657,7 +657,7 @@ SqlGen::register(new class extends SetupScript
################ ################
# 17: Gathered # # 17: Gathered #
################ ################
CLI::write(' * #17 Gathered'); CLI::write(' * #17 Gathered', CLI::LOG_BLANK, true, true);
$spellBuff = []; $spellBuff = [];
$itemBuff = []; $itemBuff = [];
@@ -712,7 +712,7 @@ SqlGen::register(new class extends SetupScript
############## ##############
# 18: Milled # # 18: Milled #
############## ##############
CLI::write(' * #18 Milled'); CLI::write(' * #18 Milled', CLI::LOG_BLANK, true, true);
$spellBuff = []; $spellBuff = [];
$itemBuff = []; $itemBuff = [];
@@ -763,7 +763,7 @@ SqlGen::register(new class extends SetupScript
############# #############
# 19: Mined # # 19: Mined #
############# #############
CLI::write(' * #19 Mined'); CLI::write(' * #19 Mined', CLI::LOG_BLANK, true, true);
$spellBuff = []; $spellBuff = [];
$itemBuff = []; $itemBuff = [];
@@ -818,7 +818,7 @@ SqlGen::register(new class extends SetupScript
################## ##################
# 20: Prospected # # 20: Prospected #
################## ##################
CLI::write(' * #20 Prospected'); CLI::write(' * #20 Prospected', CLI::LOG_BLANK, true, true);
$spellBuff = []; $spellBuff = [];
$itemBuff = []; $itemBuff = [];
@@ -869,7 +869,7 @@ SqlGen::register(new class extends SetupScript
################## ##################
# 21: Pickpocket # # 21: Pickpocket #
################## ##################
CLI::write(' * #21 Pickpocket'); CLI::write(' * #21 Pickpocket', CLI::LOG_BLANK, true, true);
$spellBuff = []; $spellBuff = [];
$itemBuff = []; $itemBuff = [];
@@ -919,7 +919,7 @@ SqlGen::register(new class extends SetupScript
################ ################
# 22: Salvaged # # 22: Salvaged #
################ ################
CLI::write(' * #22 Salvaged'); CLI::write(' * #22 Salvaged', CLI::LOG_BLANK, true, true);
$spellBuff = []; $spellBuff = [];
$itemBuff = []; $itemBuff = [];
@@ -970,7 +970,7 @@ SqlGen::register(new class extends SetupScript
############### ###############
# 23: Skinned # # 23: Skinned #
############### ###############
CLI::write(' * #23 Skinned'); CLI::write(' * #23 Skinned', CLI::LOG_BLANK, true, true);
$spellBuff = []; $spellBuff = [];
$itemBuff = []; $itemBuff = [];
@@ -1029,7 +1029,7 @@ SqlGen::register(new class extends SetupScript
CLI::write(' - Spells [original]'); CLI::write(' - Spells [original]');
# 4: Quest # 4: Quest
CLI::write(' * #4 Quest'); CLI::write(' * #4 Quest', CLI::LOG_BLANK, true, true);
$quests = DB::World()->select(' $quests = DB::World()->select('
SELECT spell AS ARRAY_KEY, id, SUM(qty) AS qty, BIT_OR(side) AS side FROM ( SELECT spell AS ARRAY_KEY, id, SUM(qty) AS qty, BIT_OR(side) AS side FROM (
SELECT IF(RewardSpell = 0, RewardDisplaySpell, RewardSpell) AS spell, ID, COUNT(1) AS qty, IF(AllowableRaces & 0x2B2 AND !(AllowableRaces & 0x44D), 2, IF(AllowableRaces & 0x44D AND !(AllowableRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE IF(RewardSpell = 0, RewardDisplaySpell, RewardSpell) > 0 GROUP BY spell SELECT IF(RewardSpell = 0, RewardDisplaySpell, RewardSpell) AS spell, ID, COUNT(1) AS qty, IF(AllowableRaces & 0x2B2 AND !(AllowableRaces & 0x44D), 2, IF(AllowableRaces & 0x44D AND !(AllowableRaces & 0x2B2), 1, 3)) AS side FROM quest_template WHERE IF(RewardSpell = 0, RewardDisplaySpell, RewardSpell) > 0 GROUP BY spell
@@ -1051,7 +1051,7 @@ SqlGen::register(new class extends SetupScript
} }
# 6: Trainer # 6: Trainer
CLI::write(' * #6 Trainer'); CLI::write(' * #6 Trainer', CLI::LOG_BLANK, true, true);
if ($tNpcs = DB::World()->select('SELECT SpellID AS ARRAY_KEY, cdt.CreatureId AS entry, COUNT(1) AS qty FROM `trainer_spell` ts JOIN `creature_default_trainer` cdt ON cdt.TrainerId = ts.TrainerId GROUP BY ARRAY_KEY')) if ($tNpcs = DB::World()->select('SELECT SpellID AS ARRAY_KEY, cdt.CreatureId AS entry, COUNT(1) AS qty FROM `trainer_spell` ts JOIN `creature_default_trainer` cdt ON cdt.TrainerId = ts.TrainerId GROUP BY ARRAY_KEY'))
{ {
$tSpells = DB::Aowow()->select('SELECT id AS ARRAY_KEY, effect1Id, effect2Id, effect3Id, effect1TriggerSpell, effect2TriggerSpell, effect3TriggerSpell FROM dbc_spell WHERE id IN (?a)', array_keys($tNpcs)); $tSpells = DB::Aowow()->select('SELECT id AS ARRAY_KEY, effect1Id, effect2Id, effect3Id, effect1TriggerSpell, effect2TriggerSpell, effect3TriggerSpell FROM dbc_spell WHERE id IN (?a)', array_keys($tNpcs));
@@ -1077,13 +1077,13 @@ SqlGen::register(new class extends SetupScript
} }
# 7: Discovery # 7: Discovery
CLI::write(' * #7 Discovery'); CLI::write(' * #7 Discovery', CLI::LOG_BLANK, true, true);
// 61756: Northrend Inscription Research (FAST QA VERSION); // 61756: Northrend Inscription Research (FAST QA VERSION);
if ($disco = DB::World()->select('SELECT ?d, spellId, 1 FROM skill_discovery_template WHERE reqSpell <> ?d', Type::SPELL, 61756)) if ($disco = DB::World()->select('SELECT ?d, spellId, 1 FROM skill_discovery_template WHERE reqSpell <> ?d', Type::SPELL, 61756))
DB::Aowow()->query($this->queryfy($disco, $insBasic), 7, 7, 7); DB::Aowow()->query($this->queryfy($disco, $insBasic), 7, 7, 7);
# 9: Talent # 9: Talent
CLI::write(' * #9 Talent'); CLI::write(' * #9 Talent', CLI::LOG_BLANK, true, true);
$tSpells = DB::Aowow()->select(' $tSpells = DB::Aowow()->select('
SELECT s.id AS ARRAY_KEY, s.effect1Id, s.effect2Id, s.effect3Id, s.effect1TriggerSpell, s.effect2TriggerSpell, s.effect3TriggerSpell SELECT s.id AS ARRAY_KEY, s.effect1Id, s.effect2Id, s.effect3Id, s.effect1TriggerSpell, s.effect2TriggerSpell, s.effect3TriggerSpell
FROM dbc_talent t FROM dbc_talent t
@@ -1095,7 +1095,7 @@ SqlGen::register(new class extends SetupScript
$buff = []; $buff = [];
while ($tSpells) while ($tSpells)
{ {
CLI::write(' - '.++$n.'. pass'); CLI::write(' - '.++$n.'. pass', CLI::LOG_BLANK, true, true);
$recurse = []; $recurse = [];
foreach ($tSpells as $tId => $spell) foreach ($tSpells as $tId => $spell)
@@ -1120,7 +1120,7 @@ SqlGen::register(new class extends SetupScript
DB::Aowow()->query($this->queryfy($buff, $insBasic), 9, 9, 9); DB::Aowow()->query($this->queryfy($buff, $insBasic), 9, 9, 9);
# 10: Starter # 10: Starter
CLI::write(' * #10 Starter'); CLI::write(' * #10 Starter', CLI::LOG_BLANK, true, true);
/* acquireMethod /* acquireMethod
ABILITY_LEARNED_ON_GET_PROFESSION_SKILL = 1, learnedAt = 1 && source10 = 1 ABILITY_LEARNED_ON_GET_PROFESSION_SKILL = 1, learnedAt = 1 && source10 = 1
ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL = 2 ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL = 2
@@ -1138,12 +1138,12 @@ SqlGen::register(new class extends SetupScript
CLI::write(' - Titles'); CLI::write(' - Titles');
# 4: Quest # 4: Quest
CLI::write(' * #4 Quest'); CLI::write(' * #4 Quest', CLI::LOG_BLANK, true, true);
if ($quests = DB::World()->select('SELECT ?d, RewardTitle, 1, ?d, ID FROM quest_template WHERE RewardTitle > 0', Type::TITLE, Type::QUEST)) if ($quests = DB::World()->select('SELECT ?d, RewardTitle, 1, ?d, ID FROM quest_template WHERE RewardTitle > 0', Type::TITLE, Type::QUEST))
DB::Aowow()->query($this->queryfy($quests, $insMore), 4, 4, 4); DB::Aowow()->query($this->queryfy($quests, $insMore), 4, 4, 4);
# 12: Achievement # 12: Achievement
CLI::write(' * #12 Achievement'); CLI::write(' * #12 Achievement', CLI::LOG_BLANK, true, true);
$sets = DB::World()->select(' $sets = DB::World()->select('
SELECT titleId AS ARRAY_KEY, MIN(ID) AS srcId, NULLIF(MAX(ID), MIN(ID)) AS altSrcId FROM ( SELECT titleId AS ARRAY_KEY, MIN(ID) AS srcId, NULLIF(MAX(ID), MIN(ID)) AS altSrcId FROM (
SELECT TitleA AS `titleId`, ID FROM achievement_reward WHERE TitleA <> 0 SELECT TitleA AS `titleId`, ID FROM achievement_reward WHERE TitleA <> 0
@@ -1160,7 +1160,7 @@ SqlGen::register(new class extends SetupScript
} }
# 13: Source-String # 13: Source-String
CLI::write(' * #13 cuStrings'); CLI::write(' * #13 cuStrings', CLI::LOG_BLANK, true, true);
$src13 = [null, 42, 52, 71, 80, 157, 163, 167, 169, 177]; $src13 = [null, 42, 52, 71, 80, 157, 163, 167, 169, 177];
foreach ($src13 as $src => $tId) foreach ($src13 as $src => $tId)
if ($tId) if ($tId)

View File

@@ -19,31 +19,31 @@ SqlGen::register(new class extends SetupScript
private $querys = array( private $querys = array(
1 => ['SELECT c.guid, 1 AS "type", c.id AS typeId, c.spawntimesecs AS respawn, c.phaseMask, c.zoneId AS areaId, c.map, IFNULL(ca.path_id, 0) AS pathId, c.position_y AS `posX`, c.position_x AS `posY` ' . 1 => ['SELECT c.guid, 1 AS "type", c.id AS typeId, c.spawntimesecs AS respawn, c.phaseMask, c.zoneId AS areaId, c.map, IFNULL(ca.path_id, 0) AS pathId, c.position_y AS `posX`, c.position_x AS `posY` ' .
'FROM creature c LEFT JOIN creature_addon ca ON ca.guid = c.guid', 'FROM creature c LEFT JOIN creature_addon ca ON ca.guid = c.guid',
' - assembling creature spawns', Type::NPC], 'creature spawns', Type::NPC],
2 => ['SELECT c.guid, 2 AS "type", c.id AS typeId, ABS(c.spawntimesecs) AS respawn, c.phaseMask, c.zoneId AS areaId, c.map, 0 as pathId, c.position_y AS `posX`, c.position_x AS `posY` ' . 2 => ['SELECT c.guid, 2 AS "type", c.id AS typeId, ABS(c.spawntimesecs) AS respawn, c.phaseMask, c.zoneId AS areaId, c.map, 0 as pathId, c.position_y AS `posX`, c.position_x AS `posY` ' .
'FROM gameobject c', 'FROM gameobject c',
' - assembling gameobject spawns', Type::OBJECT], 'gameobject spawns', Type::OBJECT],
3 => ['SELECT id AS "guid", 19 AS "type", soundId AS typeId, 0 AS respawn, 0 AS phaseMask, 0 AS areaId, mapId AS "map", 0 AS pathId, posX, posY ' . 3 => ['SELECT id AS "guid", 19 AS "type", soundId AS typeId, 0 AS respawn, 0 AS phaseMask, 0 AS areaId, mapId AS "map", 0 AS pathId, posX, posY ' .
'FROM dbc_soundemitters', 'FROM dbc_soundemitters',
' - assembling sound emitter spawns', Type::SOUND], 'sound emitter spawns', Type::SOUND],
4 => ['SELECT id AS "guid", 503 AS "type", id AS typeId, 0 AS respawn, 0 AS phaseMask, 0 AS areaId, mapId AS "map", 0 AS pathId, posX, posY ' . 4 => ['SELECT id AS "guid", 503 AS "type", id AS typeId, 0 AS respawn, 0 AS phaseMask, 0 AS areaId, mapId AS "map", 0 AS pathId, posX, posY ' .
'FROM dbc_areatrigger', 'FROM dbc_areatrigger',
' - assembling areatrigger spawns', Type::AREATRIGGER], 'areatrigger spawns', Type::AREATRIGGER],
5 => ['SELECT c.guid, w.entry AS "npcOrPath", w.pointId AS "point", c.zoneId AS areaId, c.map, w.waittime AS "wait", w.location_y AS `posX`, w.location_x AS `posY` ' . 5 => ['SELECT c.guid, w.entry AS "npcOrPath", w.pointId AS "point", c.zoneId AS areaId, c.map, w.waittime AS "wait", w.location_y AS `posX`, w.location_x AS `posY` ' .
'FROM creature c JOIN script_waypoint w ON c.id = w.entry', 'FROM creature c JOIN script_waypoint w ON c.id = w.entry',
' - assembling waypoints from table script_waypoint', Type::NPC], 'script_waypoint table', Type::NPC],
6 => ['SELECT c.guid, w.entry AS "npcOrPath", w.pointId AS "point", c.zoneId AS areaId, c.map, 0 AS "wait", w.position_y AS `posX`, w.position_x AS `posY` ' . 6 => ['SELECT c.guid, w.entry AS "npcOrPath", w.pointId AS "point", c.zoneId AS areaId, c.map, 0 AS "wait", w.position_y AS `posX`, w.position_x AS `posY` ' .
'FROM creature c JOIN waypoints w ON c.id = w.entry', 'FROM creature c JOIN waypoints w ON c.id = w.entry',
' - assembling waypoints from table waypoints', Type::NPC], 'waypoints table', Type::NPC],
7 => ['SELECT c.guid, -w.id AS "npcOrPath", w.point, c.zoneId AS areaId, c.map, w.delay AS "wait", w.position_y AS `posX`, w.position_x AS `posY` ' . 7 => ['SELECT c.guid, -w.id AS "npcOrPath", w.point, c.zoneId AS areaId, c.map, w.delay AS "wait", w.position_y AS `posX`, w.position_x AS `posY` ' .
'FROM creature c JOIN creature_addon ca ON ca.guid = c.guid JOIN waypoint_data w ON w.id = ca.path_id WHERE ca.path_id <> 0', 'FROM creature c JOIN creature_addon ca ON ca.guid = c.guid JOIN waypoint_data w ON w.id = ca.path_id WHERE ca.path_id <> 0',
' - assembling waypoints from table waypoint_data', Type::NPC] 'waypoint_data table', Type::NPC]
); );
public function generate(array $ids = []) : bool public function generate(array $ids = []) : bool
@@ -78,24 +78,31 @@ SqlGen::register(new class extends SetupScript
foreach ($this->querys as $idx => $q) foreach ($this->querys as $idx => $q)
{ {
CLI::write($q[1]); $intv = 0.5;
$time = microtime(true);
$n = 0; $sum = 0;
$sum = 0;
if ($idx == 3 || $idx == 4) if ($idx == 3 || $idx == 4)
$queryResult = DB::Aowow()->select($q[0]); $queryResult = DB::Aowow()->select($q[0]);
else else
$queryResult = DB::World()->select($q[0]); $queryResult = DB::World()->select($q[0]);
$qryProgress = array_combine(array_keys($this->querys), array_column($this->querys, 1));
array_walk($qryProgress, function (&$v, $k) use ($idx) { if ($idx == $k) $v = CLI::bold('<'.$v.'>'); });
$qryProgress = ' ['.implode(', ', $qryProgress).']';
$qryTotal = count($queryResult);
$qtLen = strlen($qryTotal);
$doneGUID = 0; $doneGUID = 0;
foreach ($queryResult as $spawn) foreach ($queryResult as $spawn)
{ {
if (!$n) $sum++;
CLI::write(' * sets '.($sum + 1).' - '.($sum += SqlGen::$sqlBatchSize)); $newTime = microtime(true);
if ($newTime > $time + $intv)
if ($n++ > SqlGen::$sqlBatchSize) {
$n = 0; CLI::write(sprintf(' * %'.$qtLen.'d / %d (%4.1f%%)', $sum, $qryTotal, round(100 * $sum / $qryTotal, 1)) . $qryProgress, CLI::LOG_BLANK, true, true);
$time = $newTime;
}
// npc/object is on a transport -> apply offsets to path of transport // npc/object is on a transport -> apply offsets to path of transport
// note, that the coordinates are mixed up .. again // note, that the coordinates are mixed up .. again
@@ -116,6 +123,7 @@ SqlGen::register(new class extends SetupScript
if ($doneGUID != $spawn['guid']) if ($doneGUID != $spawn['guid'])
{ {
CLI::write('GUID '.$spawn['guid'].' was manually moved [A:'.$spawn['areaId'].' => '.$area.'; F: '.$floor.']', CLI::LOG_INFO); CLI::write('GUID '.$spawn['guid'].' was manually moved [A:'.$spawn['areaId'].' => '.$area.'; F: '.$floor.']', CLI::LOG_INFO);
$time = 0; // force refresh progress
$doneGUID = $spawn['guid']; // do not spam on waypoints $doneGUID = $spawn['guid']; // do not spam on waypoints
} }
} }
@@ -129,18 +137,21 @@ SqlGen::register(new class extends SetupScript
if (!$area) if (!$area)
{ {
CLI::write('tried to default GUID '.$spawn['guid'].' to instanced area by mapId, but returned empty [M:'.$spawn['map'].']', CLI::LOG_WARN); CLI::write('tried to default GUID '.$spawn['guid'].' to instanced area by mapId, but returned empty [M:'.$spawn['map'].']', CLI::LOG_WARN);
$time = 0; // force refresh progress
continue; continue;
} }
$final = ['areaId' => $area, 'posX' => 0, 'posY' => 0, 'floor' => 0]; $final = ['areaId' => $area, 'posX' => 0, 'posY' => 0, 'floor' => 0];
} }
else if (!$points) // still impossible (there are areas that are intentionally off the map (e.g. the isles south of tanaris)) else if (!$points) // still impossible (there are areas that are intentionally off the map (e.g. the isles south of tanaris))
{ {
CLI::write('GUID '.$spawn['guid'].($idx < 5 ? '' : ' on path/point '.$spawn['npcOrPath'].'/'.$spawn['point']).' could not be matched to displayable area [A:'.$area.'; X:'.$spawn['posY'].'; Y:'.$spawn['posX'].']', CLI::LOG_WARN); CLI::write('GUID '.$spawn['guid'].($idx < 5 ? '' : ' on path/point '.$spawn['npcOrPath'].'/'.$spawn['point']).' could not be matched to displayable area [A:'.$area.'; X:'.$spawn['posY'].'; Y:'.$spawn['posX'].']', CLI::LOG_WARN);
$time = 0; // force refresh progress
continue; continue;
} }
else // if areaId is set, area was determined by TC .. we're fine .. mostly else // if areaId is set, area was determined by TC .. we're fine .. mostly
{ {
if (in_array($spawn['map'], [564, 580])) // Black Temple and Sunwell floor offset bullshit // Black Temple and Sunwell floor offset bullshit
if (in_array($spawn['map'], [564, 580]))
$points[0]['floor']++; $points[0]['floor']++;
$final = $area ? $points[0] : Game::checkCoords($points); $final = $area ? $points[0] : Game::checkCoords($points);
@@ -219,7 +230,7 @@ SqlGen::register(new class extends SetupScript
} }
} }
if ($matches) if ($matches)
CLI::write(' * assigned '.$matches.' accessories on '.++$n.'. pass on vehicle accessories'); CLI::write(' * assigned '.$matches.' accessories on '.++$n.'. pass on vehicle accessories', CLI::LOG_BLANK, true, true);
} }
if ($accessories) if ($accessories)
CLI::write(count($accessories).' accessories could not be fitted onto a spawned vehicle.', CLI::LOG_WARN); CLI::write(count($accessories).' accessories could not be fitted onto a spawned vehicle.', CLI::LOG_WARN);

View File

@@ -208,7 +208,7 @@ SqlGen::register(new class extends SetupScript
{ {
$newMax = max(array_column($spells, 'id')); $newMax = max(array_column($spells, 'id'));
CLI::write(' * sets '.($lastMax + 1).' - '.$newMax); CLI::write(' * sets '.($lastMax + 1).' - '.$newMax, CLI::LOG_BLANK, true, true);
$lastMax = $newMax; $lastMax = $newMax;
@@ -226,7 +226,7 @@ SqlGen::register(new class extends SetupScript
{ {
$newMax = max(array_column($spells, 'id')); $newMax = max(array_column($spells, 'id'));
CLI::write(' * sets '.($lastMax + 1).' - '.$newMax); CLI::write(' * sets '.($lastMax + 1).' - '.$newMax, CLI::LOG_BLANK, true, true);
$lastMax = $newMax; $lastMax = $newMax;