mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Setup/Creatures
* hide creatures for internal use from listviews * correct Nightelf Player faction * trying to enforce strict line endings
This commit is contained in:
4
.gitattributes
vendored
Normal file
4
.gitattributes
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
*.php text eol=lf
|
||||||
|
*.js text eol=lf
|
||||||
|
*.css text eol=lf
|
||||||
|
|
||||||
@@ -1,423 +1,423 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('invalid access');
|
die('invalid access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
class CLISetup
|
class CLISetup
|
||||||
{
|
{
|
||||||
const CHR_BELL = 7;
|
const CHR_BELL = 7;
|
||||||
const CHR_BACK = 8;
|
const CHR_BACK = 8;
|
||||||
const CHR_TAB = 9;
|
const CHR_TAB = 9;
|
||||||
const CHR_LF = 10;
|
const CHR_LF = 10;
|
||||||
const CHR_CR = 13;
|
const CHR_CR = 13;
|
||||||
const CHR_ESC = 27;
|
const CHR_ESC = 27;
|
||||||
const CHR_BACKSPACE = 127;
|
const CHR_BACKSPACE = 127;
|
||||||
|
|
||||||
const LOG_OK = 0;
|
const LOG_OK = 0;
|
||||||
const LOG_WARN = 1;
|
const LOG_WARN = 1;
|
||||||
const LOG_ERROR = 2;
|
const LOG_ERROR = 2;
|
||||||
const LOG_INFO = 3;
|
const LOG_INFO = 3;
|
||||||
|
|
||||||
private static $win = true;
|
private static $win = true;
|
||||||
private static $hasReadline = false;
|
private static $hasReadline = false;
|
||||||
private static $logFile = '';
|
private static $logFile = '';
|
||||||
private static $logHandle = null;
|
private static $logHandle = null;
|
||||||
|
|
||||||
public static $locales = [];
|
public static $locales = [];
|
||||||
public static $localeIds = [];
|
public static $localeIds = [];
|
||||||
|
|
||||||
public static $srcDir = 'setup/mpqdata/';
|
public static $srcDir = 'setup/mpqdata/';
|
||||||
|
|
||||||
public static $tmpDBC = false;
|
public static $tmpDBC = false;
|
||||||
|
|
||||||
private static $mpqFiles = [];
|
private static $mpqFiles = [];
|
||||||
public static $expectedPaths = array( // update paths [yes, you can have en empty string as key]
|
public static $expectedPaths = array( // update paths [yes, you can have en empty string as key]
|
||||||
'' => LOCALE_EN, 'enGB' => LOCALE_EN, 'enUS' => LOCALE_EN,
|
'' => LOCALE_EN, 'enGB' => LOCALE_EN, 'enUS' => LOCALE_EN,
|
||||||
'frFR' => LOCALE_FR,
|
'frFR' => LOCALE_FR,
|
||||||
'deDE' => LOCALE_DE,
|
'deDE' => LOCALE_DE,
|
||||||
'esES' => LOCALE_ES, 'esMX' => LOCALE_ES,
|
'esES' => LOCALE_ES, 'esMX' => LOCALE_ES,
|
||||||
'ruRU' => LOCALE_RU
|
'ruRU' => LOCALE_RU
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function init()
|
public static function init()
|
||||||
{
|
{
|
||||||
self::$win = substr(PHP_OS, 0, 3) == 'WIN';
|
self::$win = substr(PHP_OS, 0, 3) == 'WIN';
|
||||||
self::$hasReadline = function_exists('readline_callback_handler_install');
|
self::$hasReadline = function_exists('readline_callback_handler_install');
|
||||||
|
|
||||||
if ($_ = getopt('d', ['log::', 'locales::', 'mpqDataDir::', 'delete']))
|
if ($_ = getopt('d', ['log::', 'locales::', 'mpqDataDir::', 'delete']))
|
||||||
{
|
{
|
||||||
// optional logging
|
// optional logging
|
||||||
if (!empty($_['log']))
|
if (!empty($_['log']))
|
||||||
self::$logFile = trim($_['log']);
|
self::$logFile = trim($_['log']);
|
||||||
|
|
||||||
// alternative data source (no quotes, use forward slash)
|
// alternative data source (no quotes, use forward slash)
|
||||||
if (!empty($_['mpqDataDir']))
|
if (!empty($_['mpqDataDir']))
|
||||||
self::$srcDir = str_replace(['\\', '"', '\''], ['/', '', ''], $_['mpqDataDir']);
|
self::$srcDir = str_replace(['\\', '"', '\''], ['/', '', ''], $_['mpqDataDir']);
|
||||||
|
|
||||||
// optional limit handled locales
|
// optional limit handled locales
|
||||||
if (!empty($_['locales']))
|
if (!empty($_['locales']))
|
||||||
{
|
{
|
||||||
// engb and enus are identical for all intents and purposes
|
// engb and enus are identical for all intents and purposes
|
||||||
$from = ['engb', 'esmx'];
|
$from = ['engb', 'esmx'];
|
||||||
$to = ['enus', 'eses'];
|
$to = ['enus', 'eses'];
|
||||||
$_['locales'] = str_ireplace($from, $to, strtolower($_['locales']));
|
$_['locales'] = str_ireplace($from, $to, strtolower($_['locales']));
|
||||||
|
|
||||||
self::$locales = array_intersect(Util::$localeStrings, explode(',', $_['locales']));
|
self::$locales = array_intersect(Util::$localeStrings, explode(',', $_['locales']));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_['d']) || isset($_['delete']))
|
if (isset($_['d']) || isset($_['delete']))
|
||||||
self::$tmpDBC = true;
|
self::$tmpDBC = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self::$locales)
|
if (!self::$locales)
|
||||||
self::$locales = array_filter(Util::$localeStrings);
|
self::$locales = array_filter(Util::$localeStrings);
|
||||||
|
|
||||||
// restrict actual locales
|
// restrict actual locales
|
||||||
foreach (self::$locales as $idx => $str)
|
foreach (self::$locales as $idx => $str)
|
||||||
if (!defined('CFG_LOCALES') || CFG_LOCALES & (1 << $idx))
|
if (!defined('CFG_LOCALES') || CFG_LOCALES & (1 << $idx))
|
||||||
self::$localeIds[] = $idx;
|
self::$localeIds[] = $idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************/
|
/*******************/
|
||||||
/* MPQ-file access */
|
/* MPQ-file access */
|
||||||
/*******************/
|
/*******************/
|
||||||
|
|
||||||
/* the problem
|
/* the problem
|
||||||
1) paths provided in dbc files are case-insensitive and random
|
1) paths provided in dbc files are case-insensitive and random
|
||||||
2) paths to the actual textures contained in the mpq archives are case-insensitive and random
|
2) paths to the actual textures contained in the mpq archives are case-insensitive and random
|
||||||
unix systems will throw a fit if you try to get from one to the other, so lets save the paths from 2) and cast it to lowercase
|
unix systems will throw a fit if you try to get from one to the other, so lets save the paths from 2) and cast it to lowercase
|
||||||
lookups will be done in lowercase. A successfull match will return the real path.
|
lookups will be done in lowercase. A successfull match will return the real path.
|
||||||
*/
|
*/
|
||||||
private static function buildFileList()
|
private static function buildFileList()
|
||||||
{
|
{
|
||||||
self::log();
|
self::log();
|
||||||
self::log('reading MPQdata from '.self::$srcDir.' to list for first time use...');
|
self::log('reading MPQdata from '.self::$srcDir.' to list for first time use...');
|
||||||
|
|
||||||
$setupDirs = glob('setup/*');
|
$setupDirs = glob('setup/*');
|
||||||
foreach ($setupDirs as $sd)
|
foreach ($setupDirs as $sd)
|
||||||
{
|
{
|
||||||
if (mb_substr(self::$srcDir, -1) == '/')
|
if (mb_substr(self::$srcDir, -1) == '/')
|
||||||
self::$srcDir = mb_substr(self::$srcDir, 0, -1);
|
self::$srcDir = mb_substr(self::$srcDir, 0, -1);
|
||||||
|
|
||||||
if (mb_substr($sd, -1) == '/')
|
if (mb_substr($sd, -1) == '/')
|
||||||
$sd = mb_substr($sd, 0, -1);
|
$sd = mb_substr($sd, 0, -1);
|
||||||
|
|
||||||
if (Util::lower($sd) == Util::lower(self::$srcDir))
|
if (Util::lower($sd) == Util::lower(self::$srcDir))
|
||||||
{
|
{
|
||||||
self::$srcDir = $sd.'/';
|
self::$srcDir = $sd.'/';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$iterator = new RecursiveDirectoryIterator(self::$srcDir);
|
$iterator = new RecursiveDirectoryIterator(self::$srcDir);
|
||||||
$iterator->setFlags(RecursiveDirectoryIterator::SKIP_DOTS);
|
$iterator->setFlags(RecursiveDirectoryIterator::SKIP_DOTS);
|
||||||
|
|
||||||
foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::SELF_FIRST) as $path)
|
foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::SELF_FIRST) as $path)
|
||||||
{
|
{
|
||||||
$_ = str_replace('\\', '/', $path->getPathname());
|
$_ = str_replace('\\', '/', $path->getPathname());
|
||||||
self::$mpqFiles[strtolower($_)] = $_;
|
self::$mpqFiles[strtolower($_)] = $_;
|
||||||
}
|
}
|
||||||
|
|
||||||
self::log('done');
|
self::log('done');
|
||||||
self::log();
|
self::log();
|
||||||
}
|
}
|
||||||
catch (UnexpectedValueException $e)
|
catch (UnexpectedValueException $e)
|
||||||
{
|
{
|
||||||
self::log('- mpqData dir '.self::$srcDir.' does not exist', self::LOG_ERROR);
|
self::log('- mpqData dir '.self::$srcDir.' does not exist', self::LOG_ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function fileExists(&$file)
|
public static function fileExists(&$file)
|
||||||
{
|
{
|
||||||
// read mpq source file structure to tree
|
// read mpq source file structure to tree
|
||||||
if (!self::$mpqFiles)
|
if (!self::$mpqFiles)
|
||||||
if (!self::buildFileList())
|
if (!self::buildFileList())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// backslash to forward slash
|
// backslash to forward slash
|
||||||
$_ = strtolower(str_replace('\\', '/', $file));
|
$_ = strtolower(str_replace('\\', '/', $file));
|
||||||
|
|
||||||
// remove trailing slash
|
// remove trailing slash
|
||||||
if (mb_substr($_, -1, 1) == '/')
|
if (mb_substr($_, -1, 1) == '/')
|
||||||
$_ = mb_substr($_, 0, -1);
|
$_ = mb_substr($_, 0, -1);
|
||||||
|
|
||||||
if (isset(self::$mpqFiles[$_]))
|
if (isset(self::$mpqFiles[$_]))
|
||||||
{
|
{
|
||||||
$file = self::$mpqFiles[$_];
|
$file = self::$mpqFiles[$_];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function filesInPath($path, $useRegEx = false)
|
public static function filesInPath($path, $useRegEx = false)
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
// read mpq source file structure to tree
|
// read mpq source file structure to tree
|
||||||
if (!self::$mpqFiles)
|
if (!self::$mpqFiles)
|
||||||
if (!self::buildFileList())
|
if (!self::buildFileList())
|
||||||
return [];
|
return [];
|
||||||
|
|
||||||
// backslash to forward slash
|
// backslash to forward slash
|
||||||
$_ = strtolower(str_replace('\\', '/', $path));
|
$_ = strtolower(str_replace('\\', '/', $path));
|
||||||
|
|
||||||
foreach (self::$mpqFiles as $lowerFile => $realFile)
|
foreach (self::$mpqFiles as $lowerFile => $realFile)
|
||||||
{
|
{
|
||||||
if (!$useRegEx && strstr($lowerFile, $_))
|
if (!$useRegEx && strstr($lowerFile, $_))
|
||||||
$result[] = $realFile;
|
$result[] = $realFile;
|
||||||
else if ($useRegEx && preg_match($path, $lowerFile))
|
else if ($useRegEx && preg_match($path, $lowerFile))
|
||||||
$result[] = $realFile;
|
$result[] = $realFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********/
|
/***********/
|
||||||
/* logging */
|
/* logging */
|
||||||
/***********/
|
/***********/
|
||||||
|
|
||||||
public static function red($str)
|
public static function red($str)
|
||||||
{
|
{
|
||||||
return self::$win ? $str : "\e[31m".$str."\e[0m";
|
return self::$win ? $str : "\e[31m".$str."\e[0m";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function green($str)
|
public static function green($str)
|
||||||
{
|
{
|
||||||
return self::$win ? $str : "\e[32m".$str."\e[0m";
|
return self::$win ? $str : "\e[32m".$str."\e[0m";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function yellow($str)
|
public static function yellow($str)
|
||||||
{
|
{
|
||||||
return self::$win ? $str : "\e[33m".$str."\e[0m";
|
return self::$win ? $str : "\e[33m".$str."\e[0m";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function blue($str)
|
public static function blue($str)
|
||||||
{
|
{
|
||||||
return self::$win ? $str : "\e[36m".$str."\e[0m";
|
return self::$win ? $str : "\e[36m".$str."\e[0m";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function bold($str)
|
public static function bold($str)
|
||||||
{
|
{
|
||||||
return self::$win ? $str : "\e[1m".$str."\e[0m";
|
return self::$win ? $str : "\e[1m".$str."\e[0m";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function log($txt = '', $lvl = -1)
|
public static function log($txt = '', $lvl = -1)
|
||||||
{
|
{
|
||||||
if (self::$logFile && !self::$logHandle)
|
if (self::$logFile && !self::$logHandle)
|
||||||
{
|
{
|
||||||
if (!file_exists(self::$logFile))
|
if (!file_exists(self::$logFile))
|
||||||
self::$logHandle = fopen(self::$logFile, 'w');
|
self::$logHandle = fopen(self::$logFile, 'w');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$logFileParts = pathinfo(self::$logFile);
|
$logFileParts = pathinfo(self::$logFile);
|
||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
while (file_exists($logFileParts['dirname'].'/'.$logFileParts['filename'].$i.(isset($logFileParts['extension']) ? '.'.$logFileParts['extension'] : '')))
|
while (file_exists($logFileParts['dirname'].'/'.$logFileParts['filename'].$i.(isset($logFileParts['extension']) ? '.'.$logFileParts['extension'] : '')))
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
self::$logFile = $logFileParts['dirname'].'/'.$logFileParts['filename'].$i.(isset($logFileParts['extension']) ? '.'.$logFileParts['extension'] : '');
|
self::$logFile = $logFileParts['dirname'].'/'.$logFileParts['filename'].$i.(isset($logFileParts['extension']) ? '.'.$logFileParts['extension'] : '');
|
||||||
self::$logHandle = fopen(self::$logFile, 'w');
|
self::$logHandle = fopen(self::$logFile, 'w');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$msg = "\n";
|
$msg = "\n";
|
||||||
if ($txt)
|
if ($txt)
|
||||||
{
|
{
|
||||||
$msg = str_pad(date('H:i:s'), 10);
|
$msg = str_pad(date('H:i:s'), 10);
|
||||||
switch ($lvl)
|
switch ($lvl)
|
||||||
{
|
{
|
||||||
case self::LOG_ERROR: // red critical error
|
case self::LOG_ERROR: // red critical error
|
||||||
$msg .= '['.self::red('ERR').'] ';
|
$msg .= '['.self::red('ERR').'] ';
|
||||||
break;
|
break;
|
||||||
case self::LOG_WARN: // yellow notice
|
case self::LOG_WARN: // yellow notice
|
||||||
$msg .= '['.self::yellow('WARN').'] ';
|
$msg .= '['.self::yellow('WARN').'] ';
|
||||||
break;
|
break;
|
||||||
case self::LOG_OK: // green success
|
case self::LOG_OK: // green success
|
||||||
$msg .= '['.self::green('OK').'] ';
|
$msg .= '['.self::green('OK').'] ';
|
||||||
break;
|
break;
|
||||||
case self::LOG_INFO: // blue info
|
case self::LOG_INFO: // blue info
|
||||||
$msg .= '['.self::blue('INFO').'] ';
|
$msg .= '['.self::blue('INFO').'] ';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$msg .= ' ';
|
$msg .= ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$msg .= $txt."\n";
|
$msg .= $txt."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $msg;
|
echo $msg;
|
||||||
|
|
||||||
if (self::$logHandle) // remove highlights for logging
|
if (self::$logHandle) // remove highlights for logging
|
||||||
fwrite(self::$logHandle, preg_replace(["/\e\[\d+m/", "/\e\[0m/"], '', $msg));
|
fwrite(self::$logHandle, preg_replace(["/\e\[\d+m/", "/\e\[0m/"], '', $msg));
|
||||||
|
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************/
|
/*****************/
|
||||||
/* file handling */
|
/* file handling */
|
||||||
/*****************/
|
/*****************/
|
||||||
|
|
||||||
public static function writeFile($file, $content)
|
public static function writeFile($file, $content)
|
||||||
{
|
{
|
||||||
$success = false;
|
$success = false;
|
||||||
if ($handle = @fOpen($file, "w"))
|
if ($handle = @fOpen($file, "w"))
|
||||||
{
|
{
|
||||||
if (fWrite($handle, $content))
|
if (fWrite($handle, $content))
|
||||||
{
|
{
|
||||||
$success = true;
|
$success = true;
|
||||||
self::log(sprintf(ERR_NONE, self::bold($file)), self::LOG_OK);
|
self::log(sprintf(ERR_NONE, self::bold($file)), self::LOG_OK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
self::log(sprintf(ERR_WRITE_FILE, self::bold($file)), self::LOG_ERROR);
|
self::log(sprintf(ERR_WRITE_FILE, self::bold($file)), self::LOG_ERROR);
|
||||||
|
|
||||||
fClose($handle);
|
fClose($handle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
self::log(sprintf(ERR_CREATE_FILE, self::bold($file)), self::LOG_ERROR);
|
self::log(sprintf(ERR_CREATE_FILE, self::bold($file)), self::LOG_ERROR);
|
||||||
|
|
||||||
if ($success)
|
if ($success)
|
||||||
@chmod($file, Util::FILE_ACCESS);
|
@chmod($file, Util::FILE_ACCESS);
|
||||||
|
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function writeDir($dir)
|
public static function writeDir($dir)
|
||||||
{
|
{
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
if (!is_writable($dir) && !@chmod($dir, Util::FILE_ACCESS))
|
if (!is_writable($dir) && !@chmod($dir, Util::FILE_ACCESS))
|
||||||
self::log('cannot write into output directory '.$dir, self::LOG_ERROR);
|
self::log('cannot write into output directory '.$dir, self::LOG_ERROR);
|
||||||
|
|
||||||
return is_writable($dir);
|
return is_writable($dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (@mkdir($dir, Util::FILE_ACCESS, true))
|
if (@mkdir($dir, Util::FILE_ACCESS, true))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
self::log('could not create output directory '.$dir, self::LOG_ERROR);
|
self::log('could not create output directory '.$dir, self::LOG_ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function loadDBC($name)
|
public static function loadDBC($name)
|
||||||
{
|
{
|
||||||
if (DB::Aowow()->selectCell('SHOW TABLES LIKE ?', 'dbc_'.$name) && DB::Aowow()->selectCell('SELECT count(1) FROM ?#', 'dbc_'.$name))
|
if (DB::Aowow()->selectCell('SHOW TABLES LIKE ?', 'dbc_'.$name) && DB::Aowow()->selectCell('SELECT count(1) FROM ?#', 'dbc_'.$name))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
$dbc = new DBC($name, self::$tmpDBC);
|
$dbc = new DBC($name, self::$tmpDBC);
|
||||||
if ($dbc->error)
|
if ($dbc->error)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ($dbc->readFromFile())
|
if ($dbc->readFromFile())
|
||||||
{
|
{
|
||||||
$dbc->writeToDB();
|
$dbc->writeToDB();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
self::log('SqlGen::generate() - required DBC '.$name.'.dbc found neither in DB nor as file!', self::LOG_ERROR);
|
self::log('SqlGen::generate() - required DBC '.$name.'.dbc found neither in DB nor as file!', self::LOG_ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************/
|
/**************/
|
||||||
/* read input */
|
/* read input */
|
||||||
/**************/
|
/**************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
since the CLI on WIN ist not interactive, the following things have to be considered
|
since the CLI on WIN ist not interactive, the following things have to be considered
|
||||||
you do not receive keystrokes but whole strings upon pressing <Enter> (wich also appends a \r)
|
you do not receive keystrokes but whole strings upon pressing <Enter> (wich also appends a \r)
|
||||||
as such <ESC> and probably other control chars can not be registered
|
as such <ESC> and probably other control chars can not be registered
|
||||||
this also means, you can't hide input at all, least process it
|
this also means, you can't hide input at all, least process it
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static function readInput(&$fields, $singleChar = false)
|
public static function readInput(&$fields, $singleChar = false)
|
||||||
{
|
{
|
||||||
// prevent default output if able
|
// prevent default output if able
|
||||||
if (self::$hasReadline)
|
if (self::$hasReadline)
|
||||||
readline_callback_handler_install('', function() { });
|
readline_callback_handler_install('', function() { });
|
||||||
|
|
||||||
foreach ($fields as $name => $data)
|
foreach ($fields as $name => $data)
|
||||||
{
|
{
|
||||||
$vars = ['desc', 'isHidden', 'validPattern'];
|
$vars = ['desc', 'isHidden', 'validPattern'];
|
||||||
foreach ($vars as $idx => $v)
|
foreach ($vars as $idx => $v)
|
||||||
$$v = isset($data[$idx]) ? $data[$idx] : false;
|
$$v = isset($data[$idx]) ? $data[$idx] : false;
|
||||||
|
|
||||||
$charBuff = '';
|
$charBuff = '';
|
||||||
|
|
||||||
if ($desc)
|
if ($desc)
|
||||||
echo "\n".$desc.": ";
|
echo "\n".$desc.": ";
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
$r = [STDIN];
|
$r = [STDIN];
|
||||||
$w = $e = null;
|
$w = $e = null;
|
||||||
$n = stream_select($r, $w, $e, 200000);
|
$n = stream_select($r, $w, $e, 200000);
|
||||||
|
|
||||||
if ($n && in_array(STDIN, $r)) {
|
if ($n && in_array(STDIN, $r)) {
|
||||||
$char = stream_get_contents(STDIN, 1);
|
$char = stream_get_contents(STDIN, 1);
|
||||||
$keyId = ord($char);
|
$keyId = ord($char);
|
||||||
|
|
||||||
// ignore this one
|
// ignore this one
|
||||||
if ($keyId == self::CHR_TAB)
|
if ($keyId == self::CHR_TAB)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// WIN sends \r\n as sequence, ignore one
|
// WIN sends \r\n as sequence, ignore one
|
||||||
if ($keyId == self::CHR_CR && self::$win)
|
if ($keyId == self::CHR_CR && self::$win)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// will not be send on WIN .. other ways of returning from setup? (besides ctrl + c)
|
// will not be send on WIN .. other ways of returning from setup? (besides ctrl + c)
|
||||||
if ($keyId == self::CHR_ESC)
|
if ($keyId == self::CHR_ESC)
|
||||||
{
|
{
|
||||||
echo chr(self::CHR_BELL);
|
echo chr(self::CHR_BELL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if ($keyId == self::CHR_BACKSPACE)
|
else if ($keyId == self::CHR_BACKSPACE)
|
||||||
{
|
{
|
||||||
if (!$charBuff)
|
if (!$charBuff)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$charBuff = mb_substr($charBuff, 0, -1);
|
$charBuff = mb_substr($charBuff, 0, -1);
|
||||||
if (!$isHidden && self::$hasReadline)
|
if (!$isHidden && self::$hasReadline)
|
||||||
echo chr(self::CHR_BACK)." ".chr(self::CHR_BACK);
|
echo chr(self::CHR_BACK)." ".chr(self::CHR_BACK);
|
||||||
}
|
}
|
||||||
else if ($keyId == self::CHR_LF)
|
else if ($keyId == self::CHR_LF)
|
||||||
{
|
{
|
||||||
$fields[$name] = $charBuff;
|
$fields[$name] = $charBuff;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (!$validPattern || preg_match($validPattern, $char))
|
else if (!$validPattern || preg_match($validPattern, $char))
|
||||||
{
|
{
|
||||||
$charBuff .= $char;
|
$charBuff .= $char;
|
||||||
if (!$isHidden && self::$hasReadline)
|
if (!$isHidden && self::$hasReadline)
|
||||||
echo $char;
|
echo $char;
|
||||||
|
|
||||||
if ($singleChar && self::$hasReadline)
|
if ($singleChar && self::$hasReadline)
|
||||||
{
|
{
|
||||||
$fields[$name] = $charBuff;
|
$fields[$name] = $charBuff;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo chr(self::CHR_BELL);
|
echo chr(self::CHR_BELL);
|
||||||
|
|
||||||
foreach ($fields as $f)
|
foreach ($fields as $f)
|
||||||
if (strlen($f))
|
if (strlen($f))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
$fields = null;
|
$fields = null;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,65 +1,65 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('invalid access');
|
die('invalid access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/********************/
|
/********************/
|
||||||
/* Account creation */
|
/* Account creation */
|
||||||
/********************/
|
/********************/
|
||||||
|
|
||||||
function account()
|
function account()
|
||||||
{
|
{
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'name' => ['Username', false],
|
'name' => ['Username', false],
|
||||||
'pass1' => ['Enter Password', true ],
|
'pass1' => ['Enter Password', true ],
|
||||||
'pass2' => ['Confirm Password', true ]
|
'pass2' => ['Confirm Password', true ]
|
||||||
);
|
);
|
||||||
|
|
||||||
User::useLocale(LOCALE_EN);
|
User::useLocale(LOCALE_EN);
|
||||||
Lang::load(Util::$localeStrings[LOCALE_EN]);
|
Lang::load(Util::$localeStrings[LOCALE_EN]);
|
||||||
|
|
||||||
if (CLISetup::readInput($fields))
|
if (CLISetup::readInput($fields))
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
|
|
||||||
if (!User::isValidName($fields['name'], $e))
|
if (!User::isValidName($fields['name'], $e))
|
||||||
CLISetup::log(Lang::account($e == 1 ? 'errNameLength' : 'errNameChars'), CLISetup::LOG_ERROR);
|
CLISetup::log(Lang::account($e == 1 ? 'errNameLength' : 'errNameChars'), CLISetup::LOG_ERROR);
|
||||||
else if (!User::isValidPass($fields['pass1'], $e))
|
else if (!User::isValidPass($fields['pass1'], $e))
|
||||||
CLISetup::log(Lang::account($e == 1 ? 'errPassLength' : 'errPassChars'), CLISetup::LOG_ERROR);
|
CLISetup::log(Lang::account($e == 1 ? 'errPassLength' : 'errPassChars'), CLISetup::LOG_ERROR);
|
||||||
else if ($fields['pass1'] != $fields['pass2'])
|
else if ($fields['pass1'] != $fields['pass2'])
|
||||||
CLISetup::log(Lang::account('passMismatch'), CLISetup::LOG_ERROR);
|
CLISetup::log(Lang::account('passMismatch'), CLISetup::LOG_ERROR);
|
||||||
else if ($_ = DB::Aowow()->SelectCell('SELECT 1 FROM ?_account WHERE user = ? AND (status <> ?d OR (status = ?d AND statusTimer > UNIX_TIMESTAMP()))', $fields['name'], ACC_STATUS_NEW, ACC_STATUS_NEW))
|
else if ($_ = DB::Aowow()->SelectCell('SELECT 1 FROM ?_account WHERE user = ? AND (status <> ?d OR (status = ?d AND statusTimer > UNIX_TIMESTAMP()))', $fields['name'], ACC_STATUS_NEW, ACC_STATUS_NEW))
|
||||||
CLISetup::log(Lang::account('nameInUse'), CLISetup::LOG_ERROR);
|
CLISetup::log(Lang::account('nameInUse'), CLISetup::LOG_ERROR);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// write to db
|
// write to db
|
||||||
$ok = DB::Aowow()->query('REPLACE INTO ?_account (user, passHash, displayName, joindate, email, allowExpire, userGroups, userPerms) VALUES (?, ?, ?, UNIX_TIMESTAMP(), ?, 0, ?d, 1)',
|
$ok = DB::Aowow()->query('REPLACE INTO ?_account (user, passHash, displayName, joindate, email, allowExpire, userGroups, userPerms) VALUES (?, ?, ?, UNIX_TIMESTAMP(), ?, 0, ?d, 1)',
|
||||||
$fields['name'],
|
$fields['name'],
|
||||||
User::hashCrypt($fields['pass1']),
|
User::hashCrypt($fields['pass1']),
|
||||||
Util::ucFirst($fields['name']),
|
Util::ucFirst($fields['name']),
|
||||||
CFG_CONTACT_EMAIL,
|
CFG_CONTACT_EMAIL,
|
||||||
U_GROUP_ADMIN
|
U_GROUP_ADMIN
|
||||||
);
|
);
|
||||||
if ($ok)
|
if ($ok)
|
||||||
{
|
{
|
||||||
$newId = DB::Aowow()->selectCell('SELECT id FROM ?_account WHERE user = ?', $fields['name']);
|
$newId = DB::Aowow()->selectCell('SELECT id FROM ?_account WHERE user = ?', $fields['name']);
|
||||||
Util::gainSiteReputation($newId, SITEREP_ACTION_REGISTER);
|
Util::gainSiteReputation($newId, SITEREP_ACTION_REGISTER);
|
||||||
|
|
||||||
CLISetup::log("account ".$fields['name']." created successfully", CLISetup::LOG_OK);
|
CLISetup::log("account ".$fields['name']." created successfully", CLISetup::LOG_OK);
|
||||||
}
|
}
|
||||||
else // something went wrong
|
else // something went wrong
|
||||||
CLISetup::log(Lang::main('intError'), CLISetup::LOG_ERROR);
|
CLISetup::log(Lang::main('intError'), CLISetup::LOG_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
CLISetup::log("account creation aborted", CLISetup::LOG_INFO);
|
CLISetup::log("account creation aborted", CLISetup::LOG_INFO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,90 +1,90 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('invalid access');
|
die('invalid access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/*************************/
|
/*************************/
|
||||||
/* Create required files */
|
/* Create required files */
|
||||||
/*************************/
|
/*************************/
|
||||||
|
|
||||||
function build($syncMe = null)
|
function build($syncMe = null)
|
||||||
{
|
{
|
||||||
require_once 'setup/tools/fileGen.class.php';
|
require_once 'setup/tools/fileGen.class.php';
|
||||||
|
|
||||||
FileGen::init($syncMe !== null ? FileGen::MODE_UPDATE : FileGen::MODE_NORMAL, $syncMe ?: []);
|
FileGen::init($syncMe !== null ? FileGen::MODE_UPDATE : FileGen::MODE_NORMAL, $syncMe ?: []);
|
||||||
|
|
||||||
$done = [];
|
$done = [];
|
||||||
if (FileGen::$subScripts)
|
if (FileGen::$subScripts)
|
||||||
{
|
{
|
||||||
$allOk = true;
|
$allOk = true;
|
||||||
|
|
||||||
// start file generation
|
// start file generation
|
||||||
CLISetup::log('begin generation of '. implode(', ', FileGen::$subScripts));
|
CLISetup::log('begin generation of '. implode(', ', FileGen::$subScripts));
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
|
|
||||||
// files with template
|
// files with template
|
||||||
foreach (FileGen::$tplFiles as $name => list($file, $destPath, $deps))
|
foreach (FileGen::$tplFiles as $name => list($file, $destPath, $deps))
|
||||||
{
|
{
|
||||||
$reqDBC = [];
|
$reqDBC = [];
|
||||||
|
|
||||||
if (!in_array($name, FileGen::$subScripts))
|
if (!in_array($name, FileGen::$subScripts))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!file_exists(FileGen::$tplPath.$file.'.in'))
|
if (!file_exists(FileGen::$tplPath.$file.'.in'))
|
||||||
{
|
{
|
||||||
CLISetup::log(sprintf(ERR_MISSING_FILE, FileGen::$tplPath.$file.'.in'), CLISetup::LOG_ERROR);
|
CLISetup::log(sprintf(ERR_MISSING_FILE, FileGen::$tplPath.$file.'.in'), CLISetup::LOG_ERROR);
|
||||||
$allOk = false;
|
$allOk = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CLISetup::writeDir($destPath))
|
if (!CLISetup::writeDir($destPath))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$syncIds = []; // todo: fetch what exactly must be regenerated
|
$syncIds = []; // todo: fetch what exactly must be regenerated
|
||||||
|
|
||||||
$ok = FileGen::generate($name, $syncIds);
|
$ok = FileGen::generate($name, $syncIds);
|
||||||
if (!$ok)
|
if (!$ok)
|
||||||
$allOk = false;
|
$allOk = false;
|
||||||
else
|
else
|
||||||
$done[] = $name;
|
$done[] = $name;
|
||||||
|
|
||||||
CLISetup::log(' - subscript \''.$file.'\' returned '.($ok ? 'sucessfully' : 'with errors'), $ok ? CLISetup::LOG_OK : CLISetup::LOG_ERROR);
|
CLISetup::log(' - subscript \''.$file.'\' returned '.($ok ? 'sucessfully' : 'with errors'), $ok ? CLISetup::LOG_OK : CLISetup::LOG_ERROR);
|
||||||
set_time_limit(FileGen::$defaultExecTime); // reset to default for the next script
|
set_time_limit(FileGen::$defaultExecTime); // reset to default for the next script
|
||||||
}
|
}
|
||||||
|
|
||||||
// files without template
|
// files without template
|
||||||
foreach (FileGen::$datasets as $file => $deps)
|
foreach (FileGen::$datasets as $file => $deps)
|
||||||
{
|
{
|
||||||
if (!in_array($file, FileGen::$subScripts))
|
if (!in_array($file, FileGen::$subScripts))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$syncIds = []; // todo: fetch what exactly must be regenerated
|
$syncIds = []; // todo: fetch what exactly must be regenerated
|
||||||
|
|
||||||
$ok = FileGen::generate($file, $syncIds);
|
$ok = FileGen::generate($file, $syncIds);
|
||||||
if (!$ok)
|
if (!$ok)
|
||||||
$allOk = false;
|
$allOk = false;
|
||||||
else
|
else
|
||||||
$done[] = $file;
|
$done[] = $file;
|
||||||
|
|
||||||
CLISetup::log(' - subscript \''.$file.'\' returned '.($ok ? 'sucessfully' : 'with errors'), $ok ? CLISetup::LOG_OK : CLISetup::LOG_ERROR);
|
CLISetup::log(' - subscript \''.$file.'\' returned '.($ok ? 'sucessfully' : 'with errors'), $ok ? CLISetup::LOG_OK : CLISetup::LOG_ERROR);
|
||||||
set_time_limit(FileGen::$defaultExecTime); // reset to default for the next script
|
set_time_limit(FileGen::$defaultExecTime); // reset to default for the next script
|
||||||
}
|
}
|
||||||
|
|
||||||
// end
|
// end
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
if ($allOk)
|
if ($allOk)
|
||||||
CLISetup::log('successfully finished file generation', CLISetup::LOG_OK);
|
CLISetup::log('successfully finished file generation', CLISetup::LOG_OK);
|
||||||
else
|
else
|
||||||
CLISetup::log('finished file generation with errors', CLISetup::LOG_ERROR);
|
CLISetup::log('finished file generation with errors', CLISetup::LOG_ERROR);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CLISetup::log('no valid script names supplied', CLISetup::LOG_ERROR);
|
CLISetup::log('no valid script names supplied', CLISetup::LOG_ERROR);
|
||||||
|
|
||||||
return $done;
|
return $done;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,156 +1,156 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('invalid access');
|
die('invalid access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/**************************/
|
/**************************/
|
||||||
/* Configure DB connection*/
|
/* Configure DB connection*/
|
||||||
/**************************/
|
/**************************/
|
||||||
|
|
||||||
function dbconfig()
|
function dbconfig()
|
||||||
{
|
{
|
||||||
$databases = ['aowow', 'world', 'auth', 'characters'];
|
$databases = ['aowow', 'world', 'auth', 'characters'];
|
||||||
$AoWoWconf = [];
|
$AoWoWconf = [];
|
||||||
$dbFields = array(
|
$dbFields = array(
|
||||||
'host' => ['Server Host', false],
|
'host' => ['Server Host', false],
|
||||||
'user' => ['User', false],
|
'user' => ['User', false],
|
||||||
'pass' => ['Password', true ],
|
'pass' => ['Password', true ],
|
||||||
'db' => ['Database Name', false],
|
'db' => ['Database Name', false],
|
||||||
'prefix' => ['Table prefix', false]
|
'prefix' => ['Table prefix', false]
|
||||||
);
|
);
|
||||||
$testDB = function($idx, $name, $dbInfo)
|
$testDB = function($idx, $name, $dbInfo)
|
||||||
{
|
{
|
||||||
$buff = '['.CLISetup::bold($idx).'] '.str_pad($name, 17);
|
$buff = '['.CLISetup::bold($idx).'] '.str_pad($name, 17);
|
||||||
$errStr = '';
|
$errStr = '';
|
||||||
$defPort = ini_get('mysqli.default_port');
|
$defPort = ini_get('mysqli.default_port');
|
||||||
$port = 0;
|
$port = 0;
|
||||||
|
|
||||||
if (strstr($dbInfo['host'], ':'))
|
if (strstr($dbInfo['host'], ':'))
|
||||||
list($dbInfo['host'], $port) = explode(':', $dbInfo['host']);
|
list($dbInfo['host'], $port) = explode(':', $dbInfo['host']);
|
||||||
|
|
||||||
if ($dbInfo['host'])
|
if ($dbInfo['host'])
|
||||||
{
|
{
|
||||||
// test DB
|
// test DB
|
||||||
if ($link = @mysqli_connect($dbInfo['host'], $dbInfo['user'], $dbInfo['pass'], $dbInfo['db'], $port ?: $defPort))
|
if ($link = @mysqli_connect($dbInfo['host'], $dbInfo['user'], $dbInfo['pass'], $dbInfo['db'], $port ?: $defPort))
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
else
|
else
|
||||||
$errStr = '['.mysqli_connect_errno().'] '.mysqli_connect_error();
|
$errStr = '['.mysqli_connect_errno().'] '.mysqli_connect_error();
|
||||||
|
|
||||||
$buff .= $errStr ? CLISetup::red('ERR ') : CLISetup::green('OK ');
|
$buff .= $errStr ? CLISetup::red('ERR ') : CLISetup::green('OK ');
|
||||||
$buff .= 'mysqli://'.$dbInfo['user'].':'.str_pad('', mb_strlen($dbInfo['pass']), '*').'@'.$dbInfo['host'].($port ? ':'.$port : null).'/'.$dbInfo['db'];
|
$buff .= 'mysqli://'.$dbInfo['user'].':'.str_pad('', mb_strlen($dbInfo['pass']), '*').'@'.$dbInfo['host'].($port ? ':'.$port : null).'/'.$dbInfo['db'];
|
||||||
$buff .= ($dbInfo['prefix'] ? ' table prefix: '.$dbInfo['prefix'] : null).' '.$errStr;
|
$buff .= ($dbInfo['prefix'] ? ' table prefix: '.$dbInfo['prefix'] : null).' '.$errStr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$buff .= ' '.CLISetup::bold('<empty>');
|
$buff .= ' '.CLISetup::bold('<empty>');
|
||||||
|
|
||||||
return $buff;
|
return $buff;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (file_exists('config/config.php'))
|
if (file_exists('config/config.php'))
|
||||||
require 'config/config.php';
|
require 'config/config.php';
|
||||||
|
|
||||||
foreach ($databases as $idx => $name)
|
foreach ($databases as $idx => $name)
|
||||||
{
|
{
|
||||||
if (empty($AoWoWconf[$name]) && $name != 'characters' )
|
if (empty($AoWoWconf[$name]) && $name != 'characters' )
|
||||||
$AoWoWconf[$name] = array_combine(array_keys($dbFields), ['', '', '', '', '']);
|
$AoWoWconf[$name] = array_combine(array_keys($dbFields), ['', '', '', '', '']);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
CLISetup::log("select a numerical index to use the corresponding entry");
|
CLISetup::log("select a numerical index to use the corresponding entry");
|
||||||
|
|
||||||
$nCharDBs = 0;
|
$nCharDBs = 0;
|
||||||
foreach ($databases as $idx => $name)
|
foreach ($databases as $idx => $name)
|
||||||
{
|
{
|
||||||
if ($idx != 3)
|
if ($idx != 3)
|
||||||
CLISetup::log($testDB($idx, $name, $AoWoWconf[$name]));
|
CLISetup::log($testDB($idx, $name, $AoWoWconf[$name]));
|
||||||
else if (!empty($AoWoWconf[$name]))
|
else if (!empty($AoWoWconf[$name]))
|
||||||
foreach ($AoWoWconf[$name] as $charIdx => $dbInfo)
|
foreach ($AoWoWconf[$name] as $charIdx => $dbInfo)
|
||||||
CLISetup::log($testDB($idx + $nCharDBs++, $name.' ['.$charIdx.']', $AoWoWconf[$name][$charIdx]));
|
CLISetup::log($testDB($idx + $nCharDBs++, $name.' ['.$charIdx.']', $AoWoWconf[$name][$charIdx]));
|
||||||
}
|
}
|
||||||
|
|
||||||
CLISetup::log("[".CLISetup::bold(3 + $nCharDBs)."] add an additional Character DB");
|
CLISetup::log("[".CLISetup::bold(3 + $nCharDBs)."] add an additional Character DB");
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
$inp = ['idx' => ['', true, '/\d/']];
|
$inp = ['idx' => ['', true, '/\d/']];
|
||||||
if (CLISetup::readInput($inp, true) && $inp)
|
if (CLISetup::readInput($inp, true) && $inp)
|
||||||
{
|
{
|
||||||
if ($inp['idx'] >= 0 && $inp['idx'] <= (3 + $nCharDBs))
|
if ($inp['idx'] >= 0 && $inp['idx'] <= (3 + $nCharDBs))
|
||||||
{
|
{
|
||||||
$curFields = $dbFields;
|
$curFields = $dbFields;
|
||||||
|
|
||||||
if ($inp['idx'] == 3 + $nCharDBs) // add new realmDB
|
if ($inp['idx'] == 3 + $nCharDBs) // add new realmDB
|
||||||
$curFields['realmId'] = ['Realm Id', false, '/[1-9][0-9]*/'];
|
$curFields['realmId'] = ['Realm Id', false, '/[1-9][0-9]*/'];
|
||||||
|
|
||||||
if (CLISetup::readInput($curFields))
|
if (CLISetup::readInput($curFields))
|
||||||
{
|
{
|
||||||
// auth, world or aowow
|
// auth, world or aowow
|
||||||
if ($inp['idx'] < 3)
|
if ($inp['idx'] < 3)
|
||||||
$AoWoWconf[$databases[$inp['idx']]] = $curFields ?: array_combine(array_keys($dbFields), ['', '', '', '', '']);
|
$AoWoWconf[$databases[$inp['idx']]] = $curFields ?: array_combine(array_keys($dbFields), ['', '', '', '', '']);
|
||||||
// new char DB
|
// new char DB
|
||||||
else if ($inp['idx'] == 3 + $nCharDBs)
|
else if ($inp['idx'] == 3 + $nCharDBs)
|
||||||
{
|
{
|
||||||
if ($curFields)
|
if ($curFields)
|
||||||
{
|
{
|
||||||
$_ = $curFields['realmId'];
|
$_ = $curFields['realmId'];
|
||||||
unset($curFields['realmId']);
|
unset($curFields['realmId']);
|
||||||
$AoWoWconf[$databases[3]][$_] = $curFields;
|
$AoWoWconf[$databases[3]][$_] = $curFields;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// existing char DB
|
// existing char DB
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($AoWoWconf[$databases[3]] as $realmId => &$dbInfo)
|
foreach ($AoWoWconf[$databases[3]] as $realmId => &$dbInfo)
|
||||||
{
|
{
|
||||||
if ($inp['idx'] - 3 != $i++)
|
if ($inp['idx'] - 3 != $i++)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ($curFields)
|
if ($curFields)
|
||||||
$dbInfo = $curFields;
|
$dbInfo = $curFields;
|
||||||
else
|
else
|
||||||
unset($AoWoWconf[$databases[3]][$realmId]);
|
unset($AoWoWconf[$databases[3]][$realmId]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// write config file
|
// write config file
|
||||||
$buff = "<?php\n\nif (!defined('AOWOW_REVISION'))\n die('illegal access');\n\n\n";
|
$buff = "<?php\n\nif (!defined('AOWOW_REVISION'))\n die('illegal access');\n\n\n";
|
||||||
foreach ($databases as $db)
|
foreach ($databases as $db)
|
||||||
{
|
{
|
||||||
if ($db != 'characters')
|
if ($db != 'characters')
|
||||||
$buff .= '$AoWoWconf[\''.$db.'\'] = '.var_export($AoWoWconf[$db], true).";\n\n";
|
$buff .= '$AoWoWconf[\''.$db.'\'] = '.var_export($AoWoWconf[$db], true).";\n\n";
|
||||||
else
|
else
|
||||||
foreach ($AoWoWconf[$db] as $idx => $charInfo)
|
foreach ($AoWoWconf[$db] as $idx => $charInfo)
|
||||||
$buff .= '$AoWoWconf[\''.$db.'\'][\''.$idx.'\'] = '.var_export($AoWoWconf[$db][$idx], true).";\n\n";
|
$buff .= '$AoWoWconf[\''.$db.'\'][\''.$idx.'\'] = '.var_export($AoWoWconf[$db][$idx], true).";\n\n";
|
||||||
}
|
}
|
||||||
$buff .= "?>\n";
|
$buff .= "?>\n";
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
CLISetup::writeFile('config/config.php', $buff);
|
CLISetup::writeFile('config/config.php', $buff);
|
||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
CLISetup::log("edit canceled! returning to list...", CLISetup::LOG_INFO);
|
CLISetup::log("edit canceled! returning to list...", CLISetup::LOG_INFO);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
CLISetup::log("leaving db setup...", CLISetup::LOG_INFO);
|
CLISetup::log("leaving db setup...", CLISetup::LOG_INFO);
|
||||||
break 2;
|
break 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,292 +1,292 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('invalid access');
|
die('invalid access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
/* string setup steps together for first use */
|
/* string setup steps together for first use */
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
|
|
||||||
function firstrun()
|
function firstrun()
|
||||||
{
|
{
|
||||||
require_once 'setup/tools/sqlGen.class.php';
|
require_once 'setup/tools/sqlGen.class.php';
|
||||||
require_once 'setup/tools/fileGen.class.php';
|
require_once 'setup/tools/fileGen.class.php';
|
||||||
|
|
||||||
SqlGen::init(true);
|
SqlGen::init(true);
|
||||||
FileGen::init(true);
|
FileGen::init(true);
|
||||||
|
|
||||||
/****************/
|
/****************/
|
||||||
/* define steps */
|
/* define steps */
|
||||||
/****************/
|
/****************/
|
||||||
|
|
||||||
$steps = array(
|
$steps = array(
|
||||||
// clisetup/, params, test script result, introText, errorText
|
// clisetup/, params, test script result, introText, errorText
|
||||||
['dbconfig', null, 'testDB', 'Please enter your database credentials.', 'could not establish connection to:'],
|
['dbconfig', null, 'testDB', 'Please enter your database credentials.', 'could not establish connection to:'],
|
||||||
['siteconfig', null, 'testSelf', 'SITE_HOST and STATIC_HOST '.CLISetup::bold('must').' be set. Also enable FORCE_SSL if needed. You may also want to change other variables such as NAME, NAME_SHORT OR LOCALES.', 'could not access:'],
|
['siteconfig', null, 'testSelf', 'SITE_HOST and STATIC_HOST '.CLISetup::bold('must').' be set. Also enable FORCE_SSL if needed. You may also want to change other variables such as NAME, NAME_SHORT OR LOCALES.', 'could not access:'],
|
||||||
// sql- and build- stuff here
|
// sql- and build- stuff here
|
||||||
['SqlGen::generate', 'achievementcategory', null, null, null],
|
['SqlGen::generate', 'achievementcategory', null, null, null],
|
||||||
['SqlGen::generate', 'achievementcriteria', null, null, null],
|
['SqlGen::generate', 'achievementcriteria', null, null, null],
|
||||||
['SqlGen::generate', 'glyphproperties', null, null, null],
|
['SqlGen::generate', 'glyphproperties', null, null, null],
|
||||||
['SqlGen::generate', 'itemenchantment', null, null, null],
|
['SqlGen::generate', 'itemenchantment', null, null, null],
|
||||||
['SqlGen::generate', 'itemenchantmentcondition', null, null, null],
|
['SqlGen::generate', 'itemenchantmentcondition', null, null, null],
|
||||||
['SqlGen::generate', 'itemextendedcost', null, null, null],
|
['SqlGen::generate', 'itemextendedcost', null, null, null],
|
||||||
['SqlGen::generate', 'itemlimitcategory', null, null, null],
|
['SqlGen::generate', 'itemlimitcategory', null, null, null],
|
||||||
['SqlGen::generate', 'itemrandomproppoints', null, null, null],
|
['SqlGen::generate', 'itemrandomproppoints', null, null, null],
|
||||||
['SqlGen::generate', 'lock', null, null, null],
|
['SqlGen::generate', 'lock', null, null, null],
|
||||||
['SqlGen::generate', 'mailtemplate', null, null, null],
|
['SqlGen::generate', 'mailtemplate', null, null, null],
|
||||||
['SqlGen::generate', 'scalingstatdistribution', null, null, null],
|
['SqlGen::generate', 'scalingstatdistribution', null, null, null],
|
||||||
['SqlGen::generate', 'scalingstatvalues', null, null, null],
|
['SqlGen::generate', 'scalingstatvalues', null, null, null],
|
||||||
['SqlGen::generate', 'spellfocusobject', null, null, null],
|
['SqlGen::generate', 'spellfocusobject', null, null, null],
|
||||||
['SqlGen::generate', 'spellrange', null, null, null],
|
['SqlGen::generate', 'spellrange', null, null, null],
|
||||||
['SqlGen::generate', 'spellvariables', null, null, null],
|
['SqlGen::generate', 'spellvariables', null, null, null],
|
||||||
['SqlGen::generate', 'totemcategory', null, null, null],
|
['SqlGen::generate', 'totemcategory', null, null, null],
|
||||||
['SqlGen::generate', 'talents', null, null, null],
|
['SqlGen::generate', 'talents', null, null, null],
|
||||||
['SqlGen::generate', 'classes', null, null, null],
|
['SqlGen::generate', 'classes', null, null, null],
|
||||||
['SqlGen::generate', 'factions', null, null, null],
|
['SqlGen::generate', 'factions', null, null, null],
|
||||||
['SqlGen::generate', 'factiontemplate', null, null, null],
|
['SqlGen::generate', 'factiontemplate', null, null, null],
|
||||||
['SqlGen::generate', 'holidays', null, null, null],
|
['SqlGen::generate', 'holidays', null, null, null],
|
||||||
['SqlGen::generate', 'icons', null, null, null],
|
['SqlGen::generate', 'icons', null, null, null],
|
||||||
['SqlGen::generate', 'itemrandomenchant', null, null, null],
|
['SqlGen::generate', 'itemrandomenchant', null, null, null],
|
||||||
['SqlGen::generate', 'races', null, null, null],
|
['SqlGen::generate', 'races', null, null, null],
|
||||||
['SqlGen::generate', 'shapeshiftforms', null, null, null],
|
['SqlGen::generate', 'shapeshiftforms', null, null, null],
|
||||||
['SqlGen::generate', 'skillline', null, null, null],
|
['SqlGen::generate', 'skillline', null, null, null],
|
||||||
['SqlGen::generate', 'emotes', null, null, null],
|
['SqlGen::generate', 'emotes', null, null, null],
|
||||||
['SqlGen::generate', 'achievement', null, null, null],
|
['SqlGen::generate', 'achievement', null, null, null],
|
||||||
['SqlGen::generate', 'creature', null, null, null],
|
['SqlGen::generate', 'creature', null, null, null],
|
||||||
['SqlGen::generate', 'currencies', null, null, null],
|
['SqlGen::generate', 'currencies', null, null, null],
|
||||||
['SqlGen::generate', 'events', null, null, null],
|
['SqlGen::generate', 'events', null, null, null],
|
||||||
['SqlGen::generate', 'objects', null, null, null],
|
['SqlGen::generate', 'objects', null, null, null],
|
||||||
['SqlGen::generate', 'pet', null, null, null],
|
['SqlGen::generate', 'pet', null, null, null],
|
||||||
['SqlGen::generate', 'quests', null, null, null],
|
['SqlGen::generate', 'quests', null, null, null],
|
||||||
['SqlGen::generate', 'quests_startend', null, null, null],
|
['SqlGen::generate', 'quests_startend', null, null, null],
|
||||||
['SqlGen::generate', 'spell', null, null, null],
|
['SqlGen::generate', 'spell', null, null, null],
|
||||||
['SqlGen::generate', 'spelldifficulty', null, null, null],
|
['SqlGen::generate', 'spelldifficulty', null, null, null],
|
||||||
['SqlGen::generate', 'taxi', null, null, null],
|
['SqlGen::generate', 'taxi', null, null, null],
|
||||||
['SqlGen::generate', 'titles', null, null, null],
|
['SqlGen::generate', 'titles', null, null, null],
|
||||||
['SqlGen::generate', 'items', null, null, null],
|
['SqlGen::generate', 'items', null, null, null],
|
||||||
['FileGen::generate', 'complexImg', null, null, null], // alphamaps generated here are requires for spawns/waypoints
|
['FileGen::generate', 'complexImg', null, null, null], // alphamaps generated here are requires for spawns/waypoints
|
||||||
['SqlGen::generate', 'spawns', null, null, null], // this one ^_^
|
['SqlGen::generate', 'spawns', null, null, null], // this one ^_^
|
||||||
['SqlGen::generate', 'zones', null, null, null],
|
['SqlGen::generate', 'zones', null, null, null],
|
||||||
['SqlGen::generate', 'itemset', null, null, null],
|
['SqlGen::generate', 'itemset', null, null, null],
|
||||||
['SqlGen::generate', 'item_stats', null, null, null],
|
['SqlGen::generate', 'item_stats', null, null, null],
|
||||||
['SqlGen::generate', 'source', null, null, null],
|
['SqlGen::generate', 'source', null, null, null],
|
||||||
['FileGen::generate', 'searchplugin', null, null, null],
|
['FileGen::generate', 'searchplugin', null, null, null],
|
||||||
['FileGen::generate', 'power', null, null, null],
|
['FileGen::generate', 'power', null, null, null],
|
||||||
['FileGen::generate', 'searchboxScript', null, null, null],
|
['FileGen::generate', 'searchboxScript', null, null, null],
|
||||||
['FileGen::generate', 'demo', null, null, null],
|
['FileGen::generate', 'demo', null, null, null],
|
||||||
['FileGen::generate', 'searchboxBody', null, null, null],
|
['FileGen::generate', 'searchboxBody', null, null, null],
|
||||||
['FileGen::generate', 'realmMenu', null, null, null],
|
['FileGen::generate', 'realmMenu', null, null, null],
|
||||||
['FileGen::generate', 'locales', null, null, null],
|
['FileGen::generate', 'locales', null, null, null],
|
||||||
['FileGen::generate', 'itemScaling', null, null, null],
|
['FileGen::generate', 'itemScaling', null, null, null],
|
||||||
['FileGen::generate', 'realms', null, null, null],
|
['FileGen::generate', 'realms', null, null, null],
|
||||||
['FileGen::generate', 'statistics', null, null, null],
|
['FileGen::generate', 'statistics', null, null, null],
|
||||||
['FileGen::generate', 'simpleImg', null, null, null],
|
['FileGen::generate', 'simpleImg', null, null, null],
|
||||||
['FileGen::generate', 'talentCalc', null, null, null],
|
['FileGen::generate', 'talentCalc', null, null, null],
|
||||||
['FileGen::generate', 'pets', null, null, null],
|
['FileGen::generate', 'pets', null, null, null],
|
||||||
['FileGen::generate', 'talentIcons', null, null, null],
|
['FileGen::generate', 'talentIcons', null, null, null],
|
||||||
['FileGen::generate', 'glyphs', null, null, null],
|
['FileGen::generate', 'glyphs', null, null, null],
|
||||||
['FileGen::generate', 'itemsets', null, null, null],
|
['FileGen::generate', 'itemsets', null, null, null],
|
||||||
['FileGen::generate', 'enchants', null, null, null],
|
['FileGen::generate', 'enchants', null, null, null],
|
||||||
['FileGen::generate', 'gems', null, null, null],
|
['FileGen::generate', 'gems', null, null, null],
|
||||||
['FileGen::generate', 'profiler', null, null, null],
|
['FileGen::generate', 'profiler', null, null, null],
|
||||||
['FileGen::generate', 'weightPresets', null, null, null],
|
['FileGen::generate', 'weightPresets', null, null, null],
|
||||||
// apply sql-updates from repository
|
// apply sql-updates from repository
|
||||||
['update', null, null, null, null],
|
['update', null, null, null, null],
|
||||||
['account', null, 'testAcc', 'Please create your admin account.', 'There is no user with administrator priviledges in the DB.'],
|
['account', null, 'testAcc', 'Please create your admin account.', 'There is no user with administrator priviledges in the DB.'],
|
||||||
['endSetup', null, null, null, null],
|
['endSetup', null, null, null, null],
|
||||||
);
|
);
|
||||||
|
|
||||||
/**********/
|
/**********/
|
||||||
/* helper */
|
/* helper */
|
||||||
/**********/
|
/**********/
|
||||||
|
|
||||||
$saveProgress = function($nStep)
|
$saveProgress = function($nStep)
|
||||||
{
|
{
|
||||||
$h = fopen('cache/firstrun', 'w');
|
$h = fopen('cache/firstrun', 'w');
|
||||||
fwrite($h, AOWOW_REVISION."\n".($nStep + 1)."\n");
|
fwrite($h, AOWOW_REVISION."\n".($nStep + 1)."\n");
|
||||||
fclose($h);
|
fclose($h);
|
||||||
};
|
};
|
||||||
|
|
||||||
function testDB(&$error)
|
function testDB(&$error)
|
||||||
{
|
{
|
||||||
require 'config/config.php';
|
require 'config/config.php';
|
||||||
|
|
||||||
$error = [];
|
$error = [];
|
||||||
$defPort = ini_get('mysqli.default_port');
|
$defPort = ini_get('mysqli.default_port');
|
||||||
|
|
||||||
foreach (['world', 'aowow', 'auth'] as $what)
|
foreach (['world', 'aowow', 'auth'] as $what)
|
||||||
{
|
{
|
||||||
if ($what == 'auth' && (empty($AoWoWconf['auth']) || empty($AoWoWconf['auth']['host'])))
|
if ($what == 'auth' && (empty($AoWoWconf['auth']) || empty($AoWoWconf['auth']['host'])))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$port = 0;
|
$port = 0;
|
||||||
if (strstr($AoWoWconf[$what]['host'], ':'))
|
if (strstr($AoWoWconf[$what]['host'], ':'))
|
||||||
list($AoWoWconf[$what]['host'], $port) = explode(':', $AoWoWconf[$what]['host']);
|
list($AoWoWconf[$what]['host'], $port) = explode(':', $AoWoWconf[$what]['host']);
|
||||||
|
|
||||||
if ($link = @mysqli_connect($AoWoWconf[$what]['host'], $AoWoWconf[$what]['user'], $AoWoWconf[$what]['pass'], $AoWoWconf[$what]['db'], $port ?: $defPort))
|
if ($link = @mysqli_connect($AoWoWconf[$what]['host'], $AoWoWconf[$what]['user'], $AoWoWconf[$what]['pass'], $AoWoWconf[$what]['db'], $port ?: $defPort))
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
else
|
else
|
||||||
$error[] = ' * '.$what.': '.'['.mysqli_connect_errno().'] '.mysqli_connect_error();
|
$error[] = ' * '.$what.': '.'['.mysqli_connect_errno().'] '.mysqli_connect_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
return empty($error);
|
return empty($error);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testSelf(&$error)
|
function testSelf(&$error)
|
||||||
{
|
{
|
||||||
$error = [];
|
$error = [];
|
||||||
$test = function($url, &$rCode)
|
$test = function($url, &$rCode)
|
||||||
{
|
{
|
||||||
$res = get_headers($url, true);
|
$res = get_headers($url, true);
|
||||||
|
|
||||||
if (preg_match("/HTTP\/[0-9\.]+\s+([0-9]+)/", $res[0], $m))
|
if (preg_match("/HTTP\/[0-9\.]+\s+([0-9]+)/", $res[0], $m))
|
||||||
{
|
{
|
||||||
$rCode = $m[1];
|
$rCode = $m[1];
|
||||||
return $m[1] == 200;
|
return $m[1] == 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
$rCode = 0;
|
$rCode = 0;
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
$res = DB::Aowow()->selectCol('SELECT `key` AS ARRAY_KEY, value FROM ?_config WHERE `key` IN ("site_host", "static_host", "force_ssl")');
|
$res = DB::Aowow()->selectCol('SELECT `key` AS ARRAY_KEY, value FROM ?_config WHERE `key` IN ("site_host", "static_host", "force_ssl")');
|
||||||
$prot = $res['force_ssl'] ? 'https://' : 'http://';
|
$prot = $res['force_ssl'] ? 'https://' : 'http://';
|
||||||
if ($res['site_host'])
|
if ($res['site_host'])
|
||||||
{
|
{
|
||||||
if (!$test($prot.$res['site_host'].'/README.md', $resp))
|
if (!$test($prot.$res['site_host'].'/README.md', $resp))
|
||||||
$error[] = ' * could not access '.$prot.$res['site_host'].'/README.md ['.$resp.']';
|
$error[] = ' * could not access '.$prot.$res['site_host'].'/README.md ['.$resp.']';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$error[] = ' * SITE_HOST is empty';
|
$error[] = ' * SITE_HOST is empty';
|
||||||
|
|
||||||
if ($res['static_host'])
|
if ($res['static_host'])
|
||||||
{
|
{
|
||||||
if (!$test($prot.$res['static_host'].'/css/aowow.css', $resp))
|
if (!$test($prot.$res['static_host'].'/css/aowow.css', $resp))
|
||||||
$error[] = ' * could not access '.$prot.$res['static_host'].'/css/aowow.css ['.$resp.']';
|
$error[] = ' * could not access '.$prot.$res['static_host'].'/css/aowow.css ['.$resp.']';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$error[] = ' * STATIC_HOST is empty';
|
$error[] = ' * STATIC_HOST is empty';
|
||||||
|
|
||||||
return empty($error);
|
return empty($error);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testAcc(&$error)
|
function testAcc(&$error)
|
||||||
{
|
{
|
||||||
$error = [];
|
$error = [];
|
||||||
return !!DB::Aowow()->selectCell('SELECT id FROM ?_account WHERE userPerms = 1');
|
return !!DB::Aowow()->selectCell('SELECT id FROM ?_account WHERE userPerms = 1');
|
||||||
}
|
}
|
||||||
|
|
||||||
function endSetup()
|
function endSetup()
|
||||||
{
|
{
|
||||||
return DB::Aowow()->query('UPDATE ?_config SET value = 0 WHERE `key` = "maintenance"');
|
return DB::Aowow()->query('UPDATE ?_config SET value = 0 WHERE `key` = "maintenance"');
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************/
|
/********************/
|
||||||
/* get current step */
|
/* get current step */
|
||||||
/********************/
|
/********************/
|
||||||
|
|
||||||
$startStep = 0;
|
$startStep = 0;
|
||||||
if (file_exists('cache/firstrun'))
|
if (file_exists('cache/firstrun'))
|
||||||
{
|
{
|
||||||
$rows = file('cache/firstrun');
|
$rows = file('cache/firstrun');
|
||||||
if ((int)$rows[0] == AOWOW_REVISION)
|
if ((int)$rows[0] == AOWOW_REVISION)
|
||||||
$startStep = (int)$rows[1];
|
$startStep = (int)$rows[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($startStep)
|
if ($startStep)
|
||||||
{
|
{
|
||||||
|
|
||||||
CLISetup::log('Found firstrun progression info. (Halted on subscript '.($steps[$startStep][1] ?: $steps[$startStep][0]).')', CLISetup::LOG_INFO);
|
CLISetup::log('Found firstrun progression info. (Halted on subscript '.($steps[$startStep][1] ?: $steps[$startStep][0]).')', CLISetup::LOG_INFO);
|
||||||
$inp = ['x' => ['continue setup? (y/n)', true, '/y|n/i']];
|
$inp = ['x' => ['continue setup? (y/n)', true, '/y|n/i']];
|
||||||
$msg = '';
|
$msg = '';
|
||||||
if (!CLISetup::readInput($inp, true) || !$inp || strtolower($inp['x']) == 'n')
|
if (!CLISetup::readInput($inp, true) || !$inp || strtolower($inp['x']) == 'n')
|
||||||
{
|
{
|
||||||
$msg = 'Starting setup from scratch...';
|
$msg = 'Starting setup from scratch...';
|
||||||
$startStep = 0;
|
$startStep = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$msg = 'Resuming setup from step '.$startStep.'...';
|
$msg = 'Resuming setup from step '.$startStep.'...';
|
||||||
|
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
CLISetup::log($msg);
|
CLISetup::log($msg);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******/
|
/*******/
|
||||||
/* run */
|
/* run */
|
||||||
/*******/
|
/*******/
|
||||||
|
|
||||||
foreach ($steps as $idx => $step)
|
foreach ($steps as $idx => $step)
|
||||||
{
|
{
|
||||||
if ($startStep > $idx)
|
if ($startStep > $idx)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!strpos($step[0], '::') && !is_callable($step[0]))
|
if (!strpos($step[0], '::') && !is_callable($step[0]))
|
||||||
require_once 'setup/tools/clisetup/'.$step[0].'.func.php';
|
require_once 'setup/tools/clisetup/'.$step[0].'.func.php';
|
||||||
|
|
||||||
if ($step[3])
|
if ($step[3])
|
||||||
{
|
{
|
||||||
CLISetup::log($step[3]);
|
CLISetup::log($step[3]);
|
||||||
$inp = ['x' => ['Press any key to continue', true]];
|
$inp = ['x' => ['Press any key to continue', true]];
|
||||||
|
|
||||||
if (!CLISetup::readInput($inp, true)) // we don't actually care about the input
|
if (!CLISetup::readInput($inp, true)) // we don't actually care about the input
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
$res = call_user_func($step[0], $step[1]);
|
$res = call_user_func($step[0], $step[1]);
|
||||||
|
|
||||||
// check script result
|
// check script result
|
||||||
if ($step[2])
|
if ($step[2])
|
||||||
{
|
{
|
||||||
if (!$step[2]($errors))
|
if (!$step[2]($errors))
|
||||||
{
|
{
|
||||||
CLISetup::log($step[4], CLISetup::LOG_ERROR);
|
CLISetup::log($step[4], CLISetup::LOG_ERROR);
|
||||||
foreach ($errors as $e)
|
foreach ($errors as $e)
|
||||||
CLISetup::log($e);
|
CLISetup::log($e);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$saveProgress($idx);
|
$saveProgress($idx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($res !== false)
|
else if ($res !== false)
|
||||||
{
|
{
|
||||||
$saveProgress($idx);
|
$saveProgress($idx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$inp = ['x' => ['['.CLISetup::bold('c').']ontinue anyway? ['.CLISetup::bold('r').']etry? ['.CLISetup::bold('a').']bort?', true, '/c|r|a/i']];
|
$inp = ['x' => ['['.CLISetup::bold('c').']ontinue anyway? ['.CLISetup::bold('r').']etry? ['.CLISetup::bold('a').']bort?', true, '/c|r|a/i']];
|
||||||
if (CLISetup::readInput($inp, true) && $inp)
|
if (CLISetup::readInput($inp, true) && $inp)
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
switch(strtolower($inp['x']))
|
switch(strtolower($inp['x']))
|
||||||
{
|
{
|
||||||
case 'c':
|
case 'c':
|
||||||
$saveProgress($idx);
|
$saveProgress($idx);
|
||||||
break 2;
|
break 2;
|
||||||
case 'r':
|
case 'r':
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink('cache/firstrun');
|
unlink('cache/firstrun');
|
||||||
CLISetup::log('setup finished', CLISetup::LOG_OK);
|
CLISetup::log('setup finished', CLISetup::LOG_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,347 +1,347 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('invalid access');
|
die('invalid access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/****************************/
|
/****************************/
|
||||||
/* Configure Site variables */
|
/* Configure Site variables */
|
||||||
/****************************/
|
/****************************/
|
||||||
|
|
||||||
function siteconfig()
|
function siteconfig()
|
||||||
{
|
{
|
||||||
$reqKeys = ['site_host', 'static_host'];
|
$reqKeys = ['site_host', 'static_host'];
|
||||||
|
|
||||||
if (!DB::isConnected(DB_AOWOW))
|
if (!DB::isConnected(DB_AOWOW))
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
CLISetup::log("database not yet set up!\n Please use --dbconfig for setup", CLISetup::LOG_WARN);
|
CLISetup::log("database not yet set up!\n Please use --dbconfig for setup", CLISetup::LOG_WARN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
CLISetup::log('select a numerical index to use the corresponding entry');
|
CLISetup::log('select a numerical index to use the corresponding entry');
|
||||||
|
|
||||||
$sumNum = 0;
|
$sumNum = 0;
|
||||||
$cfgList = [];
|
$cfgList = [];
|
||||||
$hasEmpty = false;
|
$hasEmpty = false;
|
||||||
$mainBuff = [];
|
$mainBuff = [];
|
||||||
$miscBuff = []; // catg 'misc' should come last
|
$miscBuff = []; // catg 'misc' should come last
|
||||||
|
|
||||||
foreach (Util::$configCats as $idx => $cat)
|
foreach (Util::$configCats as $idx => $cat)
|
||||||
{
|
{
|
||||||
if ($idx)
|
if ($idx)
|
||||||
$mainBuff[] = '===== '.$cat.' =====';
|
$mainBuff[] = '===== '.$cat.' =====';
|
||||||
else
|
else
|
||||||
$miscBuff[] = '===== '.$cat.' =====';
|
$miscBuff[] = '===== '.$cat.' =====';
|
||||||
|
|
||||||
$results = DB::Aowow()->select('SELECT *, (flags & ?d) AS php FROM ?_config WHERE `cat` = ?d ORDER BY `key` ASC', CON_FLAG_PHP, $idx);
|
$results = DB::Aowow()->select('SELECT *, (flags & ?d) AS php FROM ?_config WHERE `cat` = ?d ORDER BY `key` ASC', CON_FLAG_PHP, $idx);
|
||||||
|
|
||||||
foreach ($results as $num => $data)
|
foreach ($results as $num => $data)
|
||||||
{
|
{
|
||||||
if (!($data['flags'] & CON_FLAG_PHP) && $data['value'] === '' && in_array($data['key'], $reqKeys))
|
if (!($data['flags'] & CON_FLAG_PHP) && $data['value'] === '' && in_array($data['key'], $reqKeys))
|
||||||
$hasEmpty = true;
|
$hasEmpty = true;
|
||||||
|
|
||||||
$cfgList[$sumNum + $num] = $data;
|
$cfgList[$sumNum + $num] = $data;
|
||||||
|
|
||||||
$php = $data['flags'] & CON_FLAG_PHP;
|
$php = $data['flags'] & CON_FLAG_PHP;
|
||||||
$buff = "[".CLISetup::bold($sumNum + $num)."] ".(($sumNum + $num) > 9 ? '' : ' ').($php ? ' PHP ' : ' AOWOW ');
|
$buff = "[".CLISetup::bold($sumNum + $num)."] ".(($sumNum + $num) > 9 ? '' : ' ').($php ? ' PHP ' : ' AOWOW ');
|
||||||
$buff .= str_pad($php ? strtolower($data['key']) : strtoupper($data['key']), 35);
|
$buff .= str_pad($php ? strtolower($data['key']) : strtoupper($data['key']), 35);
|
||||||
if ($data['value'] === '')
|
if ($data['value'] === '')
|
||||||
$buff .= in_array($data['key'], $reqKeys) ? CLISetup::red('<empty>') : '<empty>';
|
$buff .= in_array($data['key'], $reqKeys) ? CLISetup::red('<empty>') : '<empty>';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$info = explode(' - ', $data['comment']);
|
$info = explode(' - ', $data['comment']);
|
||||||
|
|
||||||
if ($data['flags'] & CON_FLAG_TYPE_BOOL)
|
if ($data['flags'] & CON_FLAG_TYPE_BOOL)
|
||||||
$buff .= '[bool] '.($data['value'] ? '<Enabled>' : '<Disabled>');
|
$buff .= '[bool] '.($data['value'] ? '<Enabled>' : '<Disabled>');
|
||||||
else if ($data['flags'] & CON_FLAG_OPT_LIST && !empty($info[2]))
|
else if ($data['flags'] & CON_FLAG_OPT_LIST && !empty($info[2]))
|
||||||
{
|
{
|
||||||
$buff .= "[opt] ";
|
$buff .= "[opt] ";
|
||||||
foreach (explode(', ', $info[2]) as $option)
|
foreach (explode(', ', $info[2]) as $option)
|
||||||
{
|
{
|
||||||
$opt = explode(':', $option);
|
$opt = explode(':', $option);
|
||||||
$buff .= '['.($data['value'] == $opt[0] ? 'x' : ' ').']'.$opt[1].' ';
|
$buff .= '['.($data['value'] == $opt[0] ? 'x' : ' ').']'.$opt[1].' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($data['flags'] & CON_FLAG_BITMASK && !empty($info[2]))
|
else if ($data['flags'] & CON_FLAG_BITMASK && !empty($info[2]))
|
||||||
{
|
{
|
||||||
$buff .= "[mask] ";
|
$buff .= "[mask] ";
|
||||||
foreach (explode(', ', $info[2]) as $option)
|
foreach (explode(', ', $info[2]) as $option)
|
||||||
{
|
{
|
||||||
$opt = explode(':', $option);
|
$opt = explode(':', $option);
|
||||||
$buff .= '['.($data['value'] & (1 << $opt[0]) ? 'x' : ' ').']'.$opt[1].' ';
|
$buff .= '['.($data['value'] & (1 << $opt[0]) ? 'x' : ' ').']'.$opt[1].' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($data['flags'] & CON_FLAG_TYPE_STRING)
|
else if ($data['flags'] & CON_FLAG_TYPE_STRING)
|
||||||
$buff .= "[str] ".$data['value'];
|
$buff .= "[str] ".$data['value'];
|
||||||
else if ($data['flags'] & CON_FLAG_TYPE_FLOAT)
|
else if ($data['flags'] & CON_FLAG_TYPE_FLOAT)
|
||||||
$buff .= "[float] ".floatVal($data['value']);
|
$buff .= "[float] ".floatVal($data['value']);
|
||||||
else /* if ($data['flags'] & CON_FLAG_TYPE_INT) */
|
else /* if ($data['flags'] & CON_FLAG_TYPE_INT) */
|
||||||
$buff .= "[int] ".intVal($data['value']);
|
$buff .= "[int] ".intVal($data['value']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($idx)
|
if ($idx)
|
||||||
$mainBuff[] = $buff;
|
$mainBuff[] = $buff;
|
||||||
else
|
else
|
||||||
$miscBuff[] = $buff;
|
$miscBuff[] = $buff;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sumNum += count($results);
|
$sumNum += count($results);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($mainBuff as $b)
|
foreach ($mainBuff as $b)
|
||||||
CLISetup::log($b);
|
CLISetup::log($b);
|
||||||
|
|
||||||
foreach ($miscBuff as $b)
|
foreach ($miscBuff as $b)
|
||||||
CLISetup::log($b);
|
CLISetup::log($b);
|
||||||
|
|
||||||
CLISetup::log(str_pad("[".CLISetup::bold($sumNum)."]", 21)."add another php configuration");
|
CLISetup::log(str_pad("[".CLISetup::bold($sumNum)."]", 21)."add another php configuration");
|
||||||
|
|
||||||
if ($hasEmpty)
|
if ($hasEmpty)
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
CLISetup::log("please configure the required empty setings", CLISetup::LOG_WARN);
|
CLISetup::log("please configure the required empty setings", CLISetup::LOG_WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
$inp = ['idx' => ['', false, '/\d/']];
|
$inp = ['idx' => ['', false, '/\d/']];
|
||||||
if (CLISetup::readInput($inp) && $inp && $inp['idx'] !== '')
|
if (CLISetup::readInput($inp) && $inp && $inp['idx'] !== '')
|
||||||
{
|
{
|
||||||
// add new php setting
|
// add new php setting
|
||||||
if ($inp['idx'] == $sumNum)
|
if ($inp['idx'] == $sumNum)
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
CLISetup::log("Adding additional php configuration.");
|
CLISetup::log("Adding additional php configuration.");
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
$setting = array(
|
$setting = array(
|
||||||
'key' => ['option name', false, '/[\w_\.\-]/i'],
|
'key' => ['option name', false, '/[\w_\.\-]/i'],
|
||||||
'val' => ['value', ]
|
'val' => ['value', ]
|
||||||
);
|
);
|
||||||
if (CLISetup::readInput($setting) && $setting)
|
if (CLISetup::readInput($setting) && $setting)
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
|
|
||||||
$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)
|
||||||
{
|
{
|
||||||
CLISetup::log("this configuration option cannot be set", CLISetup::LOG_ERROR);
|
CLISetup::log("this configuration option cannot be set", CLISetup::LOG_ERROR);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
else if (DB::Aowow()->selectCell('SELECT 1 FROM ?_config WHERE `flags` & ?d AND `key` = ?', CON_FLAG_PHP, $key))
|
else if (DB::Aowow()->selectCell('SELECT 1 FROM ?_config WHERE `flags` & ?d AND `key` = ?', CON_FLAG_PHP, $key))
|
||||||
{
|
{
|
||||||
CLISetup::log("this configuration option is already in use", CLISetup::LOG_ERROR);
|
CLISetup::log("this configuration option is already in use", CLISetup::LOG_ERROR);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DB::Aowow()->query('INSERT IGNORE INTO ?_config (`key`, `value`, `flags`) VALUES (?, ?, ?d)', $key, $setting['val'], CON_FLAG_TYPE_STRING | CON_FLAG_PHP);
|
DB::Aowow()->query('INSERT IGNORE INTO ?_config (`key`, `value`, `flags`) VALUES (?, ?, ?d)', $key, $setting['val'], CON_FLAG_TYPE_STRING | CON_FLAG_PHP);
|
||||||
CLISetup::log("new php configuration added", CLISetup::LOG_OK);
|
CLISetup::log("new php configuration added", CLISetup::LOG_OK);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
CLISetup::log("edit canceled! returning to list...", CLISetup::LOG_INFO);
|
CLISetup::log("edit canceled! returning to list...", CLISetup::LOG_INFO);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// edit existing setting
|
// edit existing setting
|
||||||
else if ($inp['idx'] >= 0 && $inp['idx'] < $sumNum)
|
else if ($inp['idx'] >= 0 && $inp['idx'] < $sumNum)
|
||||||
{
|
{
|
||||||
$conf = $cfgList[$inp['idx']];
|
$conf = $cfgList[$inp['idx']];
|
||||||
$info = explode(' - ', $conf['comment']);
|
$info = explode(' - ', $conf['comment']);
|
||||||
$buff = '';
|
$buff = '';
|
||||||
|
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
$buff .= $conf['flags'] & CON_FLAG_PHP ? " PHP: " : "AOWOW: ";
|
$buff .= $conf['flags'] & CON_FLAG_PHP ? " PHP: " : "AOWOW: ";
|
||||||
$buff .= $conf['flags'] & CON_FLAG_PHP ? strtolower($conf['key']) : strtoupper('cfg_'.$conf['key']);
|
$buff .= $conf['flags'] & CON_FLAG_PHP ? strtolower($conf['key']) : strtoupper('cfg_'.$conf['key']);
|
||||||
|
|
||||||
if (!empty($info[1]))
|
if (!empty($info[1]))
|
||||||
$buff .= " - ".$info[1];
|
$buff .= " - ".$info[1];
|
||||||
|
|
||||||
CLISetup::log($buff);
|
CLISetup::log($buff);
|
||||||
|
|
||||||
$buff = "VALUE: ";
|
$buff = "VALUE: ";
|
||||||
|
|
||||||
if ($conf['flags'] & CON_FLAG_TYPE_BOOL)
|
if ($conf['flags'] & CON_FLAG_TYPE_BOOL)
|
||||||
$buff .= $conf['value'] ? '<Enabled>' : '<Disabled>';
|
$buff .= $conf['value'] ? '<Enabled>' : '<Disabled>';
|
||||||
else if ($conf['flags'] & CON_FLAG_OPT_LIST && !empty($info[2]))
|
else if ($conf['flags'] & CON_FLAG_OPT_LIST && !empty($info[2]))
|
||||||
{
|
{
|
||||||
foreach (explode(', ', $info[2]) as $option)
|
foreach (explode(', ', $info[2]) as $option)
|
||||||
{
|
{
|
||||||
$opt = explode(':', $option);
|
$opt = explode(':', $option);
|
||||||
$buff .= '['.($conf['value'] == $opt[0] ? 'x' : ' ').'] '.$opt[1].' ';
|
$buff .= '['.($conf['value'] == $opt[0] ? 'x' : ' ').'] '.$opt[1].' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($conf['flags'] & CON_FLAG_BITMASK && !empty($info[2]))
|
else if ($conf['flags'] & CON_FLAG_BITMASK && !empty($info[2]))
|
||||||
{
|
{
|
||||||
foreach (explode(', ', $info[2]) as $option)
|
foreach (explode(', ', $info[2]) as $option)
|
||||||
{
|
{
|
||||||
$opt = explode(':', $option);
|
$opt = explode(':', $option);
|
||||||
$buff .= '['.($conf['value'] & (1 << $opt[0]) ? 'x' : ' ').'] '.$opt[1].' ';
|
$buff .= '['.($conf['value'] & (1 << $opt[0]) ? 'x' : ' ').'] '.$opt[1].' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($conf['flags'] & CON_FLAG_TYPE_STRING)
|
else if ($conf['flags'] & CON_FLAG_TYPE_STRING)
|
||||||
$buff .= $conf['value'];
|
$buff .= $conf['value'];
|
||||||
else if ($conf['flags'] & CON_FLAG_TYPE_FLOAT)
|
else if ($conf['flags'] & CON_FLAG_TYPE_FLOAT)
|
||||||
$buff .= floatVal($conf['value']);
|
$buff .= floatVal($conf['value']);
|
||||||
else /* if ($conf['flags'] & CON_FLAG_TYPE_INT) */
|
else /* if ($conf['flags'] & CON_FLAG_TYPE_INT) */
|
||||||
$buff .= intVal($conf['value']);
|
$buff .= intVal($conf['value']);
|
||||||
|
|
||||||
CLISetup::log($buff);
|
CLISetup::log($buff);
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
CLISetup::log("[".CLISetup::bold('E')."]dit");
|
CLISetup::log("[".CLISetup::bold('E')."]dit");
|
||||||
|
|
||||||
if (!($conf['flags'] & CON_FLAG_PERSISTENT))
|
if (!($conf['flags'] & CON_FLAG_PERSISTENT))
|
||||||
CLISetup::log("[".CLISetup::bold('D')."]elete");
|
CLISetup::log("[".CLISetup::bold('D')."]elete");
|
||||||
|
|
||||||
if (strstr($info[0], 'default:'))
|
if (strstr($info[0], 'default:'))
|
||||||
CLISetup::log("[".CLISetup::bold('R')."]estore Default - ".trim(explode('default:', $info[0])[1]));
|
CLISetup::log("[".CLISetup::bold('R')."]estore Default - ".trim(explode('default:', $info[0])[1]));
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
$action = ['idx' => ['', true, '/[edr]/i']];
|
$action = ['idx' => ['', true, '/[edr]/i']];
|
||||||
if (CLISetup::readInput($action, true) && $action)
|
if (CLISetup::readInput($action, true) && $action)
|
||||||
{
|
{
|
||||||
switch (strtoupper($action['idx']))
|
switch (strtoupper($action['idx']))
|
||||||
{
|
{
|
||||||
case 'E': // edit value
|
case 'E': // edit value
|
||||||
$pattern = false;
|
$pattern = false;
|
||||||
$single = false;
|
$single = false;
|
||||||
$value = ['idx' => ['Select new value', false, &$pattern]];
|
$value = ['idx' => ['Select new value', false, &$pattern]];
|
||||||
|
|
||||||
if ($conf['flags'] & CON_FLAG_OPT_LIST)
|
if ($conf['flags'] & CON_FLAG_OPT_LIST)
|
||||||
{
|
{
|
||||||
$_valid = [];
|
$_valid = [];
|
||||||
foreach (explode(', ', $info[2]) as $option)
|
foreach (explode(', ', $info[2]) as $option)
|
||||||
{
|
{
|
||||||
$opt = explode(':', $option);
|
$opt = explode(':', $option);
|
||||||
$_valid[] = $opt[0];
|
$_valid[] = $opt[0];
|
||||||
CLISetup::log('['.CLISetup::bold($opt[0]).'] '.$opt[1]);
|
CLISetup::log('['.CLISetup::bold($opt[0]).'] '.$opt[1]);
|
||||||
}
|
}
|
||||||
$single = true;
|
$single = true;
|
||||||
$pattern = '/\d/';
|
$pattern = '/\d/';
|
||||||
$validate = function ($v) use($_valid) { return in_array($v, $_valid); };
|
$validate = function ($v) use($_valid) { return in_array($v, $_valid); };
|
||||||
}
|
}
|
||||||
else if ($conf['flags'] & CON_FLAG_BITMASK)
|
else if ($conf['flags'] & CON_FLAG_BITMASK)
|
||||||
{
|
{
|
||||||
CLISetup::log('Bitmask: sum fields to select multiple options');
|
CLISetup::log('Bitmask: sum fields to select multiple options');
|
||||||
$_valid = 0x0;
|
$_valid = 0x0;
|
||||||
foreach (explode(', ', $info[2]) as $option)
|
foreach (explode(', ', $info[2]) as $option)
|
||||||
{
|
{
|
||||||
$opt = explode(':', $option);
|
$opt = explode(':', $option);
|
||||||
$_valid |= (1 << $opt[0]);
|
$_valid |= (1 << $opt[0]);
|
||||||
CLISetup::log('['.CLISetup::bold(1 << $opt[0]).']'.str_pad('', 4-strlen(1 << $opt[0])).$opt[1]);
|
CLISetup::log('['.CLISetup::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 & $_valid; return $v; };
|
||||||
}
|
}
|
||||||
else if ($conf['flags'] & CON_FLAG_TYPE_BOOL)
|
else if ($conf['flags'] & CON_FLAG_TYPE_BOOL)
|
||||||
{
|
{
|
||||||
CLISetup::log('['.CLISetup::bold(0).'] Disabled');
|
CLISetup::log('['.CLISetup::bold(0).'] Disabled');
|
||||||
CLISetup::log('['.CLISetup::bold(1).'] Enabled');
|
CLISetup::log('['.CLISetup::bold(1).'] Enabled');
|
||||||
|
|
||||||
$single = true;
|
$single = true;
|
||||||
$pattern = '/[01]/';
|
$pattern = '/[01]/';
|
||||||
$validate = function ($v) { return true; };
|
$validate = function ($v) { return true; };
|
||||||
}
|
}
|
||||||
else if ($conf['flags'] & CON_FLAG_TYPE_INT)
|
else if ($conf['flags'] & CON_FLAG_TYPE_INT)
|
||||||
$validate = function ($v) { return preg_match('/^-?\d+$/i', $v); };
|
$validate = function ($v) { return preg_match('/^-?\d+$/i', $v); };
|
||||||
else if ($conf['flags'] & CON_FLAG_TYPE_FLOAT)
|
else if ($conf['flags'] & CON_FLAG_TYPE_FLOAT)
|
||||||
$validate = function ($v) { return preg_match('/^-?\d*(,|.)?\d+$/i', $v); };
|
$validate = function ($v) { return preg_match('/^-?\d*(,|.)?\d+$/i', $v); };
|
||||||
else // string
|
else // string
|
||||||
$validate = function ($v) { return true; };
|
$validate = function ($v) { return true; };
|
||||||
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
$use = $value;
|
$use = $value;
|
||||||
if (CLISetup::readInput($use, $single))
|
if (CLISetup::readInput($use, $single))
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
|
|
||||||
if (!$validate($use ? $use['idx'] : ''))
|
if (!$validate($use ? $use['idx'] : ''))
|
||||||
{
|
{
|
||||||
CLISetup::log("value not in range", CLISetup::LOG_ERROR);
|
CLISetup::log("value not in range", CLISetup::LOG_ERROR);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DB::Aowow()->query('UPDATE ?_config SET `value` = ? WHERE `key` = ?', $use['idx'], strtolower($conf['key']));
|
DB::Aowow()->query('UPDATE ?_config SET `value` = ? WHERE `key` = ?', $use['idx'], strtolower($conf['key']));
|
||||||
CLISetup::log("setting updated", CLISetup::LOG_OK);
|
CLISetup::log("setting updated", CLISetup::LOG_OK);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
break 3;
|
break 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLISetup::log("edit canceled! returning to selection...", CLISetup::LOG_INFO);
|
CLISetup::log("edit canceled! returning to selection...", CLISetup::LOG_INFO);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break 2;
|
break 2;
|
||||||
case 'R': // restore default
|
case 'R': // restore default
|
||||||
if (!strstr($info[0], 'default:'))
|
if (!strstr($info[0], 'default:'))
|
||||||
continue 2;
|
continue 2;
|
||||||
|
|
||||||
// @eval .. some dafault values are supplied as bitmask or the likes
|
// @eval .. some dafault values are supplied as bitmask or the likes
|
||||||
if (DB::Aowow()->query('UPDATE ?_config SET `value` = ? WHERE `key` = ?', @eval('return ('.trim(explode('default:', $info[0])[1]).');'), strtolower($conf['key'])))
|
if (DB::Aowow()->query('UPDATE ?_config SET `value` = ? WHERE `key` = ?', @eval('return ('.trim(explode('default:', $info[0])[1]).');'), strtolower($conf['key'])))
|
||||||
{
|
{
|
||||||
CLISetup::log("default value restored", CLISetup::LOG_OK);
|
CLISetup::log("default value restored", CLISetup::LOG_OK);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
break 2;
|
break 2;
|
||||||
case 'D': // delete config pair
|
case 'D': // delete config pair
|
||||||
if ($conf['flags'] & CON_FLAG_PERSISTENT)
|
if ($conf['flags'] & CON_FLAG_PERSISTENT)
|
||||||
continue 2;
|
continue 2;
|
||||||
|
|
||||||
if (DB::Aowow()->query('DELETE FROM ?_config WHERE `key` = ? AND (`flags` & ?d) = 0', strtolower($conf['key']), CON_FLAG_PERSISTENT))
|
if (DB::Aowow()->query('DELETE FROM ?_config WHERE `key` = ? AND (`flags` & ?d) = 0', strtolower($conf['key']), CON_FLAG_PERSISTENT))
|
||||||
{
|
{
|
||||||
CLISetup::log("php setting deleted ['".$conf['key']."': '".$conf['value']."']", CLISetup::LOG_OK);
|
CLISetup::log("php setting deleted ['".$conf['key']."': '".$conf['value']."']", CLISetup::LOG_OK);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
break 2;
|
break 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
CLISetup::log("edit canceled! returning to list...", CLISetup::LOG_INFO);
|
CLISetup::log("edit canceled! returning to list...", CLISetup::LOG_INFO);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
CLISetup::log("invalid selection", CLISetup::LOG_ERROR);
|
CLISetup::log("invalid selection", CLISetup::LOG_ERROR);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
CLISetup::log("site configuration aborted", CLISetup::LOG_INFO);
|
CLISetup::log("site configuration aborted", CLISetup::LOG_INFO);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,56 +1,56 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('invalid access');
|
die('invalid access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/************************************************/
|
/************************************************/
|
||||||
/* Create content from world tables / dbc files */
|
/* Create content from world tables / dbc files */
|
||||||
/************************************************/
|
/************************************************/
|
||||||
|
|
||||||
function sql($syncMe = null)
|
function sql($syncMe = null)
|
||||||
{
|
{
|
||||||
require_once 'setup/tools/sqlGen.class.php';
|
require_once 'setup/tools/sqlGen.class.php';
|
||||||
|
|
||||||
SqlGen::init($syncMe !== null ? SqlGen::MODE_UPDATE : SqlGen::MODE_NORMAL, $syncMe ?: []);
|
SqlGen::init($syncMe !== null ? SqlGen::MODE_UPDATE : SqlGen::MODE_NORMAL, $syncMe ?: []);
|
||||||
|
|
||||||
$done = [];
|
$done = [];
|
||||||
if (SqlGen::$subScripts)
|
if (SqlGen::$subScripts)
|
||||||
{
|
{
|
||||||
$allOk = true;
|
$allOk = true;
|
||||||
|
|
||||||
// start file generation
|
// start file generation
|
||||||
CLISetup::log('begin generation of '. implode(', ', SqlGen::$subScripts));
|
CLISetup::log('begin generation of '. implode(', ', SqlGen::$subScripts));
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
|
|
||||||
foreach (SqlGen::$subScripts as $tbl)
|
foreach (SqlGen::$subScripts as $tbl)
|
||||||
{
|
{
|
||||||
$syncIds = []; // todo: fetch what exactly must be regenerated
|
$syncIds = []; // todo: fetch what exactly must be regenerated
|
||||||
|
|
||||||
$ok = SqlGen::generate($tbl, $syncIds);
|
$ok = SqlGen::generate($tbl, $syncIds);
|
||||||
if (!$ok)
|
if (!$ok)
|
||||||
$allOk = false;
|
$allOk = false;
|
||||||
else
|
else
|
||||||
$done[] = $tbl;
|
$done[] = $tbl;
|
||||||
|
|
||||||
CLISetup::log(' - subscript \''.$tbl.'\' returned '.($ok ? 'sucessfully' : 'with errors'), $ok ? CLISetup::LOG_OK : CLISetup::LOG_ERROR);
|
CLISetup::log(' - subscript \''.$tbl.'\' returned '.($ok ? 'sucessfully' : 'with errors'), $ok ? CLISetup::LOG_OK : CLISetup::LOG_ERROR);
|
||||||
set_time_limit(SqlGen::$defaultExecTime); // reset to default for the next script
|
set_time_limit(SqlGen::$defaultExecTime); // reset to default for the next script
|
||||||
}
|
}
|
||||||
|
|
||||||
// end
|
// end
|
||||||
CLISetup::log();
|
CLISetup::log();
|
||||||
if ($allOk)
|
if ($allOk)
|
||||||
CLISetup::log('successfully finished sql generation', CLISetup::LOG_OK);
|
CLISetup::log('successfully finished sql generation', CLISetup::LOG_OK);
|
||||||
else
|
else
|
||||||
CLISetup::log('finished sql generation with errors', CLISetup::LOG_ERROR);
|
CLISetup::log('finished sql generation with errors', CLISetup::LOG_ERROR);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CLISetup::log('no valid script names supplied', CLISetup::LOG_ERROR);
|
CLISetup::log('no valid script names supplied', CLISetup::LOG_ERROR);
|
||||||
|
|
||||||
return $done;
|
return $done;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,76 +1,76 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('invalid access');
|
die('invalid access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/*********************************/
|
/*********************************/
|
||||||
/* automaticly apply sql-updates */
|
/* automaticly apply sql-updates */
|
||||||
/*********************************/
|
/*********************************/
|
||||||
|
|
||||||
function update()
|
function update()
|
||||||
{
|
{
|
||||||
list($date, $part) = array_values(DB::Aowow()->selectRow('SELECT `date`, `part` FROM ?_dbversion'));
|
list($date, $part) = array_values(DB::Aowow()->selectRow('SELECT `date`, `part` FROM ?_dbversion'));
|
||||||
|
|
||||||
CLISetup::log('checking sql updates');
|
CLISetup::log('checking sql updates');
|
||||||
|
|
||||||
$nFiles = 0;
|
$nFiles = 0;
|
||||||
foreach (glob('setup/updates/*.sql') as $file)
|
foreach (glob('setup/updates/*.sql') as $file)
|
||||||
{
|
{
|
||||||
$pi = pathinfo($file);
|
$pi = pathinfo($file);
|
||||||
list($fDate, $fPart) = explode('_', $pi['filename']);
|
list($fDate, $fPart) = explode('_', $pi['filename']);
|
||||||
|
|
||||||
if ($date && $fDate < $date)
|
if ($date && $fDate < $date)
|
||||||
continue;
|
continue;
|
||||||
else if ($part && $date && $fDate == $date && $fPart <= $part)
|
else if ($part && $date && $fDate == $date && $fPart <= $part)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$nFiles++;
|
$nFiles++;
|
||||||
|
|
||||||
$updQuery = '';
|
$updQuery = '';
|
||||||
$nQuerys = 0;
|
$nQuerys = 0;
|
||||||
foreach (file($file) as $line)
|
foreach (file($file) as $line)
|
||||||
{
|
{
|
||||||
// skip comments
|
// skip comments
|
||||||
if (substr($line, 0, 2) == '--' || $line == '')
|
if (substr($line, 0, 2) == '--' || $line == '')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$updQuery .= $line;
|
$updQuery .= $line;
|
||||||
|
|
||||||
// semicolon at the end -> end of query
|
// semicolon at the end -> end of query
|
||||||
if (substr(trim($line), -1, 1) == ';')
|
if (substr(trim($line), -1, 1) == ';')
|
||||||
{
|
{
|
||||||
if (DB::Aowow()->query($updQuery))
|
if (DB::Aowow()->query($updQuery))
|
||||||
$nQuerys++;
|
$nQuerys++;
|
||||||
|
|
||||||
$updQuery = '';
|
$updQuery = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::Aowow()->query('UPDATE ?_dbversion SET `date`= ?d, `part` = ?d', $fDate, $fPart);
|
DB::Aowow()->query('UPDATE ?_dbversion SET `date`= ?d, `part` = ?d', $fDate, $fPart);
|
||||||
CLISetup::log(' -> '.date('d.m.Y', $fDate).' #'.$fPart.': '.$nQuerys.' queries applied', CLISetup::LOG_OK);
|
CLISetup::log(' -> '.date('d.m.Y', $fDate).' #'.$fPart.': '.$nQuerys.' queries applied', CLISetup::LOG_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLISetup::log($nFiles ? 'applied '.$nFiles.' update(s)' : 'db is already up to date', CLISetup::LOG_OK);
|
CLISetup::log($nFiles ? 'applied '.$nFiles.' update(s)' : 'db is already up to date', CLISetup::LOG_OK);
|
||||||
|
|
||||||
// fetch sql/build after applying updates, as they may contain sync-prompts
|
// fetch sql/build after applying updates, as they may contain sync-prompts
|
||||||
list($sql, $build) = array_values(DB::Aowow()->selectRow('SELECT `sql`, `build` FROM ?_dbversion'));
|
list($sql, $build) = array_values(DB::Aowow()->selectRow('SELECT `sql`, `build` FROM ?_dbversion'));
|
||||||
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
$sql = trim($sql) ? array_unique(explode(' ', trim($sql))) : [];
|
$sql = trim($sql) ? array_unique(explode(' ', trim($sql))) : [];
|
||||||
$build = trim($build) ? array_unique(explode(' ', trim($build))) : [];
|
$build = trim($build) ? array_unique(explode(' ', trim($build))) : [];
|
||||||
|
|
||||||
if ($sql)
|
if ($sql)
|
||||||
CLISetup::log('The following table(s) require syncing: '.implode(', ', $sql));
|
CLISetup::log('The following table(s) require syncing: '.implode(', ', $sql));
|
||||||
|
|
||||||
if ($build)
|
if ($build)
|
||||||
CLISetup::log('The following file(s) require syncing: '.implode(', ', $build));
|
CLISetup::log('The following file(s) require syncing: '.implode(', ', $build));
|
||||||
|
|
||||||
return [$sql, $build];
|
return [$sql, $build];
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -271,4 +271,4 @@ class FileGen
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
// Create 'item-scaling'-file in datasets;
|
// Create 'item-scaling'-file in datasets;
|
||||||
$reqDBC = ['scalingstatdistribution', 'scalingstatvalues', 'gtoctclasscombatratingscalar', 'gtcombatratings'];
|
$reqDBC = ['scalingstatdistribution', 'scalingstatvalues', 'gtoctclasscombatratingscalar', 'gtcombatratings'];
|
||||||
|
|
||||||
function debugify($data)
|
function debugify($data)
|
||||||
{
|
{
|
||||||
$buff = [];
|
$buff = [];
|
||||||
foreach ($data as $id => $row)
|
foreach ($data as $id => $row)
|
||||||
{
|
{
|
||||||
foreach ($row as &$r)
|
foreach ($row as &$r)
|
||||||
$r = str_pad($r, 5, " ", STR_PAD_LEFT);
|
$r = str_pad($r, 5, " ", STR_PAD_LEFT);
|
||||||
|
|
||||||
$buff[] = str_pad($id, 7, " ", STR_PAD_LEFT).": [".implode(', ', $row)."]";
|
$buff[] = str_pad($id, 7, " ", STR_PAD_LEFT).": [".implode(', ', $row)."]";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "{\r\n".implode(",\r\n", $buff)."\r\n}";
|
return "{\r\n".implode(",\r\n", $buff)."\r\n}";
|
||||||
}
|
}
|
||||||
|
|
||||||
function itemScalingRB()
|
function itemScalingRB()
|
||||||
{
|
{
|
||||||
$ratings = array(
|
$ratings = array(
|
||||||
12 => 1, // ITEM_MOD_DEFENSE_SKILL_RATING => CR_DEFENSE_SKILL
|
12 => 1, // ITEM_MOD_DEFENSE_SKILL_RATING => CR_DEFENSE_SKILL
|
||||||
13 => 2, // ITEM_MOD_DODGE_RATING => CR_DODGE
|
13 => 2, // ITEM_MOD_DODGE_RATING => CR_DODGE
|
||||||
14 => 3, // ITEM_MOD_PARRY_RATING => CR_PARRY
|
14 => 3, // ITEM_MOD_PARRY_RATING => CR_PARRY
|
||||||
15 => 4, // ITEM_MOD_BLOCK_RATING => CR_BLOCK
|
15 => 4, // ITEM_MOD_BLOCK_RATING => CR_BLOCK
|
||||||
@@ -35,7 +35,7 @@ if (!CLI)
|
|||||||
17 => 6, // ITEM_MOD_HIT_RANGED_RATING => CR_HIT_RANGED
|
17 => 6, // ITEM_MOD_HIT_RANGED_RATING => CR_HIT_RANGED
|
||||||
18 => 7, // ITEM_MOD_HIT_SPELL_RATING => CR_HIT_SPELL
|
18 => 7, // ITEM_MOD_HIT_SPELL_RATING => CR_HIT_SPELL
|
||||||
19 => 8, // ITEM_MOD_CRIT_MELEE_RATING => CR_CRIT_MELEE
|
19 => 8, // ITEM_MOD_CRIT_MELEE_RATING => CR_CRIT_MELEE
|
||||||
20 => 9, // ITEM_MOD_CRIT_RANGED_RATING => CR_CRIT_RANGED
|
20 => 9, // ITEM_MOD_CRIT_RANGED_RATING => CR_CRIT_RANGED
|
||||||
21 => 10, // ITEM_MOD_CRIT_SPELL_RATING => CR_CRIT_SPELL
|
21 => 10, // ITEM_MOD_CRIT_SPELL_RATING => CR_CRIT_SPELL
|
||||||
22 => 11, // ITEM_MOD_HIT_TAKEN_MELEE_RATING => CR_HIT_TAKEN_MELEE
|
22 => 11, // ITEM_MOD_HIT_TAKEN_MELEE_RATING => CR_HIT_TAKEN_MELEE
|
||||||
23 => 12, // ITEM_MOD_HIT_TAKEN_RANGED_RATING => CR_HIT_TAKEN_RANGED
|
23 => 12, // ITEM_MOD_HIT_TAKEN_RANGED_RATING => CR_HIT_TAKEN_RANGED
|
||||||
@@ -45,71 +45,71 @@ if (!CLI)
|
|||||||
27 => 16, // ITEM_MOD_CRIT_TAKEN_SPELL_RATING => CR_CRIT_TAKEN_SPELL [may be forced 0]
|
27 => 16, // ITEM_MOD_CRIT_TAKEN_SPELL_RATING => CR_CRIT_TAKEN_SPELL [may be forced 0]
|
||||||
28 => 17, // ITEM_MOD_HASTE_MELEE_RATING => CR_HASTE_MELEE
|
28 => 17, // ITEM_MOD_HASTE_MELEE_RATING => CR_HASTE_MELEE
|
||||||
29 => 18, // ITEM_MOD_HASTE_RANGED_RATING => CR_HASTE_RANGED
|
29 => 18, // ITEM_MOD_HASTE_RANGED_RATING => CR_HASTE_RANGED
|
||||||
30 => 19, // ITEM_MOD_HASTE_SPELL_RATING => CR_HASTE_SPELL
|
30 => 19, // ITEM_MOD_HASTE_SPELL_RATING => CR_HASTE_SPELL
|
||||||
31 => 5, // ITEM_MOD_HIT_RATING => [backRef]
|
31 => 5, // ITEM_MOD_HIT_RATING => [backRef]
|
||||||
32 => 8, // ITEM_MOD_CRIT_RATING => [backRef]
|
32 => 8, // ITEM_MOD_CRIT_RATING => [backRef]
|
||||||
33 => 11, // ITEM_MOD_HIT_TAKEN_RATING => [backRef] [may be forced 0]
|
33 => 11, // ITEM_MOD_HIT_TAKEN_RATING => [backRef] [may be forced 0]
|
||||||
34 => 14, // ITEM_MOD_CRIT_TAKEN_RATING => [backRef] [may be forced 0]
|
34 => 14, // ITEM_MOD_CRIT_TAKEN_RATING => [backRef] [may be forced 0]
|
||||||
35 => 14, // ITEM_MOD_RESILIENCE_RATING => [backRef]
|
35 => 14, // ITEM_MOD_RESILIENCE_RATING => [backRef]
|
||||||
36 => 17, // ITEM_MOD_HASTE_RATING => [backRef]
|
36 => 17, // ITEM_MOD_HASTE_RATING => [backRef]
|
||||||
37 => 23, // ITEM_MOD_EXPERTISE_RATING => CR_EXPERTISE
|
37 => 23, // ITEM_MOD_EXPERTISE_RATING => CR_EXPERTISE
|
||||||
44 => 24 // ITEM_MOD_ARMOR_PENETRATION_RATING => CR_ARMOR_PENETRATION
|
44 => 24 // ITEM_MOD_ARMOR_PENETRATION_RATING => CR_ARMOR_PENETRATION
|
||||||
);
|
);
|
||||||
|
|
||||||
$data = $ratings;
|
$data = $ratings;
|
||||||
|
|
||||||
$offsets = array_map(function ($v) { // LookupEntry(cr*GT_MAX_LEVEL+level-1)
|
$offsets = array_map(function ($v) { // LookupEntry(cr*GT_MAX_LEVEL+level-1)
|
||||||
return $v * 100 + 60 - 1;
|
return $v * 100 + 60 - 1;
|
||||||
}, $ratings);
|
}, $ratings);
|
||||||
$base = DB::Aowow()->selectCol('SELECT CAST((idx + 1 - 60) / 100 AS UNSIGNED) AS ARRAY_KEY, ratio FROM dbc_gtcombatratings WHERE idx IN (?a)', $offsets);
|
$base = DB::Aowow()->selectCol('SELECT CAST((idx + 1 - 60) / 100 AS UNSIGNED) AS ARRAY_KEY, ratio FROM dbc_gtcombatratings WHERE idx IN (?a)', $offsets);
|
||||||
|
|
||||||
$offsets = array_map(function ($v) { // LookupEntry((getClass()-1)*GT_MAX_RATING+cr+1)
|
$offsets = array_map(function ($v) { // LookupEntry((getClass()-1)*GT_MAX_RATING+cr+1)
|
||||||
return (CLASS_WARRIOR - 1) * 32 + $v + 1;
|
return (CLASS_WARRIOR - 1) * 32 + $v + 1;
|
||||||
}, $ratings);
|
}, $ratings);
|
||||||
$mods = DB::Aowow()->selectCol('SELECT idx - 1 AS ARRAY_KEY, ratio FROM dbc_gtoctclasscombatratingscalar WHERE idx IN (?a)', $offsets);
|
$mods = DB::Aowow()->selectCol('SELECT idx - 1 AS ARRAY_KEY, ratio FROM dbc_gtoctclasscombatratingscalar WHERE idx IN (?a)', $offsets);
|
||||||
|
|
||||||
foreach ($data as $itemMod => &$val)
|
foreach ($data as $itemMod => &$val)
|
||||||
$val = CFG_DEBUG ? $base[$val].' / '.$mods[$val] : $base[$val] / $mods[$val];
|
$val = CFG_DEBUG ? $base[$val].' / '.$mods[$val] : $base[$val] / $mods[$val];
|
||||||
|
|
||||||
if (!CFG_DEBUG)
|
if (!CFG_DEBUG)
|
||||||
return Util::toJSON($data);
|
return Util::toJSON($data);
|
||||||
|
|
||||||
$buff = [];
|
$buff = [];
|
||||||
foreach ($data as $k => $v)
|
foreach ($data as $k => $v)
|
||||||
$buff[] = $k.': '.$v;
|
$buff[] = $k.': '.$v;
|
||||||
|
|
||||||
return "{\r\n ".implode(",\r\n ", $buff)."\r\n}";
|
return "{\r\n ".implode(",\r\n ", $buff)."\r\n}";
|
||||||
}
|
}
|
||||||
|
|
||||||
function itemScalingSV()
|
function itemScalingSV()
|
||||||
{
|
{
|
||||||
/* so the javascript expects a slightly different structure, than the dbc provides .. f*** it
|
/* so the javascript expects a slightly different structure, than the dbc provides .. f*** it
|
||||||
e.g.
|
e.g.
|
||||||
dbc - 80: 97 97 56 41 210 395 878 570 120 156 86 112 108 220 343 131 73 140 280 527 1171 2093
|
dbc - 80: 97 97 56 41 210 395 878 570 120 156 86 112 108 220 343 131 73 140 280 527 1171 2093
|
||||||
expected - 80: 97 97 56 131 41 210 395 878 1570 120 156 86 112 108 220 343 0 0 73 140 280 527 1171 2093
|
expected - 80: 97 97 56 131 41 210 395 878 1570 120 156 86 112 108 220 343 0 0 73 140 280 527 1171 2093
|
||||||
*/
|
*/
|
||||||
$fields = Util::$ssdMaskFields;
|
$fields = Util::$ssdMaskFields;
|
||||||
array_walk($fields, function(&$v, $k) {
|
array_walk($fields, function(&$v, $k) {
|
||||||
$v = $v ?: '0 AS idx'.$k; // NULL => 0 (plus some index so we can have 2x 0)
|
$v = $v ?: '0 AS idx'.$k; // NULL => 0 (plus some index so we can have 2x 0)
|
||||||
});
|
});
|
||||||
|
|
||||||
$data = DB::Aowow()->select('SELECT Id AS ARRAY_KEY, '.implode(', ', $fields).' FROM dbc_scalingstatvalues');
|
$data = DB::Aowow()->select('SELECT Id AS ARRAY_KEY, '.implode(', ', $fields).' FROM dbc_scalingstatvalues');
|
||||||
foreach ($data as &$d)
|
foreach ($data as &$d)
|
||||||
$d = array_values($d); // strip indizes
|
$d = array_values($d); // strip indizes
|
||||||
|
|
||||||
return CFG_DEBUG ? debugify($data) : Util::toJSON($data);
|
return CFG_DEBUG ? debugify($data) : Util::toJSON($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function itemScalingSD()
|
function itemScalingSD()
|
||||||
{
|
{
|
||||||
$data = DB::Aowow()->select('SELECT *, Id AS ARRAY_KEY FROM dbc_scalingstatdistribution');
|
$data = DB::Aowow()->select('SELECT *, Id AS ARRAY_KEY FROM dbc_scalingstatdistribution');
|
||||||
foreach ($data as &$row)
|
foreach ($data as &$row)
|
||||||
{
|
{
|
||||||
$row = array_values($row);
|
$row = array_values($row);
|
||||||
array_splice($row, 0, 1);
|
array_splice($row, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CFG_DEBUG ? debugify($data) : Util::toJSON($data);
|
return CFG_DEBUG ? debugify($data) : Util::toJSON($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,41 +1,41 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
// Creates 'weight-presets'-file
|
// Creates 'weight-presets'-file
|
||||||
|
|
||||||
function weightPresets()
|
function weightPresets()
|
||||||
{
|
{
|
||||||
// check directory-structure
|
// check directory-structure
|
||||||
if (!CLISetup::writeDir('datasets/'))
|
if (!CLISetup::writeDir('datasets/'))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$wtPresets = [];
|
$wtPresets = [];
|
||||||
$scales = DB::Aowow()->select('SELECT id, name, icon, class FROM ?_account_weightscales WHERE userId = 0 ORDER BY class, id ASC');
|
$scales = DB::Aowow()->select('SELECT id, name, icon, class FROM ?_account_weightscales WHERE userId = 0 ORDER BY class, id ASC');
|
||||||
|
|
||||||
foreach ($scales as $s)
|
foreach ($scales as $s)
|
||||||
{
|
{
|
||||||
$weights = DB::Aowow()->selectCol('SELECT field AS ARRAY_KEY, val FROM ?_account_weightscale_data WHERE id = ?d', $s['id']);
|
$weights = DB::Aowow()->selectCol('SELECT field AS ARRAY_KEY, val FROM ?_account_weightscale_data WHERE id = ?d', $s['id']);
|
||||||
if (!$weights)
|
if (!$weights)
|
||||||
{
|
{
|
||||||
CLISetup::log('WeightScale \''.CLISetup::bold($s['name']).'\' has no data set. Skipping...', CLISetup::LOG_WARN);
|
CLISetup::log('WeightScale \''.CLISetup::bold($s['name']).'\' has no data set. Skipping...', CLISetup::LOG_WARN);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$wtPresets[$s['class']]['pve'][$s['name']] = array_merge(['__icon' => $s['icon']], $weights);
|
$wtPresets[$s['class']]['pve'][$s['name']] = array_merge(['__icon' => $s['icon']], $weights);
|
||||||
}
|
}
|
||||||
|
|
||||||
$toFile = "var wt_presets = ".Util::toJSON($wtPresets).";";
|
$toFile = "var wt_presets = ".Util::toJSON($wtPresets).";";
|
||||||
$file = 'datasets/weight-presets';
|
$file = 'datasets/weight-presets';
|
||||||
|
|
||||||
if (!CLISetup::writeFile($file, $toFile))
|
if (!CLISetup::writeFile($file, $toFile))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,208 +1,208 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/* provide these with basic content
|
/* provide these with basic content
|
||||||
aowow_announcements
|
aowow_announcements
|
||||||
aowow_articles
|
aowow_articles
|
||||||
aowow_config
|
aowow_config
|
||||||
aowow_home_featuredbox
|
aowow_home_featuredbox
|
||||||
aowow_home_featuredbox_overlay
|
aowow_home_featuredbox_overlay
|
||||||
aowow_home_oneliners
|
aowow_home_oneliners
|
||||||
aowow_home_titles
|
aowow_home_titles
|
||||||
aowow_sourcestrings
|
aowow_sourcestrings
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
class SqlGen
|
class SqlGen
|
||||||
{
|
{
|
||||||
const MODE_NORMAL = 0;
|
const MODE_NORMAL = 0;
|
||||||
const MODE_FIRSTRUN = 1;
|
const MODE_FIRSTRUN = 1;
|
||||||
const MODE_UPDATE = 2;
|
const MODE_UPDATE = 2;
|
||||||
|
|
||||||
private static $tables = array( // [dbcName, saveDbc, AowowDeps, TCDeps]
|
private static $tables = array( // [dbcName, saveDbc, AowowDeps, TCDeps]
|
||||||
'achievementcategory' => ['achievement_category', false, null, null],
|
'achievementcategory' => ['achievement_category', false, null, null],
|
||||||
'achievementcriteria' => ['achievement_criteria', false, null, null],
|
'achievementcriteria' => ['achievement_criteria', false, null, null],
|
||||||
'glyphproperties' => ['glyphproperties', true, null, null],
|
'glyphproperties' => ['glyphproperties', true, null, null],
|
||||||
'itemenchantmentcondition' => ['spellitemenchantmentcondition', false, null, null],
|
'itemenchantmentcondition' => ['spellitemenchantmentcondition', false, null, null],
|
||||||
'itemextendedcost' => ['itemextendedcost', false, null, null],
|
'itemextendedcost' => ['itemextendedcost', false, null, null],
|
||||||
'itemlimitcategory' => ['itemlimitcategory', false, null, null],
|
'itemlimitcategory' => ['itemlimitcategory', false, null, null],
|
||||||
'itemrandomproppoints' => ['randproppoints', false, null, null],
|
'itemrandomproppoints' => ['randproppoints', false, null, null],
|
||||||
'lock' => ['lock', true, null, null],
|
'lock' => ['lock', true, null, null],
|
||||||
'mailtemplate' => ['mailtemplate', false, null, null],
|
'mailtemplate' => ['mailtemplate', false, null, null],
|
||||||
'scalingstatdistribution' => ['scalingstatdistribution', true, null, null],
|
'scalingstatdistribution' => ['scalingstatdistribution', true, null, null],
|
||||||
'scalingstatvalues' => ['scalingstatvalues', true, null, null],
|
'scalingstatvalues' => ['scalingstatvalues', true, null, null],
|
||||||
'spellfocusobject' => ['spellfocusobject', false, null, null],
|
'spellfocusobject' => ['spellfocusobject', false, null, null],
|
||||||
'spellrange' => ['spellrange', false, null, null],
|
'spellrange' => ['spellrange', false, null, null],
|
||||||
'spellvariables' => ['spelldescriptionvariables', false, null, null],
|
'spellvariables' => ['spelldescriptionvariables', false, null, null],
|
||||||
'totemcategory' => ['totemcategory', false, null, null],
|
'totemcategory' => ['totemcategory', false, null, null],
|
||||||
'talents' => [null, null, null, null],
|
'talents' => [null, null, null, null],
|
||||||
'classes' => [null, null, null, null],
|
'classes' => [null, null, null, null],
|
||||||
'factions' => [null, null, null, null],
|
'factions' => [null, null, null, null],
|
||||||
'factiontemplate' => [null, null, null, null],
|
'factiontemplate' => [null, null, null, null],
|
||||||
'holidays' => [null, null, null, null],
|
'holidays' => [null, null, null, null],
|
||||||
'icons' => [null, null, null, null],
|
'icons' => [null, null, null, null],
|
||||||
'itemrandomenchant' => [null, null, null, null],
|
'itemrandomenchant' => [null, null, null, null],
|
||||||
'races' => [null, null, null, null],
|
'races' => [null, null, null, null],
|
||||||
'shapeshiftforms' => [null, null, null, null],
|
'shapeshiftforms' => [null, null, null, null],
|
||||||
'skillline' => [null, null, null, null],
|
'skillline' => [null, null, null, null],
|
||||||
'emotes' => [null, null, null, null],
|
'emotes' => [null, null, null, null],
|
||||||
'itemenchantment' => [null, null, null, ['spell_enchant_proc_data']],
|
'itemenchantment' => [null, null, null, ['spell_enchant_proc_data']],
|
||||||
'achievement' => [null, null, null, ['dbc_achievement']],
|
'achievement' => [null, null, null, ['dbc_achievement']],
|
||||||
'creature' => [null, null, null, ['creature_template', 'creature_template_locale', 'creature_classlevelstats', 'instance_encounters']],
|
'creature' => [null, null, null, ['creature_template', 'creature_template_locale', 'creature_classlevelstats', 'instance_encounters']],
|
||||||
'currencies' => [null, null, null, ['item_template', 'locales_item']],
|
'currencies' => [null, null, null, ['item_template', 'locales_item']],
|
||||||
'events' => [null, null, null, ['game_event', 'game_event_prerequisite']],
|
'events' => [null, null, null, ['game_event', 'game_event_prerequisite']],
|
||||||
'objects' => [null, null, null, ['gameobject_template', 'gameobject_template_locale', 'gameobject_questitem']],
|
'objects' => [null, null, null, ['gameobject_template', 'gameobject_template_locale', 'gameobject_questitem']],
|
||||||
'pet' => [null, null, null, ['creature_template', 'creature']],
|
'pet' => [null, null, null, ['creature_template', 'creature']],
|
||||||
'quests' => [null, null, null, ['quest_template', 'quest_template_addon', 'locales_quest', 'game_event', 'game_event_seasonal_questrelation']],
|
'quests' => [null, null, null, ['quest_template', 'quest_template_addon', 'locales_quest', 'game_event', 'game_event_seasonal_questrelation']],
|
||||||
'quests_startend' => [null, null, null, ['creature_queststarter', 'creature_questender', 'game_event_creature_quest', 'gameobject_queststarter', 'gameobject_questender', 'game_event_gameobject_quest', 'item_template']],
|
'quests_startend' => [null, null, null, ['creature_queststarter', 'creature_questender', 'game_event_creature_quest', 'gameobject_queststarter', 'gameobject_questender', 'game_event_gameobject_quest', 'item_template']],
|
||||||
'spell' => [null, null, null, ['skill_discovery_template', 'item_template', 'creature_template', 'creature_template_addon', 'smart_scripts', 'npc_trainer', 'disables', 'spell_ranks', 'spell_dbc']],
|
'spell' => [null, null, null, ['skill_discovery_template', 'item_template', 'creature_template', 'creature_template_addon', 'smart_scripts', 'npc_trainer', 'disables', 'spell_ranks', 'spell_dbc']],
|
||||||
'spelldifficulty' => [null, null, null, ['spelldifficulty_dbc']],
|
'spelldifficulty' => [null, null, null, ['spelldifficulty_dbc']],
|
||||||
'taxi' /* nodes + paths */ => [null, null, null, ['creature_template', 'creature']],
|
'taxi' /* nodes + paths */ => [null, null, null, ['creature_template', 'creature']],
|
||||||
'titles' => [null, null, null, ['quest_template', 'game_event_seasonal_questrelation', 'game_event', 'achievement_reward']],
|
'titles' => [null, null, null, ['quest_template', 'game_event_seasonal_questrelation', 'game_event', 'achievement_reward']],
|
||||||
'items' => [null, null, null, ['item_template', 'locales_item', 'spell_group', 'game_event']],
|
'items' => [null, null, null, ['item_template', 'locales_item', 'spell_group', 'game_event']],
|
||||||
'spawns' /* + waypoints */ => [null, null, null, ['creature', 'creature_addon', 'gameobject', 'gameobject_template', 'vehicle_accessory', 'vehicle_accessory_template', 'script_waypoint', 'waypoints', 'waypoint_data']],
|
'spawns' /* + waypoints */ => [null, null, null, ['creature', 'creature_addon', 'gameobject', 'gameobject_template', 'vehicle_accessory', 'vehicle_accessory_template', 'script_waypoint', 'waypoints', 'waypoint_data']],
|
||||||
'zones' => [null, null, null, ['access_requirement']],
|
'zones' => [null, null, null, ['access_requirement']],
|
||||||
'itemset' => [null, null, ['spell'], ['item_template', 'game_event']],
|
'itemset' => [null, null, ['spell'], ['item_template', 'game_event']],
|
||||||
'item_stats' /* + ench */ => [null, null, ['items', 'spell'], null],
|
'item_stats' /* + ench */ => [null, null, ['items', 'spell'], null],
|
||||||
'source' => [null, null, ['spell', 'achievement'], ['npc_vendor', 'game_event_npc_vendor', 'creature', 'quest_template', 'quest_template_addon', 'playercreateinfo_item', 'npc_trainer', 'skill_discovery_template', 'playercreateinfo_skills', 'achievement_reward', 'skill_perfect_item_template']]
|
'source' => [null, null, ['spell', 'achievement'], ['npc_vendor', 'game_event_npc_vendor', 'creature', 'quest_template', 'quest_template_addon', 'playercreateinfo_item', 'npc_trainer', 'skill_discovery_template', 'playercreateinfo_skills', 'achievement_reward', 'skill_perfect_item_template']]
|
||||||
);
|
);
|
||||||
|
|
||||||
public static $cliOpts = [];
|
public static $cliOpts = [];
|
||||||
private static $shortOpts = 'h';
|
private static $shortOpts = 'h';
|
||||||
private static $longOpts = ['sql::', 'help', 'sync:']; // general
|
private static $longOpts = ['sql::', 'help', 'sync:']; // general
|
||||||
|
|
||||||
public static $subScripts = [];
|
public static $subScripts = [];
|
||||||
|
|
||||||
public static $defaultExecTime = 30;
|
public static $defaultExecTime = 30;
|
||||||
public static $stepSize = 1000;
|
public static $stepSize = 1000;
|
||||||
|
|
||||||
public static function init($mode = self::MODE_NORMAL, array $updScripts = [])
|
public static function init($mode = self::MODE_NORMAL, array $updScripts = [])
|
||||||
{
|
{
|
||||||
self::$defaultExecTime = ini_get('max_execution_time');
|
self::$defaultExecTime = ini_get('max_execution_time');
|
||||||
$doScripts = null;
|
$doScripts = null;
|
||||||
|
|
||||||
if (getopt(self::$shortOpts, self::$longOpts) || $mode == self::MODE_FIRSTRUN)
|
if (getopt(self::$shortOpts, self::$longOpts) || $mode == self::MODE_FIRSTRUN)
|
||||||
self::handleCLIOpts($doScripts);
|
self::handleCLIOpts($doScripts);
|
||||||
else if ($mode != self::MODE_UPDATE)
|
else if ($mode != self::MODE_UPDATE)
|
||||||
{
|
{
|
||||||
self::printCLIHelp();
|
self::printCLIHelp();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check passed subscript names; limit to real scriptNames
|
// check passed subscript names; limit to real scriptNames
|
||||||
self::$subScripts = array_keys(self::$tables);
|
self::$subScripts = array_keys(self::$tables);
|
||||||
if ($doScripts || $updScripts)
|
if ($doScripts || $updScripts)
|
||||||
self::$subScripts = array_intersect($doScripts ?: $updScripts, self::$subScripts);
|
self::$subScripts = array_intersect($doScripts ?: $updScripts, self::$subScripts);
|
||||||
else if ($doScripts === null)
|
else if ($doScripts === null)
|
||||||
self::$subScripts = [];
|
self::$subScripts = [];
|
||||||
|
|
||||||
if (!CLISetup::$localeIds /* && this script has localized text */)
|
if (!CLISetup::$localeIds /* && this script has localized text */)
|
||||||
{
|
{
|
||||||
CLISetup::log('No valid locale specified. Check your config or --locales parameter, if used', CLISetup::LOG_ERROR);
|
CLISetup::log('No valid locale specified. Check your config or --locales parameter, if used', CLISetup::LOG_ERROR);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function handleCLIOpts(&$doTbls)
|
private static function handleCLIOpts(&$doTbls)
|
||||||
{
|
{
|
||||||
$doTbls = [];
|
$doTbls = [];
|
||||||
$_ = getopt(self::$shortOpts, self::$longOpts);
|
$_ = getopt(self::$shortOpts, self::$longOpts);
|
||||||
|
|
||||||
if ((isset($_['help']) || isset($_['h'])) && empty($_['sql']))
|
if ((isset($_['help']) || isset($_['h'])) && empty($_['sql']))
|
||||||
{
|
{
|
||||||
self::printCLIHelp();
|
self::printCLIHelp();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// required subScripts
|
// required subScripts
|
||||||
if (!empty($_['sync']))
|
if (!empty($_['sync']))
|
||||||
{
|
{
|
||||||
$sync = explode(',', $_['sync']);
|
$sync = explode(',', $_['sync']);
|
||||||
foreach (self::$tables as $name => $info)
|
foreach (self::$tables as $name => $info)
|
||||||
if (!empty($info[3]) && array_intersect($sync, $info[3]))
|
if (!empty($info[3]) && array_intersect($sync, $info[3]))
|
||||||
$doTbls[] = $name;
|
$doTbls[] = $name;
|
||||||
|
|
||||||
// recursive dependencies
|
// recursive dependencies
|
||||||
foreach (self::$tables as $name => $info)
|
foreach (self::$tables as $name => $info)
|
||||||
if (!empty($info[2]) && array_intersect($doTbls, $info[2]))
|
if (!empty($info[2]) && array_intersect($doTbls, $info[2]))
|
||||||
$doTbls[] = $name;
|
$doTbls[] = $name;
|
||||||
|
|
||||||
$doTbls = $doTbls ? array_unique($doTbls) : null;
|
$doTbls = $doTbls ? array_unique($doTbls) : null;
|
||||||
}
|
}
|
||||||
else if (!empty($_['sql']))
|
else if (!empty($_['sql']))
|
||||||
$doTbls = explode(',', $_['sql']);
|
$doTbls = explode(',', $_['sql']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function printCLIHelp()
|
public static function printCLIHelp()
|
||||||
{
|
{
|
||||||
echo "\nusage: php aowow --sql=<tableList,> [-h --help]\n\n";
|
echo "\nusage: php aowow --sql=<tableList,> [-h --help]\n\n";
|
||||||
echo "--sql : available tables:\n";
|
echo "--sql : available tables:\n";
|
||||||
foreach (self::$tables as $t => $info)
|
foreach (self::$tables as $t => $info)
|
||||||
echo " * ".str_pad($t, 24).(isset($info[3]) ? ' - TC deps: '.implode(', ', $info[3]) : '').(isset($info[2]) ? ' - Aowow deps: '.implode(', ', $info[2]) : '')."\n";
|
echo " * ".str_pad($t, 24).(isset($info[3]) ? ' - TC deps: '.implode(', ', $info[3]) : '').(isset($info[2]) ? ' - Aowow deps: '.implode(', ', $info[2]) : '')."\n";
|
||||||
|
|
||||||
echo "-h --help : shows this info\n";
|
echo "-h --help : shows this info\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function generate($tableName, array $updateIds = [])
|
public static function generate($tableName, array $updateIds = [])
|
||||||
{
|
{
|
||||||
if (!isset(self::$tables[$tableName]))
|
if (!isset(self::$tables[$tableName]))
|
||||||
{
|
{
|
||||||
CLISetup::log('SqlGen::generate - invalid table given', CLISetup::LOG_ERROR);
|
CLISetup::log('SqlGen::generate - invalid table given', CLISetup::LOG_ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty(self::$tables[$tableName][0])) // straight copy from dbc source
|
if (!empty(self::$tables[$tableName][0])) // straight copy from dbc source
|
||||||
{
|
{
|
||||||
$tbl = self::$tables[$tableName]; // shorthand
|
$tbl = self::$tables[$tableName]; // shorthand
|
||||||
CLISetup::log('SqlGen::generate() - copying '.$tbl[0].'.dbc into aowow_'.$tableName);
|
CLISetup::log('SqlGen::generate() - copying '.$tbl[0].'.dbc into aowow_'.$tableName);
|
||||||
|
|
||||||
$dbc = new DBC($tbl[0], CLISetup::$tmpDBC);
|
$dbc = new DBC($tbl[0], CLISetup::$tmpDBC);
|
||||||
if ($dbc->error)
|
if ($dbc->error)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$dbcData = $dbc->readArbitrary($tbl[1]);
|
$dbcData = $dbc->readArbitrary($tbl[1]);
|
||||||
foreach ($dbcData as $row)
|
foreach ($dbcData as $row)
|
||||||
DB::Aowow()->query('REPLACE INTO ?_'.$tableName.' (?#) VALUES (?a)', array_keys($row), array_values($row));
|
DB::Aowow()->query('REPLACE INTO ?_'.$tableName.' (?#) VALUES (?a)', array_keys($row), array_values($row));
|
||||||
|
|
||||||
return !!$dbcData;
|
return !!$dbcData;
|
||||||
}
|
}
|
||||||
else if (file_exists('setup/tools/sqlgen/'.$tableName.'.func.php'))
|
else if (file_exists('setup/tools/sqlgen/'.$tableName.'.func.php'))
|
||||||
{
|
{
|
||||||
$customData = $reqDBC = [];
|
$customData = $reqDBC = [];
|
||||||
|
|
||||||
CLISetup::log('SqlGen::generate() - filling aowow_'.$tableName.' with data');
|
CLISetup::log('SqlGen::generate() - filling aowow_'.$tableName.' with data');
|
||||||
|
|
||||||
require_once 'setup/tools/sqlgen/'.$tableName.'.func.php';
|
require_once 'setup/tools/sqlgen/'.$tableName.'.func.php';
|
||||||
|
|
||||||
if (function_exists($tableName))
|
if (function_exists($tableName))
|
||||||
{
|
{
|
||||||
// check for required auxiliary DBC files
|
// check for required auxiliary DBC files
|
||||||
foreach ($reqDBC as $req)
|
foreach ($reqDBC as $req)
|
||||||
if (!CLISetup::loadDBC($req))
|
if (!CLISetup::loadDBC($req))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$success = $tableName($updateIds);
|
$success = $tableName($updateIds);
|
||||||
|
|
||||||
// apply post generator custom data
|
// apply post generator custom data
|
||||||
foreach ($customData as $id => $data)
|
foreach ($customData as $id => $data)
|
||||||
if ($data)
|
if ($data)
|
||||||
DB::Aowow()->query('UPDATE ?_'.$tableName.' SET ?a WHERE id = ?d', $data, $id);
|
DB::Aowow()->query('UPDATE ?_'.$tableName.' SET ?a WHERE id = ?d', $data, $id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CLISetup::log(' - subscript \''.$tableName.'\' not defined in included file', CLISetup::LOG_ERROR);
|
CLISetup::log(' - subscript \''.$tableName.'\' not defined in included file', CLISetup::LOG_ERROR);
|
||||||
|
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CLISetup::log(sprintf(ERR_MISSING_INCL, $tableName, 'setup/tools/sqlgen/'.$tableName.'.func.php'), CLISetup::LOG_ERROR);
|
CLISetup::log(sprintf(ERR_MISSING_INCL, $tableName, 'setup/tools/sqlgen/'.$tableName.'.func.php'), CLISetup::LOG_ERROR);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,66 +1,66 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/* deps:
|
/* deps:
|
||||||
* dbc_achievement
|
* dbc_achievement
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Higher Learning - item rewarded through gossip
|
// Higher Learning - item rewarded through gossip
|
||||||
$customData = array(
|
$customData = array(
|
||||||
1956 => ['itemExtra' => 44738]
|
1956 => ['itemExtra' => 44738]
|
||||||
);
|
);
|
||||||
$reqDBC = ['achievement_category', 'achievement'];
|
$reqDBC = ['achievement_category', 'achievement'];
|
||||||
|
|
||||||
function achievement(array $ids = [])
|
function achievement(array $ids = [])
|
||||||
{
|
{
|
||||||
if ($ids)
|
if ($ids)
|
||||||
DB::Aowow()->query('DELETE FROM ?_achievement WHERE id IN (?a)', $ids);
|
DB::Aowow()->query('DELETE FROM ?_achievement WHERE id IN (?a)', $ids);
|
||||||
else
|
else
|
||||||
DB::Aowow()->query('INSERT IGNORE INTO ?_achievement SELECT a.id, 2 - a.faction, a.map, 0, 0, a.category, ac.parentCategory, a.points, a.orderInGroup, a.iconId, a.flags, a.reqCriteriaCount, a.refAchievement, 0, 0, a.name_loc0, a.name_loc2, a.name_loc3, a.name_loc6, a.name_loc8, a.description_loc0, a.description_loc2, a.description_loc3, a.description_loc6, a.description_loc8, a.reward_loc0, a.reward_loc2, a.reward_loc3, a.reward_loc6, a.reward_loc8 FROM dbc_achievement a LEFT JOIN dbc_achievement_category ac ON ac.id = a.category');
|
DB::Aowow()->query('INSERT IGNORE INTO ?_achievement SELECT a.id, 2 - a.faction, a.map, 0, 0, a.category, ac.parentCategory, a.points, a.orderInGroup, a.iconId, a.flags, a.reqCriteriaCount, a.refAchievement, 0, 0, a.name_loc0, a.name_loc2, a.name_loc3, a.name_loc6, a.name_loc8, a.description_loc0, a.description_loc2, a.description_loc3, a.description_loc6, a.description_loc8, a.reward_loc0, a.reward_loc2, a.reward_loc3, a.reward_loc6, a.reward_loc8 FROM dbc_achievement a LEFT JOIN dbc_achievement_category ac ON ac.id = a.category');
|
||||||
|
|
||||||
// serverside achievements
|
// serverside achievements
|
||||||
$serverAchievements = DB::World()->select('SELECT ID, IF(requiredFaction = -1, 3, IF(requiredFaction = 0, 2, 1)) AS "faction", mapID, points, flags, count, refAchievement FROM achievement_dbc{ WHERE id IN (?a)}',
|
$serverAchievements = DB::World()->select('SELECT ID, IF(requiredFaction = -1, 3, IF(requiredFaction = 0, 2, 1)) AS "faction", mapID, points, flags, count, refAchievement FROM achievement_dbc{ WHERE id IN (?a)}',
|
||||||
$ids ?: DBSIMPLE_SKIP
|
$ids ?: DBSIMPLE_SKIP
|
||||||
);
|
);
|
||||||
foreach ($serverAchievements as $sa)
|
foreach ($serverAchievements as $sa)
|
||||||
DB::Aowow()->query('REPLACE INTO ?_achievement (id, faction, map, points, flags, reqCriteriaCount, refAchievement, cuFlags, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8) VALUES (?d, ?d, ?d, ?d, ?d, ?d, ?d, ?d, ?, ?, ?, ?, ?)',
|
DB::Aowow()->query('REPLACE INTO ?_achievement (id, faction, map, points, flags, reqCriteriaCount, refAchievement, cuFlags, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8) VALUES (?d, ?d, ?d, ?d, ?d, ?d, ?d, ?d, ?, ?, ?, ?, ?)',
|
||||||
$sa['ID'], $sa['faction'], $sa['mapID'], $sa['points'], $sa['flags'], $sa['count'], $sa['refAchievement'], CUSTOM_SERVERSIDE,
|
$sa['ID'], $sa['faction'], $sa['mapID'], $sa['points'], $sa['flags'], $sa['count'], $sa['refAchievement'], CUSTOM_SERVERSIDE,
|
||||||
'Serverside - #'.$sa['ID'], 'Serverside - #'.$sa['ID'], 'Serverside - #'.$sa['ID'], 'Serverside - #'.$sa['ID'], 'Serverside - #'.$sa['ID']
|
'Serverside - #'.$sa['ID'], 'Serverside - #'.$sa['ID'], 'Serverside - #'.$sa['ID'], 'Serverside - #'.$sa['ID'], 'Serverside - #'.$sa['ID']
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($ids)
|
if ($ids)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// create chain of achievements
|
// create chain of achievements
|
||||||
$chainIdx = 0;
|
$chainIdx = 0;
|
||||||
$parents = DB::Aowow()->selectCol('SELECT a.id FROM dbc_achievement a JOIN dbc_achievement b ON b.previous = a.id WHERE a.previous = 0');
|
$parents = DB::Aowow()->selectCol('SELECT a.id FROM dbc_achievement a JOIN dbc_achievement b ON b.previous = a.id WHERE a.previous = 0');
|
||||||
foreach ($parents as $chainId => $next)
|
foreach ($parents as $chainId => $next)
|
||||||
{
|
{
|
||||||
$tree = [null, $next];
|
$tree = [null, $next];
|
||||||
while ($next = DB::Aowow()->selectCell('SELECT id FROM dbc_achievement WHERE previous = ?d', $next))
|
while ($next = DB::Aowow()->selectCell('SELECT id FROM dbc_achievement WHERE previous = ?d', $next))
|
||||||
$tree[] = $next;
|
$tree[] = $next;
|
||||||
|
|
||||||
foreach ($tree as $idx => $aId)
|
foreach ($tree as $idx => $aId)
|
||||||
{
|
{
|
||||||
if (!$aId)
|
if (!$aId)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DB::Aowow()->query('UPDATE ?_achievement SET cuFlags = cuFlags | ?d, chainId = ?d, chainPos = ?d WHERE id = ?d',
|
DB::Aowow()->query('UPDATE ?_achievement SET cuFlags = cuFlags | ?d, chainId = ?d, chainPos = ?d WHERE id = ?d',
|
||||||
$idx == 1 ? ACHIEVEMENT_CU_FIRST_SERIES : (count($tree) == $idx + 1 ? ACHIEVEMENT_CU_LAST_SERIES : 0),
|
$idx == 1 ? ACHIEVEMENT_CU_FIRST_SERIES : (count($tree) == $idx + 1 ? ACHIEVEMENT_CU_LAST_SERIES : 0),
|
||||||
$chainId + 1,
|
$chainId + 1,
|
||||||
$idx,
|
$idx,
|
||||||
$aId
|
$aId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,50 +1,50 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
// roles (1:heal; 2:mleDPS; 4:rngDPS; 8:tank)
|
// roles (1:heal; 2:mleDPS; 4:rngDPS; 8:tank)
|
||||||
$customData = array(
|
$customData = array(
|
||||||
1 => ['roles' => 0xA],
|
1 => ['roles' => 0xA],
|
||||||
2 => ['roles' => 0xB],
|
2 => ['roles' => 0xB],
|
||||||
3 => ['roles' => 0x4],
|
3 => ['roles' => 0x4],
|
||||||
4 => ['roles' => 0x2],
|
4 => ['roles' => 0x2],
|
||||||
5 => ['roles' => 0x5],
|
5 => ['roles' => 0x5],
|
||||||
6 => ['roles' => 0xA],
|
6 => ['roles' => 0xA],
|
||||||
7 => ['roles' => 0x7],
|
7 => ['roles' => 0x7],
|
||||||
8 => ['roles' => 0x4],
|
8 => ['roles' => 0x4],
|
||||||
9 => ['roles' => 0x4],
|
9 => ['roles' => 0x4],
|
||||||
11 => ['roles' => 0xF],
|
11 => ['roles' => 0xF],
|
||||||
);
|
);
|
||||||
$reqDBC = ['spell', 'charbaseinfo', 'skillraceclassinfo', 'skilllineability', 'chrclasses'];
|
$reqDBC = ['spell', 'charbaseinfo', 'skillraceclassinfo', 'skilllineability', 'chrclasses'];
|
||||||
|
|
||||||
function classes()
|
function classes()
|
||||||
{
|
{
|
||||||
$classes = DB::Aowow()->select('SELECT *, Id AS ARRAY_KEY FROM dbc_chrclasses');
|
$classes = DB::Aowow()->select('SELECT *, Id AS ARRAY_KEY FROM dbc_chrclasses');
|
||||||
|
|
||||||
// add raceMask
|
// add raceMask
|
||||||
$races = DB::Aowow()->select('SELECT classId AS ARRAY_KEY, BIT_OR(1 << (raceId - 1)) AS raceMask FROM dbc_charbaseinfo GROUP BY classId');
|
$races = DB::Aowow()->select('SELECT classId AS ARRAY_KEY, BIT_OR(1 << (raceId - 1)) AS raceMask FROM dbc_charbaseinfo GROUP BY classId');
|
||||||
Util::arraySumByKey($classes, $races);
|
Util::arraySumByKey($classes, $races);
|
||||||
|
|
||||||
// add skills
|
// add skills
|
||||||
$skills = DB::Aowow()->select('SELECT LOG(2, classMask) + 1 AS ARRAY_KEY, GROUP_CONCAT(skillLine SEPARATOR \' \') AS skills FROM dbc_skillraceclassinfo WHERE flags = 1040 GROUP BY classMask HAVING ARRAY_KEY = CAST(LOG(2, classMask) + 1 AS SIGNED)');
|
$skills = DB::Aowow()->select('SELECT LOG(2, classMask) + 1 AS ARRAY_KEY, GROUP_CONCAT(skillLine SEPARATOR \' \') AS skills FROM dbc_skillraceclassinfo WHERE flags = 1040 GROUP BY classMask HAVING ARRAY_KEY = CAST(LOG(2, classMask) + 1 AS SIGNED)');
|
||||||
Util::arraySumByKey($classes, $skills);
|
Util::arraySumByKey($classes, $skills);
|
||||||
|
|
||||||
// add weaponTypeMask & armorTypeMask
|
// add weaponTypeMask & armorTypeMask
|
||||||
foreach ($classes as $id => &$data)
|
foreach ($classes as $id => &$data)
|
||||||
{
|
{
|
||||||
$data['weaponTypeMask'] = DB::Aowow()->selectCell('SELECT BIT_OR(equippedItemSubClassMask) FROM dbc_spell s JOIN dbc_skilllineability sla ON sla.spellId = s.id JOIN dbc_skillraceclassinfo srci ON srci.skillLine = sla.skillLineId AND srci.classMask & ?d WHERE sla.skilllineid <> 183 AND (sla.reqClassMask & ?d OR sla.reqClassMask = 0) AND equippedItemClass = ?d AND (effect1Id = 60 OR effect2Id = 60)', 1 << ($id - 1), 1 << ($id - 1), ITEM_CLASS_WEAPON);
|
$data['weaponTypeMask'] = DB::Aowow()->selectCell('SELECT BIT_OR(equippedItemSubClassMask) FROM dbc_spell s JOIN dbc_skilllineability sla ON sla.spellId = s.id JOIN dbc_skillraceclassinfo srci ON srci.skillLine = sla.skillLineId AND srci.classMask & ?d WHERE sla.skilllineid <> 183 AND (sla.reqClassMask & ?d OR sla.reqClassMask = 0) AND equippedItemClass = ?d AND (effect1Id = 60 OR effect2Id = 60)', 1 << ($id - 1), 1 << ($id - 1), ITEM_CLASS_WEAPON);
|
||||||
$data['armorTypeMask'] = DB::Aowow()->selectCell('SELECT BIT_OR(equippedItemSubClassMask) FROM dbc_spell s JOIN dbc_skilllineability sla ON sla.spellId = s.id JOIN dbc_skillraceclassinfo srci ON srci.skillLine = sla.skillLineId AND srci.classMask & ?d WHERE sla.reqClassMask & ?d AND equippedItemClass = ?d AND (effect1Id = 60 OR effect2Id = 60)', 1 << ($id - 1), 1 << ($id - 1), ITEM_CLASS_ARMOR);
|
$data['armorTypeMask'] = DB::Aowow()->selectCell('SELECT BIT_OR(equippedItemSubClassMask) FROM dbc_spell s JOIN dbc_skilllineability sla ON sla.spellId = s.id JOIN dbc_skillraceclassinfo srci ON srci.skillLine = sla.skillLineId AND srci.classMask & ?d WHERE sla.reqClassMask & ?d AND equippedItemClass = ?d AND (effect1Id = 60 OR effect2Id = 60)', 1 << ($id - 1), 1 << ($id - 1), ITEM_CLASS_ARMOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($classes as $cl)
|
foreach ($classes as $cl)
|
||||||
DB::Aowow()->query('REPLACE INTO ?_classes (?#) VALUES (?a)', array_keys($cl), array_values($cl));
|
DB::Aowow()->query('REPLACE INTO ?_classes (?#) VALUES (?a)', array_keys($cl), array_values($cl));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,155 +1,158 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/* deps:
|
/* deps:
|
||||||
* creature_template
|
* creature_template
|
||||||
* creature_template_locale
|
* creature_template_locale
|
||||||
* creature_classlevelstats
|
* creature_classlevelstats
|
||||||
* instance_encounters
|
* instance_encounters
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = ['creaturedisplayinfo', 'creaturedisplayinfoextra'];
|
$reqDBC = ['creaturedisplayinfo', 'creaturedisplayinfoextra'];
|
||||||
|
|
||||||
function creature(array $ids = [])
|
function creature(array $ids = [])
|
||||||
{
|
{
|
||||||
$baseQuery = '
|
$baseQuery = '
|
||||||
SELECT
|
SELECT
|
||||||
ct.entry,
|
ct.entry,
|
||||||
IF(ie.entry IS NULL, 0, ?d) AS cuFlags, -- cuFlags
|
IF(ie.entry IS NULL, 0, ?d) AS cuFlags, -- cuFlags
|
||||||
difficulty_entry_1, difficulty_entry_2, difficulty_entry_3,
|
difficulty_entry_1, difficulty_entry_2, difficulty_entry_3,
|
||||||
KillCredit1, KillCredit2,
|
KillCredit1, KillCredit2,
|
||||||
modelid1, modelid2, modelid3, modelid4,
|
modelid1, modelid2, modelid3, modelid4,
|
||||||
"" AS textureString, -- textureString
|
"" AS textureString, -- textureString
|
||||||
0 AS modelId, -- modelId
|
0 AS modelId, -- modelId
|
||||||
"" AS iconString, -- iconString
|
"" AS iconString, -- iconString
|
||||||
ct.name, IFNULL(ctl2.`Name`, "") AS n2, IFNULL(ctl3.`Name`, "") AS n3, IFNULL(ctl6.`Name`, "") AS n6, IFNULL(ctl8.`Name`, "") AS n8,
|
ct.name, IFNULL(ctl2.`Name`, "") AS n2, IFNULL(ctl3.`Name`, "") AS n3, IFNULL(ctl6.`Name`, "") AS n6, IFNULL(ctl8.`Name`, "") AS n8,
|
||||||
subname, IFNULL(ctl2.`Title`, "") AS t2, IFNULL(ctl3.`Title`, "") AS t3, IFNULL(ctl6.`Title`, "") AS t6, IFNULL(ctl8.`Title`, "") AS t8,
|
subname, IFNULL(ctl2.`Title`, "") AS t2, IFNULL(ctl3.`Title`, "") AS t3, IFNULL(ctl6.`Title`, "") AS t6, IFNULL(ctl8.`Title`, "") AS t8,
|
||||||
minLevel, maxLevel,
|
minLevel, maxLevel,
|
||||||
exp,
|
exp,
|
||||||
faction,
|
faction,
|
||||||
npcflag,
|
npcflag,
|
||||||
rank,
|
rank,
|
||||||
dmgSchool,
|
dmgSchool,
|
||||||
DamageModifier,
|
DamageModifier,
|
||||||
BaseAttackTime,
|
BaseAttackTime,
|
||||||
RangeAttackTime,
|
RangeAttackTime,
|
||||||
BaseVariance,
|
BaseVariance,
|
||||||
RangeVariance,
|
RangeVariance,
|
||||||
unit_class,
|
unit_class,
|
||||||
unit_flags, unit_flags2, dynamicflags,
|
unit_flags, unit_flags2, dynamicflags,
|
||||||
family,
|
family,
|
||||||
trainer_type,
|
trainer_type,
|
||||||
trainer_spell,
|
trainer_spell,
|
||||||
trainer_class,
|
trainer_class,
|
||||||
trainer_race,
|
trainer_race,
|
||||||
(CASE ct.exp WHEN 0 THEN min.damage_base WHEN 1 THEN min.damage_exp1 ELSE min.damage_exp2 END) AS dmgMin,
|
(CASE ct.exp WHEN 0 THEN min.damage_base WHEN 1 THEN min.damage_exp1 ELSE min.damage_exp2 END) AS dmgMin,
|
||||||
(CASE ct.exp WHEN 0 THEN max.damage_base WHEN 1 THEN max.damage_exp1 ELSE max.damage_exp2 END) AS dmgMax,
|
(CASE ct.exp WHEN 0 THEN max.damage_base WHEN 1 THEN max.damage_exp1 ELSE max.damage_exp2 END) AS dmgMax,
|
||||||
min.attackpower AS mleAtkPwrMin,
|
min.attackpower AS mleAtkPwrMin,
|
||||||
max.attackpower AS mleAtkPwrMax,
|
max.attackpower AS mleAtkPwrMax,
|
||||||
min.rangedattackpower AS rmgAtkPwrMin,
|
min.rangedattackpower AS rmgAtkPwrMin,
|
||||||
max.rangedattackpower AS rmgAtkPwrMax,
|
max.rangedattackpower AS rmgAtkPwrMax,
|
||||||
type,
|
type,
|
||||||
type_flags,
|
type_flags,
|
||||||
lootid, pickpocketloot, skinloot,
|
lootid, pickpocketloot, skinloot,
|
||||||
spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8,
|
spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8,
|
||||||
PetSpellDataId,
|
PetSpellDataId,
|
||||||
VehicleId,
|
VehicleId,
|
||||||
mingold, maxgold,
|
mingold, maxgold,
|
||||||
AIName,
|
AIName,
|
||||||
(CASE ct.exp WHEN 0 THEN min.basehp0 WHEN 1 THEN min.basehp1 ELSE min.basehp2 END) * ct.HealthModifier AS healthMin,
|
(CASE ct.exp WHEN 0 THEN min.basehp0 WHEN 1 THEN min.basehp1 ELSE min.basehp2 END) * ct.HealthModifier AS healthMin,
|
||||||
(CASE ct.exp WHEN 0 THEN max.basehp0 WHEN 1 THEN max.basehp1 ELSE max.basehp2 END) * ct.HealthModifier AS healthMax,
|
(CASE ct.exp WHEN 0 THEN max.basehp0 WHEN 1 THEN max.basehp1 ELSE max.basehp2 END) * ct.HealthModifier AS healthMax,
|
||||||
min.basemana * ct.ManaModifier AS manaMin,
|
min.basemana * ct.ManaModifier AS manaMin,
|
||||||
max.basemana * ct.ManaModifier AS manaMax,
|
max.basemana * ct.ManaModifier AS manaMax,
|
||||||
min.basearmor * ct.ArmorModifier AS armorMin,
|
min.basearmor * ct.ArmorModifier AS armorMin,
|
||||||
max.basearmor * ct.ArmorModifier AS armorMax,
|
max.basearmor * ct.ArmorModifier AS armorMax,
|
||||||
RacialLeader,
|
RacialLeader,
|
||||||
mechanic_immune_mask,
|
mechanic_immune_mask,
|
||||||
flags_extra,
|
flags_extra,
|
||||||
ScriptName
|
ScriptName
|
||||||
FROM
|
FROM
|
||||||
creature_template ct
|
creature_template ct
|
||||||
JOIN
|
JOIN
|
||||||
creature_classlevelstats min ON ct.unit_class = min.class AND ct.minlevel = min.level
|
creature_classlevelstats min ON ct.unit_class = min.class AND ct.minlevel = min.level
|
||||||
JOIN
|
JOIN
|
||||||
creature_classlevelstats max ON ct.unit_class = max.class AND ct.maxlevel = max.level
|
creature_classlevelstats max ON ct.unit_class = max.class AND ct.maxlevel = max.level
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
creature_template_locale ctl2 ON ct.entry = ctl2.entry AND ctl2.`locale` = "frFR"
|
creature_template_locale ctl2 ON ct.entry = ctl2.entry AND ctl2.`locale` = "frFR"
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
creature_template_locale ctl3 ON ct.entry = ctl3.entry AND ctl3.`locale` = "deDE"
|
creature_template_locale ctl3 ON ct.entry = ctl3.entry AND ctl3.`locale` = "deDE"
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
creature_template_locale ctl6 ON ct.entry = ctl6.entry AND ctl6.`locale` = "esES"
|
creature_template_locale ctl6 ON ct.entry = ctl6.entry AND ctl6.`locale` = "esES"
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
creature_template_locale ctl8 ON ct.entry = ctl8.entry AND ctl8.`locale` = "ruRU"
|
creature_template_locale ctl8 ON ct.entry = ctl8.entry AND ctl8.`locale` = "ruRU"
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
instance_encounters ie ON ie.creditEntry = ct.entry AND ie.creditType = 0
|
instance_encounters ie ON ie.creditEntry = ct.entry AND ie.creditType = 0
|
||||||
WHERE
|
WHERE
|
||||||
ct.entry > ?d
|
ct.entry > ?d
|
||||||
{
|
{
|
||||||
AND ct.entry IN (?a)
|
AND ct.entry IN (?a)
|
||||||
}
|
}
|
||||||
ORDER BY
|
ORDER BY
|
||||||
ct.entry ASC
|
ct.entry ASC
|
||||||
LIMIT
|
LIMIT
|
||||||
?d';
|
?d';
|
||||||
|
|
||||||
$dummyQuery = '
|
$dummyQuery = '
|
||||||
UPDATE
|
UPDATE
|
||||||
?_creature a
|
?_creature a
|
||||||
JOIN
|
JOIN
|
||||||
(
|
(
|
||||||
SELECT b.difficultyEntry1 AS dummy FROM ?_creature b UNION
|
SELECT b.difficultyEntry1 AS dummy FROM ?_creature b UNION
|
||||||
SELECT c.difficultyEntry2 AS dummy FROM ?_creature c UNION
|
SELECT c.difficultyEntry2 AS dummy FROM ?_creature c UNION
|
||||||
SELECT d.difficultyEntry3 AS dummy FROM ?_creature d
|
SELECT d.difficultyEntry3 AS dummy FROM ?_creature d
|
||||||
) j
|
) j
|
||||||
SET
|
SET
|
||||||
a.cuFlags = a.cuFlags | ?d
|
a.cuFlags = a.cuFlags | ?d
|
||||||
WHERE
|
WHERE
|
||||||
a.id = j.dummy';
|
a.id = j.dummy';
|
||||||
|
|
||||||
$displayInfoQuery = '
|
$displayInfoQuery = '
|
||||||
UPDATE
|
UPDATE
|
||||||
?_creature c
|
?_creature c
|
||||||
JOIN
|
JOIN
|
||||||
dbc_creaturedisplayinfo cdi ON c.displayId1 = cdi.id
|
dbc_creaturedisplayinfo cdi ON c.displayId1 = cdi.id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
dbc_creaturedisplayinfoextra cdie ON cdi.extraInfoId = cdie.id
|
dbc_creaturedisplayinfoextra cdie ON cdi.extraInfoId = cdie.id
|
||||||
SET
|
SET
|
||||||
c.textureString = IFNULL(cdie.textureString, cdi.skin1),
|
c.textureString = IFNULL(cdie.textureString, cdi.skin1),
|
||||||
c.modelId = cdi.modelId,
|
c.modelId = cdi.modelId,
|
||||||
c.iconString = cdi.iconString';
|
c.iconString = cdi.iconString';
|
||||||
|
|
||||||
$lastMax = 0;
|
$lastMax = 0;
|
||||||
while ($npcs = DB::World()->select($baseQuery, NPC_CU_INSTANCE_BOSS, $lastMax, $ids ?: DBSIMPLE_SKIP, SqlGen::$stepSize))
|
while ($npcs = DB::World()->select($baseQuery, NPC_CU_INSTANCE_BOSS, $lastMax, $ids ?: DBSIMPLE_SKIP, SqlGen::$stepSize))
|
||||||
{
|
{
|
||||||
$newMax = max(array_column($npcs, 'entry'));
|
$newMax = max(array_column($npcs, 'entry'));
|
||||||
|
|
||||||
CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax);
|
CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax);
|
||||||
|
|
||||||
$lastMax = $newMax;
|
$lastMax = $newMax;
|
||||||
|
|
||||||
foreach ($npcs as $npc)
|
foreach ($npcs as $npc)
|
||||||
DB::Aowow()->query('REPLACE INTO ?_creature VALUES (?a)', array_values($npc));
|
DB::Aowow()->query('REPLACE INTO ?_creature VALUES (?a)', array_values($npc));
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply "textureString", "modelId" and "iconSring"
|
// apply "textureString", "modelId" and "iconSring"
|
||||||
DB::Aowow()->query($displayInfoQuery);
|
DB::Aowow()->query($displayInfoQuery);
|
||||||
|
|
||||||
// apply cuFlag: difficultyDummy
|
// apply cuFlag: difficultyDummy
|
||||||
DB::Aowow()->query($dummyQuery, NPC_CU_DIFFICULTY_DUMMY | CUSTOM_EXCLUDE_FOR_LISTVIEW);
|
DB::Aowow()->query($dummyQuery, NPC_CU_DIFFICULTY_DUMMY | CUSTOM_EXCLUDE_FOR_LISTVIEW);
|
||||||
|
|
||||||
// apply cuFlag: excludeFromListview [for trigger-creatures]
|
// apply cuFlag: excludeFromListview [for trigger-creatures]
|
||||||
DB::Aowow()->query('UPDATE ?_creature SET cuFlags = cuFlags | ?d WHERE flagsExtra & ?d', CUSTOM_EXCLUDE_FOR_LISTVIEW, 0x80);
|
DB::Aowow()->query('UPDATE ?_creature SET cuFlags = cuFlags | ?d WHERE flagsExtra & ?d', CUSTOM_EXCLUDE_FOR_LISTVIEW, 0x80);
|
||||||
|
|
||||||
return true;
|
// apply cuFlag: exCludeFromListview [for nameparts indicating internal usage]
|
||||||
}
|
DB::Aowow()->query('UPDATE ?_creature SET cuFlags = cuFlags | ?d WHERE name_loc0 LIKE "%[%" OR name_loc0 LIKE "%(%" OR name_loc0 LIKE "%visual%" OR name_loc0 LIKE "%trigger%" OR name_loc0 LIKE "%credit%" OR name_loc0 LIKE "%marker%"', CUSTOM_EXCLUDE_FOR_LISTVIEW);
|
||||||
|
|
||||||
?>
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|||||||
@@ -1,57 +1,57 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/* deps:
|
/* deps:
|
||||||
* item_template
|
* item_template
|
||||||
* locales_item
|
* locales_item
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// hide test tokens and move them to unused
|
// hide test tokens and move them to unused
|
||||||
$customData = array(
|
$customData = array(
|
||||||
1 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3],
|
1 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3],
|
||||||
2 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3],
|
2 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3],
|
||||||
4 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3],
|
4 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3],
|
||||||
22 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3],
|
22 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3],
|
||||||
141 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3],
|
141 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3],
|
||||||
103 => ['cap' => 10000], // Arena Points
|
103 => ['cap' => 10000], // Arena Points
|
||||||
104 => ['cap' => 75000] // Honor Points
|
104 => ['cap' => 75000] // Honor Points
|
||||||
);
|
);
|
||||||
$reqDBC = ['itemdisplayinfo', 'currencytypes'];
|
$reqDBC = ['itemdisplayinfo', 'currencytypes'];
|
||||||
|
|
||||||
function currencies(array $ids = [])
|
function currencies(array $ids = [])
|
||||||
{
|
{
|
||||||
if (!$ids)
|
if (!$ids)
|
||||||
DB::Aowow()->query('REPLACE INTO ?_currencies (id, category, itemId) SELECT Id, category, itemId FROM dbc_currencytypes');
|
DB::Aowow()->query('REPLACE INTO ?_currencies (id, category, itemId) SELECT Id, category, itemId FROM dbc_currencytypes');
|
||||||
|
|
||||||
$moneyItems = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, itemId FROM dbc_currencytypes{ WHERE id IN (?a)}', $ids ?: DBSIMPLE_SKIP);
|
$moneyItems = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, itemId FROM dbc_currencytypes{ WHERE id IN (?a)}', $ids ?: DBSIMPLE_SKIP);
|
||||||
|
|
||||||
// apply names & cap
|
// apply names & cap
|
||||||
$moneyNames = DB::World()->select('SELECT it.entry AS ARRAY_KEY, name AS name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, it.maxCount AS cap FROM item_template it LEFT JOIN locales_item li ON li.entry = it.entry WHERE it.entry IN (?a)', $moneyItems);
|
$moneyNames = DB::World()->select('SELECT it.entry AS ARRAY_KEY, name AS name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, it.maxCount AS cap FROM item_template it LEFT JOIN locales_item li ON li.entry = it.entry WHERE it.entry IN (?a)', $moneyItems);
|
||||||
foreach ($moneyItems as $cId => $itemId)
|
foreach ($moneyItems as $cId => $itemId)
|
||||||
{
|
{
|
||||||
if (!empty($moneyNames[$itemId]))
|
if (!empty($moneyNames[$itemId]))
|
||||||
$strings = $moneyNames[$itemId];
|
$strings = $moneyNames[$itemId];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLISetup::log('item #'.$itemId.' required by currency #'.$cId.' not in item_template', CLISetup::LOG_WARN);
|
CLISetup::log('item #'.$itemId.' required by currency #'.$cId.' not in item_template', CLISetup::LOG_WARN);
|
||||||
$strings = ['name_loc0' => 'Item #'.$itemId.' not in DB', 'iconId' => -1240, 'cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3];
|
$strings = ['name_loc0' => 'Item #'.$itemId.' not in DB', 'iconId' => -1240, 'cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::Aowow()->query('UPDATE ?_currencies SET ?a WHERE itemId = ?d', $strings, $itemId);
|
DB::Aowow()->query('UPDATE ?_currencies SET ?a WHERE itemId = ?d', $strings, $itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply icons
|
// apply icons
|
||||||
$displayIds = DB::World()->selectCol('SELECT entry AS ARRAY_KEY, displayid FROM item_template WHERE entry IN (?a)', $moneyItems);
|
$displayIds = DB::World()->selectCol('SELECT entry AS ARRAY_KEY, displayid FROM item_template WHERE entry IN (?a)', $moneyItems);
|
||||||
foreach ($displayIds as $itemId => $iconId)
|
foreach ($displayIds as $itemId => $iconId)
|
||||||
DB::Aowow()->query('UPDATE ?_currencies SET iconId = ?d WHERE itemId = ?d', -$iconId, $itemId);
|
DB::Aowow()->query('UPDATE ?_currencies SET iconId = ?d WHERE itemId = ?d', -$iconId, $itemId);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,95 +1,95 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = ['emotes', 'emotestext', 'emotestextdata' /*, 'emotestextsound' */];
|
$reqDBC = ['emotes', 'emotestext', 'emotestextdata' /*, 'emotestextsound' */];
|
||||||
|
|
||||||
function emotes(/*array $ids = [] */)
|
function emotes(/*array $ids = [] */)
|
||||||
{
|
{
|
||||||
$globStrPath = CLISetup::$srcDir.'%sInterface/FrameXML/GlobalStrings.lua';
|
$globStrPath = CLISetup::$srcDir.'%sInterface/FrameXML/GlobalStrings.lua';
|
||||||
$allOK = true;
|
$allOK = true;
|
||||||
$locPath = [];
|
$locPath = [];
|
||||||
|
|
||||||
DB::Aowow()->query('TRUNCATE ?_emotes_aliasses');
|
DB::Aowow()->query('TRUNCATE ?_emotes_aliasses');
|
||||||
|
|
||||||
foreach (CLISetup::$localeIds as $lId)
|
foreach (CLISetup::$localeIds as $lId)
|
||||||
{
|
{
|
||||||
foreach (CLISetup::$expectedPaths as $xp => $locId)
|
foreach (CLISetup::$expectedPaths as $xp => $locId)
|
||||||
{
|
{
|
||||||
if ($lId != $locId)
|
if ($lId != $locId)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ($xp) // if in subDir add trailing slash
|
if ($xp) // if in subDir add trailing slash
|
||||||
$xp .= '/';
|
$xp .= '/';
|
||||||
|
|
||||||
$path = sprintf($globStrPath, $xp);
|
$path = sprintf($globStrPath, $xp);
|
||||||
if (CLISetup::fileExists($path))
|
if (CLISetup::fileExists($path))
|
||||||
{
|
{
|
||||||
$locPath[$lId] = $path;
|
$locPath[$lId] = $path;
|
||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CLISetup::log('GlobalStrings.lua not found for selected locale '.CLISetup::bold(Util::$localeStrings[$lId]), CLISetup::LOG_WARN);
|
CLISetup::log('GlobalStrings.lua not found for selected locale '.CLISetup::bold(Util::$localeStrings[$lId]), CLISetup::LOG_WARN);
|
||||||
$allOK = false;
|
$allOK = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$_= DB::Aowow()->query('REPLACE INTO ?_emotes SELECT
|
$_= DB::Aowow()->query('REPLACE INTO ?_emotes SELECT
|
||||||
et.Id,
|
et.Id,
|
||||||
LOWER(et.command),
|
LOWER(et.command),
|
||||||
IF(e.animationId, 1, 0),
|
IF(e.animationId, 1, 0),
|
||||||
0, -- cuFlags
|
0, -- cuFlags
|
||||||
etdT.text_loc0, etdT.text_loc2, etdT.text_loc3, etdT.text_loc6, etdT.text_loc8,
|
etdT.text_loc0, etdT.text_loc2, etdT.text_loc3, etdT.text_loc6, etdT.text_loc8,
|
||||||
etdNT.text_loc0, etdNT.text_loc2, etdNT.text_loc3, etdNT.text_loc6, etdNT.text_loc8,
|
etdNT.text_loc0, etdNT.text_loc2, etdNT.text_loc3, etdNT.text_loc6, etdNT.text_loc8,
|
||||||
etdS.text_loc0, etdS.text_loc2, etdS.text_loc3, etdS.text_loc6, etdS.text_loc8
|
etdS.text_loc0, etdS.text_loc2, etdS.text_loc3, etdS.text_loc6, etdS.text_loc8
|
||||||
FROM
|
FROM
|
||||||
dbc_emotestext et
|
dbc_emotestext et
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
dbc_emotes e ON e.Id = et.emoteId
|
dbc_emotes e ON e.Id = et.emoteId
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
dbc_emotestextdata etdT ON etdT.Id = et.targetId
|
dbc_emotestextdata etdT ON etdT.Id = et.targetId
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
dbc_emotestextdata etdNT ON etdNT.Id = et.noTargetId
|
dbc_emotestextdata etdNT ON etdNT.Id = et.noTargetId
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
dbc_emotestextdata etdS ON etdS.Id = et.selfId'
|
dbc_emotestextdata etdS ON etdS.Id = et.selfId'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$_)
|
if (!$_)
|
||||||
$allOK = false;
|
$allOK = false;
|
||||||
|
|
||||||
// i have no idea, how the indexing in this file works.
|
// i have no idea, how the indexing in this file works.
|
||||||
// sometimes the \d+ after EMOTE is the emoteTextId, but not nearly often enough
|
// sometimes the \d+ after EMOTE is the emoteTextId, but not nearly often enough
|
||||||
$aliasses = [];
|
$aliasses = [];
|
||||||
foreach ($locPath as $lId => $path)
|
foreach ($locPath as $lId => $path)
|
||||||
foreach (file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line)
|
foreach (file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line)
|
||||||
if (preg_match('/^EMOTE(\d+)_CMD\d+\s=\s\"\/([^"]+)\";$/', $line, $m))
|
if (preg_match('/^EMOTE(\d+)_CMD\d+\s=\s\"\/([^"]+)\";$/', $line, $m))
|
||||||
$aliasses[$m[1]][] = [$lId, $m[2]];
|
$aliasses[$m[1]][] = [$lId, $m[2]];
|
||||||
|
|
||||||
|
|
||||||
$emotes = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, cmd FROM ?_emotes');
|
$emotes = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, cmd FROM ?_emotes');
|
||||||
|
|
||||||
foreach($emotes as $eId => $cmd)
|
foreach($emotes as $eId => $cmd)
|
||||||
{
|
{
|
||||||
foreach ($aliasses as $gsId => $data)
|
foreach ($aliasses as $gsId => $data)
|
||||||
{
|
{
|
||||||
if (in_array($cmd, array_column($data, 1)))
|
if (in_array($cmd, array_column($data, 1)))
|
||||||
{
|
{
|
||||||
foreach ($data as $d)
|
foreach ($data as $d)
|
||||||
DB::Aowow()->query('INSERT IGNORE INTO ?_emotes_aliasses VALUES (?d, ?d, ?) ON DUPLICATE KEY UPDATE locales = locales | ?d', $eId, (1 << $d[0]), strtolower($d[1]), (1 << $d[0]));
|
DB::Aowow()->query('INSERT IGNORE INTO ?_emotes_aliasses VALUES (?d, ?d, ?) ON DUPLICATE KEY UPDATE locales = locales | ?d', $eId, (1 << $d[0]), strtolower($d[1]), (1 << $d[0]));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $allOK;
|
return $allOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,52 +1,52 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/* deps:
|
/* deps:
|
||||||
* game_event
|
* game_event
|
||||||
* game_event_prerequisite
|
* game_event_prerequisite
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = array(
|
$reqDBC = array(
|
||||||
);
|
);
|
||||||
|
|
||||||
function events(array $ids = [])
|
function events(array $ids = [])
|
||||||
{
|
{
|
||||||
$eventQuery = '
|
$eventQuery = '
|
||||||
SELECT
|
SELECT
|
||||||
ge.eventEntry,
|
ge.eventEntry,
|
||||||
holiday,
|
holiday,
|
||||||
0, -- cuFlags
|
0, -- cuFlags
|
||||||
UNIX_TIMESTAMP(start_time),
|
UNIX_TIMESTAMP(start_time),
|
||||||
UNIX_TIMESTAMP(end_time),
|
UNIX_TIMESTAMP(end_time),
|
||||||
occurence * 60,
|
occurence * 60,
|
||||||
length * 60,
|
length * 60,
|
||||||
IF (gep.eventEntry IS NOT NULL, GROUP_CONCAT(prerequisite_event SEPARATOR " "), NULL),
|
IF (gep.eventEntry IS NOT NULL, GROUP_CONCAT(prerequisite_event SEPARATOR " "), NULL),
|
||||||
description
|
description
|
||||||
FROM
|
FROM
|
||||||
game_event ge
|
game_event ge
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
game_event_prerequisite gep ON gep.eventEntry = ge.eventEntry
|
game_event_prerequisite gep ON gep.eventEntry = ge.eventEntry
|
||||||
{
|
{
|
||||||
WHERE
|
WHERE
|
||||||
ge.eventEntry IN (?a)
|
ge.eventEntry IN (?a)
|
||||||
}
|
}
|
||||||
GROUP BY
|
GROUP BY
|
||||||
ge.eventEntry';
|
ge.eventEntry';
|
||||||
|
|
||||||
$events = DB::World()->select($eventQuery, $ids ?: DBSIMPLE_SKIP);
|
$events = DB::World()->select($eventQuery, $ids ?: DBSIMPLE_SKIP);
|
||||||
|
|
||||||
foreach ($events as $e)
|
foreach ($events as $e)
|
||||||
DB::Aowow()->query('REPLACE INTO ?_events VALUES (?a)', array_values($e));
|
DB::Aowow()->query('REPLACE INTO ?_events VALUES (?a)', array_values($e));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,129 +1,129 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
47 => ['qmNpcIds' => '33310'],
|
47 => ['qmNpcIds' => '33310'],
|
||||||
68 => ['qmNpcIds' => '33555'],
|
68 => ['qmNpcIds' => '33555'],
|
||||||
69 => ['qmNpcIds' => '33653'],
|
69 => ['qmNpcIds' => '33653'],
|
||||||
72 => ['qmNpcIds' => '33307'],
|
72 => ['qmNpcIds' => '33307'],
|
||||||
76 => ['qmNpcIds' => '33553'],
|
76 => ['qmNpcIds' => '33553'],
|
||||||
81 => ['qmNpcIds' => '33556'],
|
81 => ['qmNpcIds' => '33556'],
|
||||||
922 => ['qmNpcIds' => '16528'],
|
922 => ['qmNpcIds' => '16528'],
|
||||||
930 => ['qmNpcIds' => '33657'],
|
930 => ['qmNpcIds' => '33657'],
|
||||||
932 => ['qmNpcIds' => '19321'],
|
932 => ['qmNpcIds' => '19321'],
|
||||||
933 => ['qmNpcIds' => '20242 23007'],
|
933 => ['qmNpcIds' => '20242 23007'],
|
||||||
935 => ['qmNpcIds' => '21432'],
|
935 => ['qmNpcIds' => '21432'],
|
||||||
941 => ['qmNpcIds' => '20241'],
|
941 => ['qmNpcIds' => '20241'],
|
||||||
942 => ['qmNpcIds' => '17904'],
|
942 => ['qmNpcIds' => '17904'],
|
||||||
946 => ['qmNpcIds' => '17657'],
|
946 => ['qmNpcIds' => '17657'],
|
||||||
947 => ['qmNpcIds' => '17585'],
|
947 => ['qmNpcIds' => '17585'],
|
||||||
970 => ['qmNpcIds' => '18382'],
|
970 => ['qmNpcIds' => '18382'],
|
||||||
978 => ['qmNpcIds' => '20240'],
|
978 => ['qmNpcIds' => '20240'],
|
||||||
989 => ['qmNpcIds' => '21643'],
|
989 => ['qmNpcIds' => '21643'],
|
||||||
1011 => ['qmNpcIds' => '21655'],
|
1011 => ['qmNpcIds' => '21655'],
|
||||||
1012 => ['qmNpcIds' => '23159'],
|
1012 => ['qmNpcIds' => '23159'],
|
||||||
1037 => ['qmNpcIds' => '32773 32564'],
|
1037 => ['qmNpcIds' => '32773 32564'],
|
||||||
1038 => ['qmNpcIds' => '23428'],
|
1038 => ['qmNpcIds' => '23428'],
|
||||||
1052 => ['qmNpcIds' => '32774 32565'],
|
1052 => ['qmNpcIds' => '32774 32565'],
|
||||||
1073 => ['qmNpcIds' => '31916 32763'],
|
1073 => ['qmNpcIds' => '31916 32763'],
|
||||||
1090 => ['qmNpcIds' => '32287'],
|
1090 => ['qmNpcIds' => '32287'],
|
||||||
1091 => ['qmNpcIds' => '32533'],
|
1091 => ['qmNpcIds' => '32533'],
|
||||||
1094 => ['qmNpcIds' => '34881'],
|
1094 => ['qmNpcIds' => '34881'],
|
||||||
1105 => ['qmNpcIds' => '31910'],
|
1105 => ['qmNpcIds' => '31910'],
|
||||||
1106 => ['qmNpcIds' => '30431'],
|
1106 => ['qmNpcIds' => '30431'],
|
||||||
1119 => ['qmNpcIds' => '32540'],
|
1119 => ['qmNpcIds' => '32540'],
|
||||||
1124 => ['qmNpcIds' => '34772'],
|
1124 => ['qmNpcIds' => '34772'],
|
||||||
1156 => ['qmNpcIds' => '37687'],
|
1156 => ['qmNpcIds' => '37687'],
|
||||||
1082 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW],
|
1082 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW],
|
||||||
952 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW],
|
952 => ['cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW],
|
||||||
);
|
);
|
||||||
$reqDBC = ['faction', 'factiontemplate'];
|
$reqDBC = ['faction', 'factiontemplate'];
|
||||||
|
|
||||||
function factions()
|
function factions()
|
||||||
{
|
{
|
||||||
$factionQuery = '
|
$factionQuery = '
|
||||||
REPLACE INTO
|
REPLACE INTO
|
||||||
?_factions
|
?_factions
|
||||||
SELECT
|
SELECT
|
||||||
f.id,
|
f.id,
|
||||||
f.repIdx,
|
f.repIdx,
|
||||||
IF(SUM(ft.ourMask & 0x6) / COUNT(1) = 0x4, 2, IF(SUM(ft.ourMask & 0x6) / COUNT(1) = 0x2, 1, 0)) as side,
|
IF(SUM(ft.ourMask & 0x6) / COUNT(1) = 0x4, 2, IF(SUM(ft.ourMask & 0x6) / COUNT(1) = 0x2, 1, 0)) as side,
|
||||||
0, -- expansion
|
0, -- expansion
|
||||||
"", -- quartermasterNpcIds
|
"", -- quartermasterNpcIds
|
||||||
"", -- factionTemplateIds
|
"", -- factionTemplateIds
|
||||||
0, -- cuFlags
|
0, -- cuFlags
|
||||||
parentFaction,
|
parentFaction,
|
||||||
spilloverRateIn, spilloverRateOut, spilloverMaxRank,
|
spilloverRateIn, spilloverRateOut, spilloverMaxRank,
|
||||||
name_loc0, name_loc2, name_loc3, name_loc6, name_loc8
|
name_loc0, name_loc2, name_loc3, name_loc6, name_loc8
|
||||||
FROM
|
FROM
|
||||||
dbc_faction f
|
dbc_faction f
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
dbc_factiontemplate ft ON ft.factionid = f.id
|
dbc_factiontemplate ft ON ft.factionid = f.id
|
||||||
GROUP BY
|
GROUP BY
|
||||||
f.id';
|
f.id';
|
||||||
|
|
||||||
$templateQuery = '
|
$templateQuery = '
|
||||||
UPDATE
|
UPDATE
|
||||||
?_factions f
|
?_factions f
|
||||||
JOIN
|
JOIN
|
||||||
(SELECT ft.factionId, GROUP_CONCAT(ft.Id SEPARATOR " ") AS tplIds FROM dbc_factiontemplate ft GROUP BY ft.factionId) temp ON f.id = temp.factionId
|
(SELECT ft.factionId, GROUP_CONCAT(ft.Id SEPARATOR " ") AS tplIds FROM dbc_factiontemplate ft GROUP BY ft.factionId) temp ON f.id = temp.factionId
|
||||||
SET
|
SET
|
||||||
f.templateIds = temp.tplIds';
|
f.templateIds = temp.tplIds';
|
||||||
|
|
||||||
$recursiveUpdateQuery = '
|
$recursiveUpdateQuery = '
|
||||||
UPDATE
|
UPDATE
|
||||||
?_factions top
|
?_factions top
|
||||||
JOIN
|
JOIN
|
||||||
(SELECT id, parentFactionId FROM ?_factions) mid ON mid.parentFactionId IN (?a)
|
(SELECT id, parentFactionId FROM ?_factions) mid ON mid.parentFactionId IN (?a)
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
(SELECT id, parentFactionId FROM ?_factions) low ON low.parentFactionId = mid.id
|
(SELECT id, parentFactionId FROM ?_factions) low ON low.parentFactionId = mid.id
|
||||||
SET
|
SET
|
||||||
?a
|
?a
|
||||||
WHERE
|
WHERE
|
||||||
repIdx > 0 AND (
|
repIdx > 0 AND (
|
||||||
top.id IN (?a) OR
|
top.id IN (?a) OR
|
||||||
top.id = mid.id OR
|
top.id = mid.id OR
|
||||||
top.id = low.id
|
top.id = low.id
|
||||||
)';
|
)';
|
||||||
|
|
||||||
$excludeQuery = '
|
$excludeQuery = '
|
||||||
UPDATE
|
UPDATE
|
||||||
?_factions x
|
?_factions x
|
||||||
JOIN
|
JOIN
|
||||||
dbc_faction f ON f.id = x.id
|
dbc_faction f ON f.id = x.id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
dbc_factiontemplate ft ON f.Id = ft.factionId
|
dbc_factiontemplate ft ON f.Id = ft.factionId
|
||||||
SET
|
SET
|
||||||
cuFlags = cuFlags | ?d
|
cuFlags = cuFlags | ?d
|
||||||
WHERE
|
WHERE
|
||||||
f.repIdx < 0 OR
|
f.repIdx < 0 OR
|
||||||
(
|
(
|
||||||
f.repIdx > 0 AND
|
f.repIdx > 0 AND
|
||||||
(f.repFlags1 & 0x8 OR ft.id IS NULL) AND
|
(f.repFlags1 & 0x8 OR ft.id IS NULL) AND
|
||||||
(f.repFlags1 & 0x80) = 0
|
(f.repFlags1 & 0x80) = 0
|
||||||
)';
|
)';
|
||||||
|
|
||||||
$pairs = array(
|
$pairs = array(
|
||||||
[[980], ['expansion' => 1]],
|
[[980], ['expansion' => 1]],
|
||||||
[[1097], ['expansion' => 2]],
|
[[1097], ['expansion' => 2]],
|
||||||
[[469, 891, 1037], ['side' => 1]],
|
[[469, 891, 1037], ['side' => 1]],
|
||||||
[[ 67, 892, 1052], ['side' => 2]],
|
[[ 67, 892, 1052], ['side' => 2]],
|
||||||
);
|
);
|
||||||
|
|
||||||
DB::Aowow()->query($factionQuery);
|
DB::Aowow()->query($factionQuery);
|
||||||
DB::Aowow()->query($templateQuery);
|
DB::Aowow()->query($templateQuery);
|
||||||
DB::Aowow()->query($excludeQuery, CUSTOM_EXCLUDE_FOR_LISTVIEW);
|
DB::Aowow()->query($excludeQuery, CUSTOM_EXCLUDE_FOR_LISTVIEW);
|
||||||
|
|
||||||
foreach ($pairs as $p)
|
foreach ($pairs as $p)
|
||||||
DB::Aowow()->query($recursiveUpdateQuery, $p[0], $p[1], $p[0]);
|
DB::Aowow()->query($recursiveUpdateQuery, $p[0], $p[1], $p[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,38 +1,38 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = ['factiontemplate'];
|
$reqDBC = ['factiontemplate'];
|
||||||
|
|
||||||
function factiontemplate()
|
function factiontemplate()
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
REPLACE INTO
|
REPLACE INTO
|
||||||
?_factiontemplate
|
?_factiontemplate
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
factionId,
|
factionId,
|
||||||
IF(friendFactionId1 = 1 OR friendFactionId2 = 1 OR friendFactionId3 = 1 OR friendFactionId4 = 1 OR friendlyMask & 0x3,
|
IF(friendFactionId1 = 1 OR friendFactionId2 = 1 OR friendFactionId3 = 1 OR friendFactionId4 = 1 OR friendlyMask & 0x3,
|
||||||
1,
|
1,
|
||||||
IF(enemyFactionId1 = 1 OR enemyFactionId2 = 1 OR enemyFactionId3 = 1 OR enemyFactionId4 = 1 OR hostileMask & 0x3, -1, 0)
|
IF(enemyFactionId1 = 1 OR enemyFactionId2 = 1 OR enemyFactionId3 = 1 OR enemyFactionId4 = 1 OR hostileMask & 0x3, -1, 0)
|
||||||
),
|
),
|
||||||
IF(friendFactionId1 = 2 OR friendFactionId2 = 2 OR friendFactionId3 = 2 OR friendFactionId4 = 2 OR friendlyMask & 0x5,
|
IF(friendFactionId1 = 2 OR friendFactionId2 = 2 OR friendFactionId3 = 2 OR friendFactionId4 = 2 OR friendlyMask & 0x5,
|
||||||
1,
|
1,
|
||||||
IF(enemyFactionId1 = 2 OR enemyFactionId2 = 2 OR enemyFactionId3 = 2 OR enemyFactionId4 = 2 OR hostileMask & 0x5, -1, 0)
|
IF(enemyFactionId1 = 2 OR enemyFactionId2 = 2 OR enemyFactionId3 = 2 OR enemyFactionId4 = 2 OR hostileMask & 0x5, -1, 0)
|
||||||
)
|
)
|
||||||
FROM
|
FROM
|
||||||
dbc_factiontemplate';
|
dbc_factiontemplate';
|
||||||
|
|
||||||
DB::Aowow()->query($query);
|
DB::Aowow()->query($query);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,59 +1,59 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
62 => ['iconString' => 'inv_misc_missilelarge_red' ],
|
62 => ['iconString' => 'inv_misc_missilelarge_red' ],
|
||||||
141 => ['iconString' => 'calendar_winterveilstart', 'achievementCatOrId' => 156 ],
|
141 => ['iconString' => 'calendar_winterveilstart', 'achievementCatOrId' => 156 ],
|
||||||
181 => ['iconString' => 'calendar_noblegardenstart', 'achievementCatOrId' => 159 ],
|
181 => ['iconString' => 'calendar_noblegardenstart', 'achievementCatOrId' => 159 ],
|
||||||
201 => ['iconString' => 'calendar_childrensweekstart', 'achievementCatOrId' => 163 ],
|
201 => ['iconString' => 'calendar_childrensweekstart', 'achievementCatOrId' => 163 ],
|
||||||
283 => ['iconString' => 'inv_jewelry_necklace_21' ],
|
283 => ['iconString' => 'inv_jewelry_necklace_21' ],
|
||||||
284 => ['iconString' => 'inv_misc_rune_07' ],
|
284 => ['iconString' => 'inv_misc_rune_07' ],
|
||||||
285 => ['iconString' => 'inv_jewelry_amulet_07' ],
|
285 => ['iconString' => 'inv_jewelry_amulet_07' ],
|
||||||
301 => ['iconString' => 'calendar_fishingextravaganzastart' ],
|
301 => ['iconString' => 'calendar_fishingextravaganzastart' ],
|
||||||
321 => ['iconString' => 'calendar_harvestfestivalstart' ],
|
321 => ['iconString' => 'calendar_harvestfestivalstart' ],
|
||||||
324 => ['iconString' => 'calendar_hallowsendstart', 'bossCreature' => 23682, 'achievementCatOrId' => 158 ],
|
324 => ['iconString' => 'calendar_hallowsendstart', 'bossCreature' => 23682, 'achievementCatOrId' => 158 ],
|
||||||
327 => ['iconString' => 'calendar_lunarfestivalstart', 'bossCreature' => 15467, 'achievementCatOrId' => 160 ],
|
327 => ['iconString' => 'calendar_lunarfestivalstart', 'bossCreature' => 15467, 'achievementCatOrId' => 160 ],
|
||||||
335 => ['iconString' => 'calendar_loveintheairstart' ],
|
335 => ['iconString' => 'calendar_loveintheairstart' ],
|
||||||
341 => ['iconString' => 'calendar_midsummerstart', 'bossCreature' => 25740, 'achievementCatOrId' => 161 ],
|
341 => ['iconString' => 'calendar_midsummerstart', 'bossCreature' => 25740, 'achievementCatOrId' => 161 ],
|
||||||
353 => ['iconString' => 'spell_nature_eyeofthestorm' ],
|
353 => ['iconString' => 'spell_nature_eyeofthestorm' ],
|
||||||
372 => ['iconString' => 'calendar_brewfeststart', 'bossCreature' => 23872, 'achievementCatOrId' => 162 ],
|
372 => ['iconString' => 'calendar_brewfeststart', 'bossCreature' => 23872, 'achievementCatOrId' => 162 ],
|
||||||
374 => ['iconString' => 'calendar_darkmoonfaireelwynnstart' ],
|
374 => ['iconString' => 'calendar_darkmoonfaireelwynnstart' ],
|
||||||
375 => ['iconString' => 'calendar_darkmoonfairemulgorestart' ],
|
375 => ['iconString' => 'calendar_darkmoonfairemulgorestart' ],
|
||||||
376 => ['iconString' => 'calendar_darkmoonfaireterokkarstart' ],
|
376 => ['iconString' => 'calendar_darkmoonfaireterokkarstart' ],
|
||||||
398 => ['iconString' => 'calendar_piratesdaystart', 'achievementCatOrId' => -3457],
|
398 => ['iconString' => 'calendar_piratesdaystart', 'achievementCatOrId' => -3457],
|
||||||
400 => ['iconString' => 'achievement_bg_winsoa' ],
|
400 => ['iconString' => 'achievement_bg_winsoa' ],
|
||||||
404 => ['iconString' => 'calendar_harvestfestivalstart', 'achievementCatOrId' => 14981],
|
404 => ['iconString' => 'calendar_harvestfestivalstart', 'achievementCatOrId' => 14981],
|
||||||
406 => ['iconString' => 'achievement_boss_lichking' ],
|
406 => ['iconString' => 'achievement_boss_lichking' ],
|
||||||
409 => ['iconString' => 'calendar_dayofthedeadstart', 'achievementCatOrId' => -3456],
|
409 => ['iconString' => 'calendar_dayofthedeadstart', 'achievementCatOrId' => -3456],
|
||||||
420 => ['iconString' => 'achievement_bg_winwsg' ],
|
420 => ['iconString' => 'achievement_bg_winwsg' ],
|
||||||
423 => ['iconString' => 'calendar_loveintheairstart', 'bossCreature' => 36296, 'achievementCatOrId' => 187 ],
|
423 => ['iconString' => 'calendar_loveintheairstart', 'bossCreature' => 36296, 'achievementCatOrId' => 187 ],
|
||||||
424 => ['iconString' => 'calendar_fishingextravaganzastart' ],
|
424 => ['iconString' => 'calendar_fishingextravaganzastart' ],
|
||||||
);
|
);
|
||||||
$reqDBC = ['holidays', 'holidaydescriptions', 'holidaynames'];
|
$reqDBC = ['holidays', 'holidaydescriptions', 'holidaynames'];
|
||||||
|
|
||||||
function holidays()
|
function holidays()
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
REPLACE INTO
|
REPLACE INTO
|
||||||
?_holidays (id, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, description_loc0, description_loc2, description_loc3, description_loc6, description_loc8, looping, scheduleType, textureString)
|
?_holidays (id, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, description_loc0, description_loc2, description_loc3, description_loc6, description_loc8, looping, scheduleType, textureString)
|
||||||
SELECT
|
SELECT
|
||||||
h.id, n.name_loc0, n.name_loc2, n.name_loc3, n.name_loc6, n.name_loc8, d.description_loc0, d.description_loc2, d.description_loc3, d.description_loc6, d.description_loc8, h.looping, h.scheduleType, h.textureString
|
h.id, n.name_loc0, n.name_loc2, n.name_loc3, n.name_loc6, n.name_loc8, d.description_loc0, d.description_loc2, d.description_loc3, d.description_loc6, d.description_loc8, h.looping, h.scheduleType, h.textureString
|
||||||
FROM
|
FROM
|
||||||
dbc_holidays h
|
dbc_holidays h
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
dbc_holidaynames n ON n.id = h.nameId
|
dbc_holidaynames n ON n.id = h.nameId
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
dbc_holidaydescriptions d ON d.id = h.descriptionId';
|
dbc_holidaydescriptions d ON d.id = h.descriptionId';
|
||||||
|
|
||||||
DB::Aowow()->query($query);
|
DB::Aowow()->query($query);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = ['spellicon', 'itemdisplayinfo'];
|
$reqDBC = ['spellicon', 'itemdisplayinfo'];
|
||||||
|
|
||||||
function icons()
|
function icons()
|
||||||
{
|
{
|
||||||
$baseQuery = '
|
$baseQuery = '
|
||||||
REPLACE INTO
|
REPLACE INTO
|
||||||
?_icons
|
?_icons
|
||||||
SELECT Id, LOWER(SUBSTRING_INDEX(iconPath, "\\\\", -1)) FROM dbc_spellicon
|
SELECT Id, LOWER(SUBSTRING_INDEX(iconPath, "\\\\", -1)) FROM dbc_spellicon
|
||||||
UNION
|
UNION
|
||||||
SELECT -Id, LOWER(inventoryIcon1) FROM dbc_itemdisplayinfo';
|
SELECT -Id, LOWER(inventoryIcon1) FROM dbc_itemdisplayinfo';
|
||||||
|
|
||||||
DB::Aowow()->query($baseQuery);
|
DB::Aowow()->query($baseQuery);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,277 +1,277 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/* deps:
|
/* deps:
|
||||||
* ?_items finalized
|
* ?_items finalized
|
||||||
* ?_spell finalized
|
* ?_spell finalized
|
||||||
* dbc_spellitemenchantment
|
* dbc_spellitemenchantment
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = ['spellitemenchantment'];
|
$reqDBC = ['spellitemenchantment'];
|
||||||
|
|
||||||
class ItemStatSetup extends ItemList
|
class ItemStatSetup extends ItemList
|
||||||
{
|
{
|
||||||
private $statCols = [];
|
private $statCols = [];
|
||||||
|
|
||||||
public function __construct($start, $limit, array $ids, array $enchStats)
|
public function __construct($start, $limit, array $ids, array $enchStats)
|
||||||
{
|
{
|
||||||
$this->statCols = DB::Aowow()->selectCol('SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_NAME` LIKE "%item_stats"');
|
$this->statCols = DB::Aowow()->selectCol('SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_NAME` LIKE "%item_stats"');
|
||||||
$this->queryOpts['i']['o'] = 'i.id ASC';
|
$this->queryOpts['i']['o'] = 'i.id ASC';
|
||||||
unset($this->queryOpts['is']); // do not reference the stats table we are going to write to
|
unset($this->queryOpts['is']); // do not reference the stats table we are going to write to
|
||||||
|
|
||||||
$conditions = array(
|
$conditions = array(
|
||||||
['i.id', $start, '>'],
|
['i.id', $start, '>'],
|
||||||
['class', [ITEM_CLASS_WEAPON, ITEM_CLASS_GEM, ITEM_CLASS_ARMOR, ITEM_CLASS_CONSUMABLE]],
|
['class', [ITEM_CLASS_WEAPON, ITEM_CLASS_GEM, ITEM_CLASS_ARMOR, ITEM_CLASS_CONSUMABLE]],
|
||||||
$limit
|
$limit
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($ids)
|
if ($ids)
|
||||||
$conditions[] = ['id', $ids];
|
$conditions[] = ['id', $ids];
|
||||||
|
|
||||||
parent::__construct($conditions);
|
parent::__construct($conditions);
|
||||||
|
|
||||||
$this->enchParsed = $enchStats;
|
$this->enchParsed = $enchStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function writeStatsTable()
|
public function writeStatsTable()
|
||||||
{
|
{
|
||||||
$enchantments = []; // buffer Ids for lookup id => src; src>0: socketBonus; src<0: gemEnchant
|
$enchantments = []; // buffer Ids for lookup id => src; src>0: socketBonus; src<0: gemEnchant
|
||||||
|
|
||||||
foreach ($this->iterate() as $__)
|
foreach ($this->iterate() as $__)
|
||||||
{
|
{
|
||||||
$this->itemMods[$this->id] = [];
|
$this->itemMods[$this->id] = [];
|
||||||
|
|
||||||
// also occurs as seperate field (gets summed in calculation but not in tooltip)
|
// also occurs as seperate field (gets summed in calculation but not in tooltip)
|
||||||
if ($_ = $this->getField('block'))
|
if ($_ = $this->getField('block'))
|
||||||
$this->itemMods[$this->id][ITEM_MOD_BLOCK_VALUE] = $_;
|
$this->itemMods[$this->id][ITEM_MOD_BLOCK_VALUE] = $_;
|
||||||
|
|
||||||
// convert itemMods to stats
|
// convert itemMods to stats
|
||||||
for ($h = 1; $h <= 10; $h++)
|
for ($h = 1; $h <= 10; $h++)
|
||||||
{
|
{
|
||||||
$mod = $this->curTpl['statType'.$h];
|
$mod = $this->curTpl['statType'.$h];
|
||||||
$val = $this->curTpl['statValue'.$h];
|
$val = $this->curTpl['statValue'.$h];
|
||||||
if (!$mod || !$val)
|
if (!$mod || !$val)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Util::arraySumByKey($this->itemMods[$this->id], [$mod => $val]);
|
Util::arraySumByKey($this->itemMods[$this->id], [$mod => $val]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert spells to stats
|
// convert spells to stats
|
||||||
$equipSpells = [];
|
$equipSpells = [];
|
||||||
for ($h = 1; $h <= 5; $h++)
|
for ($h = 1; $h <= 5; $h++)
|
||||||
{
|
{
|
||||||
if ($this->curTpl['spellId'.$h] <= 0)
|
if ($this->curTpl['spellId'.$h] <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// armor & weapons only onEquip && consumables only onUse
|
// armor & weapons only onEquip && consumables only onUse
|
||||||
if (!(in_array($this->curTpl['class'], [ITEM_CLASS_WEAPON, ITEM_CLASS_ARMOR]) && $this->curTpl['spellTrigger'.$h] == 1) &&
|
if (!(in_array($this->curTpl['class'], [ITEM_CLASS_WEAPON, ITEM_CLASS_ARMOR]) && $this->curTpl['spellTrigger'.$h] == 1) &&
|
||||||
!( $this->curTpl['class'] == ITEM_CLASS_CONSUMABLE && $this->curTpl['spellTrigger'.$h] == 0))
|
!( $this->curTpl['class'] == ITEM_CLASS_CONSUMABLE && $this->curTpl['spellTrigger'.$h] == 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$equipSpells[] = $this->curTpl['spellId'.$h];
|
$equipSpells[] = $this->curTpl['spellId'.$h];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($equipSpells)
|
if ($equipSpells)
|
||||||
{
|
{
|
||||||
$eqpSplList = new SpellList(array(['s.id', $equipSpells]));
|
$eqpSplList = new SpellList(array(['s.id', $equipSpells]));
|
||||||
foreach ($eqpSplList->getStatGain() as $stats)
|
foreach ($eqpSplList->getStatGain() as $stats)
|
||||||
Util::arraySumByKey($this->itemMods[$this->id], $stats);
|
Util::arraySumByKey($this->itemMods[$this->id], $stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare: convert enchantments to stats
|
// prepare: convert enchantments to stats
|
||||||
if (!empty($this->json[$this->id]['socketbonus']))
|
if (!empty($this->json[$this->id]['socketbonus']))
|
||||||
$enchantments[$this->json[$this->id]['socketbonus']][] = $this->id;
|
$enchantments[$this->json[$this->id]['socketbonus']][] = $this->id;
|
||||||
if ($geId = $this->curTpl['gemEnchantmentId'])
|
if ($geId = $this->curTpl['gemEnchantmentId'])
|
||||||
$enchantments[$geId][] = -$this->id;
|
$enchantments[$geId][] = -$this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute: convert enchantments to stats
|
// execute: convert enchantments to stats
|
||||||
// and merge enchantments back
|
// and merge enchantments back
|
||||||
foreach ($enchantments as $eId => $items)
|
foreach ($enchantments as $eId => $items)
|
||||||
{
|
{
|
||||||
if (empty($this->enchParsed[$eId]))
|
if (empty($this->enchParsed[$eId]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
foreach ($items as $item)
|
foreach ($items as $item)
|
||||||
{
|
{
|
||||||
if ($item > 0) // apply socketBonus
|
if ($item > 0) // apply socketBonus
|
||||||
$this->json[$item]['socketbonusstat'] = $this->enchParsed[$eId];
|
$this->json[$item]['socketbonusstat'] = $this->enchParsed[$eId];
|
||||||
else /* if ($item < 0) */ // apply gemEnchantment
|
else /* if ($item < 0) */ // apply gemEnchantment
|
||||||
Util::arraySumByKey($this->json[-$item], $this->enchParsed[$eId]);
|
Util::arraySumByKey($this->json[-$item], $this->enchParsed[$eId]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// collect data and write to DB
|
// collect data and write to DB
|
||||||
foreach ($this->iterate() as $__)
|
foreach ($this->iterate() as $__)
|
||||||
{
|
{
|
||||||
$updateFields = ['type' => TYPE_ITEM, 'typeId' => $this->id];
|
$updateFields = ['type' => TYPE_ITEM, 'typeId' => $this->id];
|
||||||
|
|
||||||
foreach (@$this->json[$this->id] as $k => $v)
|
foreach (@$this->json[$this->id] as $k => $v)
|
||||||
{
|
{
|
||||||
if (!in_array($k, $this->statCols) || !$v || $k == 'id')
|
if (!in_array($k, $this->statCols) || !$v || $k == 'id')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$updateFields[$k] = number_format($v, 2, '.', '');
|
$updateFields[$k] = number_format($v, 2, '.', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->itemMods[$this->id]))
|
if (isset($this->itemMods[$this->id]))
|
||||||
{
|
{
|
||||||
foreach ($this->itemMods[$this->id] as $k => $v)
|
foreach ($this->itemMods[$this->id] as $k => $v)
|
||||||
{
|
{
|
||||||
if (!$v)
|
if (!$v)
|
||||||
continue;
|
continue;
|
||||||
if ($str = Util::$itemMods[$k])
|
if ($str = Util::$itemMods[$k])
|
||||||
$updateFields[$str] = number_format($v, 2, '.', '');
|
$updateFields[$str] = number_format($v, 2, '.', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::Aowow()->query('REPLACE INTO ?_item_stats (?#) VALUES (?a)', array_keys($updateFields), array_values($updateFields));
|
DB::Aowow()->query('REPLACE INTO ?_item_stats (?#) VALUES (?a)', array_keys($updateFields), array_values($updateFields));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function item_stats(array $ids = [])
|
function item_stats(array $ids = [])
|
||||||
{
|
{
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
|
|
||||||
CLISetup::log(' - applying stats for enchantments');
|
CLISetup::log(' - applying stats for enchantments');
|
||||||
$enchStats = enchantment_stats();
|
$enchStats = enchantment_stats();
|
||||||
CLISetup::log(' '.count($enchStats).' enchantments parsed');
|
CLISetup::log(' '.count($enchStats).' enchantments parsed');
|
||||||
CLISetup::log(' - applying stats for items');
|
CLISetup::log(' - applying stats for items');
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
$items = new ItemStatSetup($offset, SqlGen::$stepSize, $ids, $enchStats);
|
$items = new ItemStatSetup($offset, SqlGen::$stepSize, $ids, $enchStats);
|
||||||
if ($items->error)
|
if ($items->error)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
$max = max($items->getFoundIDs());
|
$max = max($items->getFoundIDs());
|
||||||
$num = count($items->getFoundIDs());
|
$num = count($items->getFoundIDs());
|
||||||
|
|
||||||
CLISetup::log(' * sets '.($offset + 1).' - '.($max));
|
CLISetup::log(' * sets '.($offset + 1).' - '.($max));
|
||||||
|
|
||||||
$offset = $max;
|
$offset = $max;
|
||||||
|
|
||||||
$items->writeStatsTable();
|
$items->writeStatsTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function enchantment_stats()
|
function enchantment_stats()
|
||||||
{
|
{
|
||||||
$statCols = DB::Aowow()->selectCol('SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_NAME` LIKE "%item_stats"');
|
$statCols = DB::Aowow()->selectCol('SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_NAME` LIKE "%item_stats"');
|
||||||
$enchants = DB::Aowow()->select('SELECT *, Id AS ARRAY_KEY FROM dbc_spellitemenchantment');
|
$enchants = DB::Aowow()->select('SELECT *, Id AS ARRAY_KEY FROM dbc_spellitemenchantment');
|
||||||
$spells = [];
|
$spells = [];
|
||||||
$spellStats = [];
|
$spellStats = [];
|
||||||
|
|
||||||
foreach ($enchants as $eId => $e)
|
foreach ($enchants as $eId => $e)
|
||||||
{
|
{
|
||||||
for ($i = 1; $i <=3; $i++)
|
for ($i = 1; $i <=3; $i++)
|
||||||
{
|
{
|
||||||
// trigger: onEquip + valid SpellId
|
// trigger: onEquip + valid SpellId
|
||||||
if ($e['object'.$i] > 0 && $e['type'.$i] == 3)
|
if ($e['object'.$i] > 0 && $e['type'.$i] == 3)
|
||||||
$spells[] = $e['object'.$i];
|
$spells[] = $e['object'.$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($spells)
|
if ($spells)
|
||||||
$spellStats = (new SpellList(array(['id', $spells], CFG_SQL_LIMIT_NONE)))->getStatGain();
|
$spellStats = (new SpellList(array(['id', $spells], CFG_SQL_LIMIT_NONE)))->getStatGain();
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($enchants as $eId => $e)
|
foreach ($enchants as $eId => $e)
|
||||||
{
|
{
|
||||||
// parse stats
|
// parse stats
|
||||||
$result[$eId] = [];
|
$result[$eId] = [];
|
||||||
for ($h = 1; $h <= 3; $h++)
|
for ($h = 1; $h <= 3; $h++)
|
||||||
{
|
{
|
||||||
$obj = (int)$e['object'.$h];
|
$obj = (int)$e['object'.$h];
|
||||||
$val = (int)$e['amount'.$h];
|
$val = (int)$e['amount'.$h];
|
||||||
|
|
||||||
switch ($e['type'.$h])
|
switch ($e['type'.$h])
|
||||||
{
|
{
|
||||||
case 6: // TYPE_TOTEM +AmountX as DPS (Rockbiter)
|
case 6: // TYPE_TOTEM +AmountX as DPS (Rockbiter)
|
||||||
$result[$eId]['dps'] = $val; // we do not use dps as itemMod, so apply it directly
|
$result[$eId]['dps'] = $val; // we do not use dps as itemMod, so apply it directly
|
||||||
$obj = null;
|
$obj = null;
|
||||||
break;
|
break;
|
||||||
case 2: // TYPE_DAMAGE +AmountX damage
|
case 2: // TYPE_DAMAGE +AmountX damage
|
||||||
$obj = ITEM_MOD_WEAPON_DMG;
|
$obj = ITEM_MOD_WEAPON_DMG;
|
||||||
break;
|
break;
|
||||||
// case 1: // TYPE_COMBAT_SPELL proc spell from ObjectX (amountX == procChance)
|
// case 1: // TYPE_COMBAT_SPELL proc spell from ObjectX (amountX == procChance)
|
||||||
// case 7: // TYPE_USE_SPELL Engineering gadgets
|
// case 7: // TYPE_USE_SPELL Engineering gadgets
|
||||||
case 3: // TYPE_EQUIP_SPELL Spells from ObjectX (use of amountX?)
|
case 3: // TYPE_EQUIP_SPELL Spells from ObjectX (use of amountX?)
|
||||||
if (!empty($spellStats[$obj]))
|
if (!empty($spellStats[$obj]))
|
||||||
foreach ($spellStats[$obj] as $mod => $val)
|
foreach ($spellStats[$obj] as $mod => $val)
|
||||||
if ($str = Util::$itemMods[$mod])
|
if ($str = Util::$itemMods[$mod])
|
||||||
Util::arraySumByKey($result[$eId], [$str => $val]);
|
Util::arraySumByKey($result[$eId], [$str => $val]);
|
||||||
|
|
||||||
$obj = null;
|
$obj = null;
|
||||||
break;
|
break;
|
||||||
case 4: // TYPE_RESISTANCE +AmountX resistance for ObjectX School
|
case 4: // TYPE_RESISTANCE +AmountX resistance for ObjectX School
|
||||||
switch ($obj)
|
switch ($obj)
|
||||||
{
|
{
|
||||||
case 0: // Physical
|
case 0: // Physical
|
||||||
$obj = ITEM_MOD_ARMOR;
|
$obj = ITEM_MOD_ARMOR;
|
||||||
break;
|
break;
|
||||||
case 1: // Holy
|
case 1: // Holy
|
||||||
$obj = ITEM_MOD_HOLY_RESISTANCE;
|
$obj = ITEM_MOD_HOLY_RESISTANCE;
|
||||||
break;
|
break;
|
||||||
case 2: // Fire
|
case 2: // Fire
|
||||||
$obj = ITEM_MOD_FIRE_RESISTANCE;
|
$obj = ITEM_MOD_FIRE_RESISTANCE;
|
||||||
break;
|
break;
|
||||||
case 3: // Nature
|
case 3: // Nature
|
||||||
$obj = ITEM_MOD_NATURE_RESISTANCE;
|
$obj = ITEM_MOD_NATURE_RESISTANCE;
|
||||||
break;
|
break;
|
||||||
case 4: // Frost
|
case 4: // Frost
|
||||||
$obj = ITEM_MOD_FROST_RESISTANCE;
|
$obj = ITEM_MOD_FROST_RESISTANCE;
|
||||||
break;
|
break;
|
||||||
case 5: // Shadow
|
case 5: // Shadow
|
||||||
$obj = ITEM_MOD_SHADOW_RESISTANCE;
|
$obj = ITEM_MOD_SHADOW_RESISTANCE;
|
||||||
break;
|
break;
|
||||||
case 6: // Arcane
|
case 6: // Arcane
|
||||||
$obj = ITEM_MOD_ARCANE_RESISTANCE;
|
$obj = ITEM_MOD_ARCANE_RESISTANCE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$obj = null;
|
$obj = null;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5: // TYPE_STAT +AmountX for Statistic by type of ObjectX
|
case 5: // TYPE_STAT +AmountX for Statistic by type of ObjectX
|
||||||
if ($obj < 2) // [mana, health] are on [0, 1] respectively and are expected on [1, 2] ..
|
if ($obj < 2) // [mana, health] are on [0, 1] respectively and are expected on [1, 2] ..
|
||||||
$obj++; // 0 is weaponDmg .. ehh .. i messed up somewhere
|
$obj++; // 0 is weaponDmg .. ehh .. i messed up somewhere
|
||||||
|
|
||||||
break; // stats are directly assigned below
|
break; // stats are directly assigned below
|
||||||
case 8: // TYPE_PRISMATIC_SOCKET Extra Sockets AmountX as socketCount (ignore)
|
case 8: // TYPE_PRISMATIC_SOCKET Extra Sockets AmountX as socketCount (ignore)
|
||||||
$result[$eId]['nsockets'] = $val; // there is no itemmod for sockets, so apply it directly
|
$result[$eId]['nsockets'] = $val; // there is no itemmod for sockets, so apply it directly
|
||||||
default: // TYPE_NONE dnd stuff; skip assignment below
|
default: // TYPE_NONE dnd stuff; skip assignment below
|
||||||
$obj = null;
|
$obj = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($obj !== null)
|
if ($obj !== null)
|
||||||
if ($str = Util::$itemMods[$obj]) // check if we use these mods
|
if ($str = Util::$itemMods[$obj]) // check if we use these mods
|
||||||
Util::arraySumByKey($result[$eId], [$str => $val]);
|
Util::arraySumByKey($result[$eId], [$str => $val]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$updateCols = ['type' => TYPE_ENCHANTMENT, 'typeId' => $eId];
|
$updateCols = ['type' => TYPE_ENCHANTMENT, 'typeId' => $eId];
|
||||||
foreach ($result[$eId] as $k => $v)
|
foreach ($result[$eId] as $k => $v)
|
||||||
{
|
{
|
||||||
if (!in_array($k, $statCols) || !$v || $k == 'id')
|
if (!in_array($k, $statCols) || !$v || $k == 'id')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$updateCols[$k] = number_format($v, 2, '.', '');
|
$updateCols[$k] = number_format($v, 2, '.', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::Aowow()->query('REPLACE INTO ?_item_stats (?#) VALUES (?a)', array_keys($updateCols), array_values($updateCols));
|
DB::Aowow()->query('REPLACE INTO ?_item_stats (?#) VALUES (?a)', array_keys($updateCols), array_values($updateCols));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,37 +1,37 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = ['spellitemenchantment'];
|
$reqDBC = ['spellitemenchantment'];
|
||||||
|
|
||||||
function itemenchantment()
|
function itemenchantment()
|
||||||
{
|
{
|
||||||
$baseQuery = '
|
$baseQuery = '
|
||||||
REPLACE INTO
|
REPLACE INTO
|
||||||
?_itemenchantment
|
?_itemenchantment
|
||||||
SELECT
|
SELECT
|
||||||
Id, charges, 0, 0, 0, type1, type2, type3, amount1, amount2, amount3, object1, object2, object3, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, conditionId, skillLine, skillLevel, requiredLevel
|
Id, charges, 0, 0, 0, type1, type2, type3, amount1, amount2, amount3, object1, object2, object3, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, conditionId, skillLine, skillLevel, requiredLevel
|
||||||
FROM
|
FROM
|
||||||
dbc_spellitemenchantment';
|
dbc_spellitemenchantment';
|
||||||
|
|
||||||
DB::Aowow()->query($baseQuery);
|
DB::Aowow()->query($baseQuery);
|
||||||
|
|
||||||
$cuProcs = DB::World()->select('SELECT entry AS ARRAY_KEY, customChance AS procChance, PPMChance AS ppmRate FROM spell_enchant_proc_data');
|
$cuProcs = DB::World()->select('SELECT entry AS ARRAY_KEY, customChance AS procChance, PPMChance AS ppmRate FROM spell_enchant_proc_data');
|
||||||
foreach ($cuProcs as $id => $vals)
|
foreach ($cuProcs as $id => $vals)
|
||||||
DB::Aowow()->query('UPDATE ?_itemenchantment SET ?a WHERE id = ?d', $vals, $id);
|
DB::Aowow()->query('UPDATE ?_itemenchantment SET ?a WHERE id = ?d', $vals, $id);
|
||||||
|
|
||||||
// hide strange stuff
|
// hide strange stuff
|
||||||
DB::Aowow()->query('UPDATE ?_itemenchantment SET cuFlags = ?d WHERE type1 = 0 AND type2 = 0 AND type3 = 0', CUSTOM_EXCLUDE_FOR_LISTVIEW);
|
DB::Aowow()->query('UPDATE ?_itemenchantment SET cuFlags = ?d WHERE type1 = 0 AND type2 = 0 AND type3 = 0', CUSTOM_EXCLUDE_FOR_LISTVIEW);
|
||||||
DB::Aowow()->query('UPDATE ?_itemenchantment SET cuFlags = ?d WHERE name_loc0 LIKE "%test%"', CUSTOM_EXCLUDE_FOR_LISTVIEW);
|
DB::Aowow()->query('UPDATE ?_itemenchantment SET cuFlags = ?d WHERE name_loc0 LIKE "%test%"', CUSTOM_EXCLUDE_FOR_LISTVIEW);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = ['itemrandomsuffix', 'itemrandomproperties'];
|
$reqDBC = ['itemrandomsuffix', 'itemrandomproperties'];
|
||||||
|
|
||||||
function itemrandomenchant()
|
function itemrandomenchant()
|
||||||
{
|
{
|
||||||
$query = '
|
$query = '
|
||||||
REPLACE INTO ?_itemrandomenchant
|
REPLACE INTO ?_itemrandomenchant
|
||||||
SELECT -id, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, nameINT, enchantId1, enchantId2, enchantId3, enchantId4, enchantId5, allocationPct1, allocationPct2, allocationPct3, allocationPct4, allocationPct5 FROM dbc_itemrandomsuffix
|
SELECT -id, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, nameINT, enchantId1, enchantId2, enchantId3, enchantId4, enchantId5, allocationPct1, allocationPct2, allocationPct3, allocationPct4, allocationPct5 FROM dbc_itemrandomsuffix
|
||||||
UNION
|
UNION
|
||||||
SELECT id, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, nameINT, enchantId1, enchantId2, enchantId3, enchantId4, enchantId5, 0, 0, 0, 0, 0 FROM dbc_itemrandomproperties';
|
SELECT id, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, nameINT, enchantId1, enchantId2, enchantId3, enchantId4, enchantId5, 0, 0, 0, 0, 0 FROM dbc_itemrandomproperties';
|
||||||
|
|
||||||
DB::Aowow()->query($query);
|
DB::Aowow()->query($query);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,239 +1,239 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/* deps:
|
/* deps:
|
||||||
* item_template
|
* item_template
|
||||||
* locales_item
|
* locales_item
|
||||||
* spell_group
|
* spell_group
|
||||||
* game_event
|
* game_event
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
33147 => ['class' => 9, 'subClass' => 8], // one stray enchanting recipe .. with a strange icon
|
33147 => ['class' => 9, 'subClass' => 8], // one stray enchanting recipe .. with a strange icon
|
||||||
7948 => ['itemset' => 221], // v unsure if this should be fixed v
|
7948 => ['itemset' => 221], // v unsure if this should be fixed v
|
||||||
7949 => ['itemset' => 221],
|
7949 => ['itemset' => 221],
|
||||||
7950 => ['itemset' => 221],
|
7950 => ['itemset' => 221],
|
||||||
7951 => ['itemset' => 221],
|
7951 => ['itemset' => 221],
|
||||||
7952 => ['itemset' => 221],
|
7952 => ['itemset' => 221],
|
||||||
7953 => ['itemset' => 221]
|
7953 => ['itemset' => 221]
|
||||||
);
|
);
|
||||||
|
|
||||||
$reqDBC = ['gemproperties', 'itemdisplayinfo', 'spell', 'glyphproperties', 'durabilityquality', 'durabilitycosts'];
|
$reqDBC = ['gemproperties', 'itemdisplayinfo', 'spell', 'glyphproperties', 'durabilityquality', 'durabilitycosts'];
|
||||||
|
|
||||||
function items(array $ids = [])
|
function items(array $ids = [])
|
||||||
{
|
{
|
||||||
$baseQuery = '
|
$baseQuery = '
|
||||||
SELECT
|
SELECT
|
||||||
it.entry,
|
it.entry,
|
||||||
class, class as classBak,
|
class, class as classBak,
|
||||||
subclass, subclass AS subClassBak,
|
subclass, subclass AS subClassBak,
|
||||||
IFNULL(sg.id, 0) AS subSubClass,
|
IFNULL(sg.id, 0) AS subSubClass,
|
||||||
name, IFNULL(li.name_loc2, ""), IFNULL(li.name_loc3, ""), IFNULL(li.name_loc6, ""), IFNULL(li.name_loc8, ""),
|
name, IFNULL(li.name_loc2, ""), IFNULL(li.name_loc3, ""), IFNULL(li.name_loc6, ""), IFNULL(li.name_loc8, ""),
|
||||||
displayid,
|
displayid,
|
||||||
Quality,
|
Quality,
|
||||||
Flags, FlagsExtra,
|
Flags, FlagsExtra,
|
||||||
BuyCount, BuyPrice, SellPrice,
|
BuyCount, BuyPrice, SellPrice,
|
||||||
0 AS repairPrice,
|
0 AS repairPrice,
|
||||||
InventoryType AS slot, InventoryType AS slotBak,
|
InventoryType AS slot, InventoryType AS slotBak,
|
||||||
AllowableClass, AllowableRace,
|
AllowableClass, AllowableRace,
|
||||||
ItemLevel,
|
ItemLevel,
|
||||||
RequiredLevel,
|
RequiredLevel,
|
||||||
RequiredSkill, RequiredSkillRank,
|
RequiredSkill, RequiredSkillRank,
|
||||||
requiredspell,
|
requiredspell,
|
||||||
requiredhonorrank,
|
requiredhonorrank,
|
||||||
RequiredCityRank,
|
RequiredCityRank,
|
||||||
RequiredReputationFaction,
|
RequiredReputationFaction,
|
||||||
RequiredReputationRank,
|
RequiredReputationRank,
|
||||||
maxcount,
|
maxcount,
|
||||||
0 AS cuFlags,
|
0 AS cuFlags,
|
||||||
0 AS model,
|
0 AS model,
|
||||||
stackable,
|
stackable,
|
||||||
ContainerSlots,
|
ContainerSlots,
|
||||||
stat_type1, stat_value1,
|
stat_type1, stat_value1,
|
||||||
stat_type2, stat_value2,
|
stat_type2, stat_value2,
|
||||||
stat_type3, stat_value3,
|
stat_type3, stat_value3,
|
||||||
stat_type4, stat_value4,
|
stat_type4, stat_value4,
|
||||||
stat_type5, stat_value5,
|
stat_type5, stat_value5,
|
||||||
stat_type6, stat_value6,
|
stat_type6, stat_value6,
|
||||||
stat_type7, stat_value7,
|
stat_type7, stat_value7,
|
||||||
stat_type8, stat_value8,
|
stat_type8, stat_value8,
|
||||||
stat_type9, stat_value9,
|
stat_type9, stat_value9,
|
||||||
stat_type10, stat_value10,
|
stat_type10, stat_value10,
|
||||||
ScalingStatDistribution,
|
ScalingStatDistribution,
|
||||||
ScalingStatValue,
|
ScalingStatValue,
|
||||||
dmg_min1, dmg_max1, dmg_type1,
|
dmg_min1, dmg_max1, dmg_type1,
|
||||||
dmg_min2, dmg_max2, dmg_type2,
|
dmg_min2, dmg_max2, dmg_type2,
|
||||||
delay,
|
delay,
|
||||||
armor, ArmorDamageModifier,
|
armor, ArmorDamageModifier,
|
||||||
block,
|
block,
|
||||||
holy_res, fire_res, nature_res, frost_res, shadow_res, arcane_res,
|
holy_res, fire_res, nature_res, frost_res, shadow_res, arcane_res,
|
||||||
ammo_type,
|
ammo_type,
|
||||||
RangedModRange,
|
RangedModRange,
|
||||||
spellid_1, spelltrigger_1, spellcharges_1, spellppmRate_1, spellcooldown_1, spellcategory_1, spellcategorycooldown_1,
|
spellid_1, spelltrigger_1, spellcharges_1, spellppmRate_1, spellcooldown_1, spellcategory_1, spellcategorycooldown_1,
|
||||||
spellid_2, spelltrigger_2, spellcharges_2, spellppmRate_2, spellcooldown_2, spellcategory_2, spellcategorycooldown_2,
|
spellid_2, spelltrigger_2, spellcharges_2, spellppmRate_2, spellcooldown_2, spellcategory_2, spellcategorycooldown_2,
|
||||||
spellid_3, spelltrigger_3, spellcharges_3, spellppmRate_3, spellcooldown_3, spellcategory_3, spellcategorycooldown_3,
|
spellid_3, spelltrigger_3, spellcharges_3, spellppmRate_3, spellcooldown_3, spellcategory_3, spellcategorycooldown_3,
|
||||||
spellid_4, spelltrigger_4, spellcharges_4, spellppmRate_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4,
|
spellid_4, spelltrigger_4, spellcharges_4, spellppmRate_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4,
|
||||||
spellid_5, spelltrigger_5, spellcharges_5, spellppmRate_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5,
|
spellid_5, spelltrigger_5, spellcharges_5, spellppmRate_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5,
|
||||||
bonding,
|
bonding,
|
||||||
it.description, IFNULL(li.description_loc2, ""), IFNULL(li.description_loc3, ""), IFNULL(li.description_loc6, ""), IFNULL(li.description_loc8, ""),
|
it.description, IFNULL(li.description_loc2, ""), IFNULL(li.description_loc3, ""), IFNULL(li.description_loc6, ""), IFNULL(li.description_loc8, ""),
|
||||||
PageText,
|
PageText,
|
||||||
LanguageID,
|
LanguageID,
|
||||||
startquest,
|
startquest,
|
||||||
lockid,
|
lockid,
|
||||||
IF(RandomProperty > 0, RandomProperty, -RandomSuffix) AS randomEnchant,
|
IF(RandomProperty > 0, RandomProperty, -RandomSuffix) AS randomEnchant,
|
||||||
itemset,
|
itemset,
|
||||||
MaxDurability,
|
MaxDurability,
|
||||||
area,
|
area,
|
||||||
Map,
|
Map,
|
||||||
BagFamily,
|
BagFamily,
|
||||||
TotemCategory,
|
TotemCategory,
|
||||||
socketColor_1, socketContent_1,
|
socketColor_1, socketContent_1,
|
||||||
socketColor_2, socketContent_2,
|
socketColor_2, socketContent_2,
|
||||||
socketColor_3, socketContent_3,
|
socketColor_3, socketContent_3,
|
||||||
socketBonus,
|
socketBonus,
|
||||||
GemProperties,
|
GemProperties,
|
||||||
RequiredDisenchantSkill,
|
RequiredDisenchantSkill,
|
||||||
DisenchantID,
|
DisenchantID,
|
||||||
duration,
|
duration,
|
||||||
ItemLimitCategory,
|
ItemLimitCategory,
|
||||||
IFNULL(ge.eventEntry, 0),
|
IFNULL(ge.eventEntry, 0),
|
||||||
ScriptName,
|
ScriptName,
|
||||||
FoodType,
|
FoodType,
|
||||||
0 AS gemEnchantmentId,
|
0 AS gemEnchantmentId,
|
||||||
minMoneyLoot, maxMoneyLoot,
|
minMoneyLoot, maxMoneyLoot,
|
||||||
flagsCustom
|
flagsCustom
|
||||||
FROM
|
FROM
|
||||||
item_template it
|
item_template it
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
locales_item li ON li.entry = it.entry
|
locales_item li ON li.entry = it.entry
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
spell_group sg ON sg.spell_id = it.spellid_1 AND it.class = 0 AND it.subclass = 2 AND sg.id IN (1, 2)
|
spell_group sg ON sg.spell_id = it.spellid_1 AND it.class = 0 AND it.subclass = 2 AND sg.id IN (1, 2)
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
game_event ge ON ge.holiday = it.HolidayId AND it.HolidayId > 0
|
game_event ge ON ge.holiday = it.HolidayId AND it.HolidayId > 0
|
||||||
WHERE
|
WHERE
|
||||||
it.entry > ?d
|
it.entry > ?d
|
||||||
{
|
{
|
||||||
AND it.entry IN (?a)
|
AND it.entry IN (?a)
|
||||||
}
|
}
|
||||||
ORDER BY
|
ORDER BY
|
||||||
it.entry ASC
|
it.entry ASC
|
||||||
LIMIT
|
LIMIT
|
||||||
?d';
|
?d';
|
||||||
|
|
||||||
$lastMax = 0;
|
$lastMax = 0;
|
||||||
while ($items = DB::World()->select($baseQuery, $lastMax, $ids ?: DBSIMPLE_SKIP, SqlGen::$stepSize))
|
while ($items = DB::World()->select($baseQuery, $lastMax, $ids ?: DBSIMPLE_SKIP, SqlGen::$stepSize))
|
||||||
{
|
{
|
||||||
$newMax = max(array_column($items, 'entry'));
|
$newMax = max(array_column($items, 'entry'));
|
||||||
|
|
||||||
CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax);
|
CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax);
|
||||||
|
|
||||||
$lastMax = $newMax;
|
$lastMax = $newMax;
|
||||||
|
|
||||||
foreach ($items as $item)
|
foreach ($items as $item)
|
||||||
DB::Aowow()->query('REPLACE INTO ?_items VALUES (?a)', array_values($item));
|
DB::Aowow()->query('REPLACE INTO ?_items VALUES (?a)', array_values($item));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// merge with gemProperties
|
// merge with gemProperties
|
||||||
DB::Aowow()->query('UPDATE ?_items i, dbc_gemproperties gp SET i.gemEnchantmentId = gp.enchantmentId, i.gemColorMask = gp.colorMask WHERE i.gemColorMask = gp.id');
|
DB::Aowow()->query('UPDATE ?_items i, dbc_gemproperties gp SET i.gemEnchantmentId = gp.enchantmentId, i.gemColorMask = gp.colorMask WHERE i.gemColorMask = gp.id');
|
||||||
|
|
||||||
// get modelString
|
// get modelString
|
||||||
DB::Aowow()->query('UPDATE ?_items i, dbc_itemdisplayinfo idi SET i.model = IF(idi.leftModelName = "", idi.rightModelName, idi.leftModelName) WHERE i.displayId = idi.id');
|
DB::Aowow()->query('UPDATE ?_items i, dbc_itemdisplayinfo idi SET i.model = IF(idi.leftModelName = "", idi.rightModelName, idi.leftModelName) WHERE i.displayId = idi.id');
|
||||||
|
|
||||||
// unify slots: Robes => Chest; Ranged (right) => Ranged
|
// unify slots: Robes => Chest; Ranged (right) => Ranged
|
||||||
DB::Aowow()->query('UPDATE ?_items SET slot = 15 WHERE slotbak = 26');
|
DB::Aowow()->query('UPDATE ?_items SET slot = 15 WHERE slotbak = 26');
|
||||||
DB::Aowow()->query('UPDATE ?_items SET slot = 5 WHERE slotbak = 20');
|
DB::Aowow()->query('UPDATE ?_items SET slot = 5 WHERE slotbak = 20');
|
||||||
|
|
||||||
// custom sub-classes
|
// custom sub-classes
|
||||||
DB::Aowow()->query('
|
DB::Aowow()->query('
|
||||||
UPDATE ?_items SET subclass = IF(
|
UPDATE ?_items SET subclass = IF(
|
||||||
slotbak = 4, -8, IF( -- shirt
|
slotbak = 4, -8, IF( -- shirt
|
||||||
slotbak = 19, -7, IF( -- tabard
|
slotbak = 19, -7, IF( -- tabard
|
||||||
slotbak = 16, -6, IF( -- cloak
|
slotbak = 16, -6, IF( -- cloak
|
||||||
slotbak = 23, -5, IF( -- held in offhand
|
slotbak = 23, -5, IF( -- held in offhand
|
||||||
slotbak = 12, -4, IF( -- trinket
|
slotbak = 12, -4, IF( -- trinket
|
||||||
slotbak = 2, -3, IF( -- amulet
|
slotbak = 2, -3, IF( -- amulet
|
||||||
slotbak = 11, -2, subClassBak -- ring
|
slotbak = 11, -2, subClassBak -- ring
|
||||||
))))))) WHERE class = 4');
|
))))))) WHERE class = 4');
|
||||||
|
|
||||||
// move alchemist stones to trinkets (Armor)
|
// move alchemist stones to trinkets (Armor)
|
||||||
DB::Aowow()->query('UPDATE ?_items SET class = 4, subClass = -4 WHERE classBak = 7 AND subClassBak = 11 AND slotBak = 12');
|
DB::Aowow()->query('UPDATE ?_items SET class = 4, subClass = -4 WHERE classBak = 7 AND subClassBak = 11 AND slotBak = 12');
|
||||||
|
|
||||||
// mark keys as key (if not quest items)
|
// mark keys as key (if not quest items)
|
||||||
DB::Aowow()->query('UPDATE ?_items SET class = 13, subClass = 0 WHERE classBak IN (0, 15) AND bagFamily & 0x100');
|
DB::Aowow()->query('UPDATE ?_items SET class = 13, subClass = 0 WHERE classBak IN (0, 15) AND bagFamily & 0x100');
|
||||||
|
|
||||||
// set subSubClass for Glyphs (major/minor)
|
// set subSubClass for Glyphs (major/minor)
|
||||||
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s, dbc_glyphproperties gp SET i.subSubClass = IF(gp.typeFlags & 0x1, 2, 1) WHERE i.spellId1 = s.id AND s.effect1MiscValue = gp.id AND i.classBak = 16');
|
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s, dbc_glyphproperties gp SET i.subSubClass = IF(gp.typeFlags & 0x1, 2, 1) WHERE i.spellId1 = s.id AND s.effect1MiscValue = gp.id AND i.classBak = 16');
|
||||||
|
|
||||||
// filter misc(class:15) junk(subclass:0) to appropriate categories
|
// filter misc(class:15) junk(subclass:0) to appropriate categories
|
||||||
|
|
||||||
// assign pets and mounts to category
|
// assign pets and mounts to category
|
||||||
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s SET subClass = IF(effect1AuraId <> 78, 2, IF(effect2AuraId = 207 OR effect3AuraId = 207 OR (s.id <> 65917 AND effect2AuraId = 4 AND effect3Id = 77), -7, 5)) WHERE s.id = spellId2 AND class = 15 AND spellId1 IN (483, 55884)');
|
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s SET subClass = IF(effect1AuraId <> 78, 2, IF(effect2AuraId = 207 OR effect3AuraId = 207 OR (s.id <> 65917 AND effect2AuraId = 4 AND effect3Id = 77), -7, 5)) WHERE s.id = spellId2 AND class = 15 AND spellId1 IN (483, 55884)');
|
||||||
|
|
||||||
// more corner cases (mounts that are not actualy learned)
|
// more corner cases (mounts that are not actualy learned)
|
||||||
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s SET i.subClass = -7 WHERE (effect1Id = 64 OR (effect1AuraId = 78 AND effect2AuraId = 4 AND effect3Id = 77) OR effect1AuraId = 207 OR effect2AuraId = 207 OR effect3AuraId = 207) AND s.id = i.spellId1 AND i.class = 15 AND i.subClass = 5');
|
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s SET i.subClass = -7 WHERE (effect1Id = 64 OR (effect1AuraId = 78 AND effect2AuraId = 4 AND effect3Id = 77) OR effect1AuraId = 207 OR effect2AuraId = 207 OR effect3AuraId = 207) AND s.id = i.spellId1 AND i.class = 15 AND i.subClass = 5');
|
||||||
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s SET i.subClass = 5 WHERE s.effect1AuraId = 78 AND s.id = i.spellId1 AND i.class = 15 AND i.subClass = 0');
|
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s SET i.subClass = 5 WHERE s.effect1AuraId = 78 AND s.id = i.spellId1 AND i.class = 15 AND i.subClass = 0');
|
||||||
|
|
||||||
// move some permanent enchantments to own category
|
// move some permanent enchantments to own category
|
||||||
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s SET i.class = 0, i.subClass = 6 WHERE s.effect1Id = 53 AND s.id = i.spellId1 AND i.class = 15');
|
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s SET i.class = 0, i.subClass = 6 WHERE s.effect1Id = 53 AND s.id = i.spellId1 AND i.class = 15');
|
||||||
|
|
||||||
// move temporary enchantments to own category
|
// move temporary enchantments to own category
|
||||||
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s SET i.subClass = -3 WHERE s.effect1Id = 54 AND s.id = i.spellId1 AND i.class = 0 AND i.subClassBak = 8');
|
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s SET i.subClass = -3 WHERE s.effect1Id = 54 AND s.id = i.spellId1 AND i.class = 0 AND i.subClassBak = 8');
|
||||||
|
|
||||||
// move armor tokens to own category
|
// move armor tokens to own category
|
||||||
DB::Aowow()->query('UPDATE ?_items SET subClass = -2 WHERE quality = 4 AND class = 15 AND subClassBak = 0 AND requiredClass AND (requiredClass & 0x5FF) <> 0x5FF');
|
DB::Aowow()->query('UPDATE ?_items SET subClass = -2 WHERE quality = 4 AND class = 15 AND subClassBak = 0 AND requiredClass AND (requiredClass & 0x5FF) <> 0x5FF');
|
||||||
|
|
||||||
// move some junk to holiday if it requires one
|
// move some junk to holiday if it requires one
|
||||||
DB::Aowow()->query('UPDATE ?_items SET subClass = 3 WHERE classBak = 15 AND subClassBak = 0 AND eventId <> 0');
|
DB::Aowow()->query('UPDATE ?_items SET subClass = 3 WHERE classBak = 15 AND subClassBak = 0 AND eventId <> 0');
|
||||||
|
|
||||||
// move misc items that start quests to class: quest (except Sayges scrolls for consistency)
|
// move misc items that start quests to class: quest (except Sayges scrolls for consistency)
|
||||||
DB::Aowow()->query('UPDATE ?_items SET class = 12 WHERE classBak = 15 AND startQuest <> 0 AND name_loc0 NOT LIKE "sayge\'s fortune%"');
|
DB::Aowow()->query('UPDATE ?_items SET class = 12 WHERE classBak = 15 AND startQuest <> 0 AND name_loc0 NOT LIKE "sayge\'s fortune%"');
|
||||||
|
|
||||||
// move perm. enchantments into appropriate cat/subcat
|
// move perm. enchantments into appropriate cat/subcat
|
||||||
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s SET i.class = 0, i.subClass = 6 WHERE s.Id = i.spellId1 AND s.effect1Id = 53 AND i.classBak = 12');
|
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s SET i.class = 0, i.subClass = 6 WHERE s.Id = i.spellId1 AND s.effect1Id = 53 AND i.classBak = 12');
|
||||||
|
|
||||||
// move some generic recipes into appropriate sub-categories
|
// move some generic recipes into appropriate sub-categories
|
||||||
$skillz = array(
|
$skillz = array(
|
||||||
773 => 11, // inscription
|
773 => 11, // inscription
|
||||||
356 => 9, // fishing
|
356 => 9, // fishing
|
||||||
186 => 12, // mining
|
186 => 12, // mining
|
||||||
185 => 5, // cooking
|
185 => 5, // cooking
|
||||||
171 => 6 // alchemy
|
171 => 6 // alchemy
|
||||||
|
|
||||||
);
|
);
|
||||||
foreach ($skillz as $skill => $cat)
|
foreach ($skillz as $skill => $cat)
|
||||||
DB::Aowow()->query('UPDATE ?_items SET subClass = ?d WHERE classBak = 9 AND subClassBak = 0 AND requiredSkill = ?d', $cat, $skill);
|
DB::Aowow()->query('UPDATE ?_items SET subClass = ?d WHERE classBak = 9 AND subClassBak = 0 AND requiredSkill = ?d', $cat, $skill);
|
||||||
|
|
||||||
// calculate durabilityCosts
|
// calculate durabilityCosts
|
||||||
DB::Aowow()->query('
|
DB::Aowow()->query('
|
||||||
UPDATE
|
UPDATE
|
||||||
?_items i
|
?_items i
|
||||||
JOIN
|
JOIN
|
||||||
dbc_durabilityquality dq ON dq.id = ((i.quality + 1) * 2)
|
dbc_durabilityquality dq ON dq.id = ((i.quality + 1) * 2)
|
||||||
JOIN
|
JOIN
|
||||||
dbc_durabilitycosts dc ON dc.id = i.itemLevel
|
dbc_durabilitycosts dc ON dc.id = i.itemLevel
|
||||||
SET
|
SET
|
||||||
i.repairPrice = (durability* dq.mod * IF(i.classBak = 2,
|
i.repairPrice = (durability* dq.mod * IF(i.classBak = 2,
|
||||||
CASE i.subClassBak
|
CASE i.subClassBak
|
||||||
WHEN 0 THEN w0 WHEN 1 THEN w1 WHEN 2 THEN w2 WHEN 3 THEN w3 WHEN 4 THEN w4
|
WHEN 0 THEN w0 WHEN 1 THEN w1 WHEN 2 THEN w2 WHEN 3 THEN w3 WHEN 4 THEN w4
|
||||||
WHEN 5 THEN w5 WHEN 6 THEN w6 WHEN 7 THEN w7 WHEN 8 THEN w8 WHEN 10 THEN w10
|
WHEN 5 THEN w5 WHEN 6 THEN w6 WHEN 7 THEN w7 WHEN 8 THEN w8 WHEN 10 THEN w10
|
||||||
WHEN 11 THEN w11 WHEN 12 THEN w12 WHEN 13 THEN w13 WHEN 14 THEN w14 WHEN 15 THEN w15
|
WHEN 11 THEN w11 WHEN 12 THEN w12 WHEN 13 THEN w13 WHEN 14 THEN w14 WHEN 15 THEN w15
|
||||||
WHEN 16 THEN w16 WHEN 17 THEN w17 WHEN 18 THEN w18 WHEN 19 THEN w19 WHEN 20 THEN w20
|
WHEN 16 THEN w16 WHEN 17 THEN w17 WHEN 18 THEN w18 WHEN 19 THEN w19 WHEN 20 THEN w20
|
||||||
END,
|
END,
|
||||||
CASE i.subClassBak
|
CASE i.subClassBak
|
||||||
WHEN 1 THEN a1 WHEN 2 THEN a2 WHEN 3 THEN a3 WHEN 4 THEN a4 WHEN 6 THEN a6
|
WHEN 1 THEN a1 WHEN 2 THEN a2 WHEN 3 THEN a3 WHEN 4 THEN a4 WHEN 6 THEN a6
|
||||||
END
|
END
|
||||||
))
|
))
|
||||||
WHERE
|
WHERE
|
||||||
durability > 0 AND ((classBak = 4 AND subClassBak IN (1, 2, 3, 4, 6)) OR (classBak = 2 AND subClassBak <> 9))');
|
durability > 0 AND ((classBak = 4 AND subClassBak IN (1, 2, 3, 4, 6)) OR (classBak = 2 AND subClassBak <> 9))');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,370 +1,370 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
note: the virtual set-ids wont match the ones of wowhead
|
note: the virtual set-ids wont match the ones of wowhead
|
||||||
since there are some unused itemsets and and items flying around in a default database this script will create about 20 sets more than you'd expect.
|
since there are some unused itemsets and and items flying around in a default database this script will create about 20 sets more than you'd expect.
|
||||||
|
|
||||||
and i have no idea how to merge the prefixes/suffixes for wotlk-raidsets and arena-sets in gereral onto the name.. at least not for all locales and i'll be damned if i have to skip one
|
and i have no idea how to merge the prefixes/suffixes for wotlk-raidsets and arena-sets in gereral onto the name.. at least not for all locales and i'll be damned if i have to skip one
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* deps:
|
/* deps:
|
||||||
* item_template
|
* item_template
|
||||||
* game_event
|
* game_event
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
221 => ['item1' => 7948, 'item2' => 7949, 'item3' => 7950, 'item4' => 7951, 'item5' => 7952, 'item6' => 7953]
|
221 => ['item1' => 7948, 'item2' => 7949, 'item3' => 7950, 'item4' => 7951, 'item5' => 7952, 'item6' => 7953]
|
||||||
);
|
);
|
||||||
$reqDBC = ['itemset'];
|
$reqDBC = ['itemset'];
|
||||||
|
|
||||||
function itemset()
|
function itemset()
|
||||||
{
|
{
|
||||||
$setToHoliday = array (
|
$setToHoliday = array (
|
||||||
761 => 141, // Winterveil
|
761 => 141, // Winterveil
|
||||||
762 => 372, // Brewfest
|
762 => 372, // Brewfest
|
||||||
785 => 341, // Midsummer
|
785 => 341, // Midsummer
|
||||||
812 => 181, // Noblegarden
|
812 => 181, // Noblegarden
|
||||||
);
|
);
|
||||||
|
|
||||||
// find events associated with holidayIds
|
// find events associated with holidayIds
|
||||||
if ($pairs = DB::World()->selectCol('SELECT holiday AS ARRAY_KEY, eventEntry FROM game_event WHERE holiday IN (?a)', array_values($setToHoliday)))
|
if ($pairs = DB::World()->selectCol('SELECT holiday AS ARRAY_KEY, eventEntry FROM game_event WHERE holiday IN (?a)', array_values($setToHoliday)))
|
||||||
foreach ($setToHoliday as &$hId)
|
foreach ($setToHoliday as &$hId)
|
||||||
$hId = !empty($pairs[$hId]) ? $pairs[$hId] : 0;
|
$hId = !empty($pairs[$hId]) ? $pairs[$hId] : 0;
|
||||||
|
|
||||||
// tags where refId == virtualId
|
// tags where refId == virtualId
|
||||||
// in pve sets are not recycled beyond the contentGroup
|
// in pve sets are not recycled beyond the contentGroup
|
||||||
$tagsById = array(
|
$tagsById = array(
|
||||||
// "Dungeon Set 1"
|
// "Dungeon Set 1"
|
||||||
1 => [181, 182, 183, 184, 185, 186, 187, 188, 189],
|
1 => [181, 182, 183, 184, 185, 186, 187, 188, 189],
|
||||||
// "Dungeon Set 2"
|
// "Dungeon Set 2"
|
||||||
2 => [511, 512, 513, 514, 515, 516, 517, 518, 519],
|
2 => [511, 512, 513, 514, 515, 516, 517, 518, 519],
|
||||||
// "Tier 1 Raid Set"
|
// "Tier 1 Raid Set"
|
||||||
3 => [201, 202, 203, 204, 205, 206, 207, 208, 209],
|
3 => [201, 202, 203, 204, 205, 206, 207, 208, 209],
|
||||||
// "Tier 2 Raid Set"
|
// "Tier 2 Raid Set"
|
||||||
4 => [210, 211, 212, 213, 214, 215, 216, 217, 218],
|
4 => [210, 211, 212, 213, 214, 215, 216, 217, 218],
|
||||||
// "Tier 3 Raid Set"
|
// "Tier 3 Raid Set"
|
||||||
5 => [521, 523, 524, 525, 526, 527, 528, 529, 530],
|
5 => [521, 523, 524, 525, 526, 527, 528, 529, 530],
|
||||||
// "Level 60 PvP Rare Set"
|
// "Level 60 PvP Rare Set"
|
||||||
6 => [522, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 697, 718],
|
6 => [522, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 697, 718],
|
||||||
// "Level 60 PvP Rare Set (Old)"
|
// "Level 60 PvP Rare Set (Old)"
|
||||||
7 => [281, 282, 301, 341, 342, 343, 344, 345, 346, 347, 348, 361, 362, 381, 382, 401],
|
7 => [281, 282, 301, 341, 342, 343, 344, 345, 346, 347, 348, 361, 362, 381, 382, 401],
|
||||||
// "Level 60 PvP Epic Set"
|
// "Level 60 PvP Epic Set"
|
||||||
8 => [383, 384, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 402, 717, 698],
|
8 => [383, 384, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 402, 717, 698],
|
||||||
// "Ruins of Ahn'Qiraj Set"
|
// "Ruins of Ahn'Qiraj Set"
|
||||||
9 => [494, 495, 498, 500, 502, 504, 506, 508, 510],
|
9 => [494, 495, 498, 500, 502, 504, 506, 508, 510],
|
||||||
// "Temple of Ahn'Qiraj Set"
|
// "Temple of Ahn'Qiraj Set"
|
||||||
10 => [493, 496, 497, 499, 501, 503, 505, 507, 509],
|
10 => [493, 496, 497, 499, 501, 503, 505, 507, 509],
|
||||||
// "Zul'Gurub Set"
|
// "Zul'Gurub Set"
|
||||||
11 => [477, 480, 474, 475, 476, 478, 479, 481, 482],
|
11 => [477, 480, 474, 475, 476, 478, 479, 481, 482],
|
||||||
// "Tier 4 Raid Set"
|
// "Tier 4 Raid Set"
|
||||||
12 => [621, 624, 625, 626, 631, 632, 633, 638, 639, 640, 645, 648, 651, 654, 655, 663, 664],
|
12 => [621, 624, 625, 626, 631, 632, 633, 638, 639, 640, 645, 648, 651, 654, 655, 663, 664],
|
||||||
// "Tier 5 Raid Set",
|
// "Tier 5 Raid Set",
|
||||||
13 => [622, 627, 628, 629, 634, 635, 636, 641, 642, 643, 646, 649, 652, 656, 657, 665, 666],
|
13 => [622, 627, 628, 629, 634, 635, 636, 641, 642, 643, 646, 649, 652, 656, 657, 665, 666],
|
||||||
// "Dungeon Set 3",
|
// "Dungeon Set 3",
|
||||||
14 => [620, 623, 630, 637, 644, 647, 650, 653, 658, 659, 660, 661, 662],
|
14 => [620, 623, 630, 637, 644, 647, 650, 653, 658, 659, 660, 661, 662],
|
||||||
// "Arathi Basin Set",
|
// "Arathi Basin Set",
|
||||||
15 => [467, 468, 469, 470, 471, 472, 473, 483, 484, 485, 486, 487, 488, 908],
|
15 => [467, 468, 469, 470, 471, 472, 473, 483, 484, 485, 486, 487, 488, 908],
|
||||||
// "Level 70 PvP Rare Set",
|
// "Level 70 PvP Rare Set",
|
||||||
16 => [587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 688, 689, 691, 692, 693, 694, 695, 696],
|
16 => [587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 688, 689, 691, 692, 693, 694, 695, 696],
|
||||||
// "Tier 6 Raid Set",
|
// "Tier 6 Raid Set",
|
||||||
18 => [668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684],
|
18 => [668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684],
|
||||||
// "Level 70 PvP Rare Set 2",
|
// "Level 70 PvP Rare Set 2",
|
||||||
21 => [738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752],
|
21 => [738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752],
|
||||||
// "Tier 7 Raid Set",
|
// "Tier 7 Raid Set",
|
||||||
23 => [795, 805, 804, 803, 802, 801, 800, 799, 798, 797, 796, 794, 793, 792, 791, 790, 789, 788, 787],
|
23 => [795, 805, 804, 803, 802, 801, 800, 799, 798, 797, 796, 794, 793, 792, 791, 790, 789, 788, 787],
|
||||||
// "Tier 8 Raid Set",
|
// "Tier 8 Raid Set",
|
||||||
25 => [838, 837, 836, 835, 834, 833, 832, 831, 830, 829, 828, 827, 826, 825, 824, 823, 822, 821, 820],
|
25 => [838, 837, 836, 835, 834, 833, 832, 831, 830, 829, 828, 827, 826, 825, 824, 823, 822, 821, 820],
|
||||||
// "Tier 9 Raid Set",
|
// "Tier 9 Raid Set",
|
||||||
27 => [880, 879, 878, 877, 876, 875, 874, 873, 872, 871, 870, 869, 868, 867, 866, 865, 864, 863, 862, 861, 860, 859, 858, 857, 856, 855, 854, 853, 852, 851, 850, 849, 848, 847, 846, 845, 844, 843],
|
27 => [880, 879, 878, 877, 876, 875, 874, 873, 872, 871, 870, 869, 868, 867, 866, 865, 864, 863, 862, 861, 860, 859, 858, 857, 856, 855, 854, 853, 852, 851, 850, 849, 848, 847, 846, 845, 844, 843],
|
||||||
// "Tier 10 Raid Set",
|
// "Tier 10 Raid Set",
|
||||||
29 => [901, 900, 899, 898, 897, 896, 895, 894, 893, 892, 891, 890, 889, 888, 887, 886, 885, 884, 883]
|
29 => [901, 900, 899, 898, 897, 896, 895, 894, 893, 892, 891, 890, 889, 888, 887, 886, 885, 884, 883]
|
||||||
);
|
);
|
||||||
|
|
||||||
// well .. fuck
|
// well .. fuck
|
||||||
$tagsByNamePart = array(
|
$tagsByNamePart = array(
|
||||||
17 => ['gladiator'], // "Arena Season 1 Set",
|
17 => ['gladiator'], // "Arena Season 1 Set",
|
||||||
19 => ['merciless'], // "Arena Season 2 Set",
|
19 => ['merciless'], // "Arena Season 2 Set",
|
||||||
20 => ['vengeful'], // "Arena Season 3 Set",
|
20 => ['vengeful'], // "Arena Season 3 Set",
|
||||||
22 => ['brutal'], // "Arena Season 4 Set",
|
22 => ['brutal'], // "Arena Season 4 Set",
|
||||||
24 => ['deadly', 'hateful', 'savage'], // "Arena Season 5 Set",
|
24 => ['deadly', 'hateful', 'savage'], // "Arena Season 5 Set",
|
||||||
26 => ['furious'], // "Arena Season 6 Set",
|
26 => ['furious'], // "Arena Season 6 Set",
|
||||||
28 => ['relentless'], // "Arena Season 7 Set",
|
28 => ['relentless'], // "Arena Season 7 Set",
|
||||||
30 => ['wrathful'] // "Arena Season 8 Set",
|
30 => ['wrathful'] // "Arena Season 8 Set",
|
||||||
);
|
);
|
||||||
|
|
||||||
DB::Aowow()->query('TRUNCATE TABLE ?_itemset');
|
DB::Aowow()->query('TRUNCATE TABLE ?_itemset');
|
||||||
|
|
||||||
$vIdx = 0;
|
$vIdx = 0;
|
||||||
$virtualId = 0;
|
$virtualId = 0;
|
||||||
$sets = DB::Aowow()->select('SELECT *, id AS ARRAY_KEY FROM dbc_itemset');
|
$sets = DB::Aowow()->select('SELECT *, id AS ARRAY_KEY FROM dbc_itemset');
|
||||||
foreach ($sets as $setId => $setData)
|
foreach ($sets as $setId => $setData)
|
||||||
{
|
{
|
||||||
$spells = $items = $mods = $descText = $name = $gains = [];
|
$spells = $items = $mods = $descText = $name = $gains = [];
|
||||||
$max = $reqLvl = $min = $quality = $heroic = $nPieces = [];
|
$max = $reqLvl = $min = $quality = $heroic = $nPieces = [];
|
||||||
$classMask = $type = 0;
|
$classMask = $type = 0;
|
||||||
$hasRing = false;
|
$hasRing = false;
|
||||||
|
|
||||||
$holiday = isset($setToHoliday[$setId]) ? $setToHoliday[$setId] : 0;
|
$holiday = isset($setToHoliday[$setId]) ? $setToHoliday[$setId] : 0;
|
||||||
$canReuse = !$holiday; // can't reuse holiday-sets
|
$canReuse = !$holiday; // can't reuse holiday-sets
|
||||||
$slotList = [];
|
$slotList = [];
|
||||||
$pieces = DB::World()->select('SELECT *, IF(InventoryType = 15, 26, IF(InventoryType = 5, 20, InventoryType)) AS slot, entry AS ARRAY_KEY FROM item_template WHERE itemset = ?d AND (class <> 4 OR subclass NOT IN (1, 2, 3, 4) OR armor > 0 OR Quality = 1) ORDER BY itemLevel, subclass, slot ASC', $setId);
|
$pieces = DB::World()->select('SELECT *, IF(InventoryType = 15, 26, IF(InventoryType = 5, 20, InventoryType)) AS slot, entry AS ARRAY_KEY FROM item_template WHERE itemset = ?d AND (class <> 4 OR subclass NOT IN (1, 2, 3, 4) OR armor > 0 OR Quality = 1) ORDER BY itemLevel, subclass, slot ASC', $setId);
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
/* determine type and reuse from pieces */
|
/* determine type and reuse from pieces */
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
|
||||||
// make the first vId always same as setId
|
// make the first vId always same as setId
|
||||||
$firstPiece = reset($pieces);
|
$firstPiece = reset($pieces);
|
||||||
$tmp = [$firstPiece['Quality'].$firstPiece['ItemLevel'] => $setId];
|
$tmp = [$firstPiece['Quality'].$firstPiece['ItemLevel'] => $setId];
|
||||||
|
|
||||||
// walk through all items associated with the set
|
// walk through all items associated with the set
|
||||||
foreach ($pieces as $itemId => $piece)
|
foreach ($pieces as $itemId => $piece)
|
||||||
{
|
{
|
||||||
$classMask |= ($piece['AllowableClass'] & CLASS_MASK_ALL);
|
$classMask |= ($piece['AllowableClass'] & CLASS_MASK_ALL);
|
||||||
$key = $piece['Quality'].str_pad($piece['ItemLevel'], 3, 0, STR_PAD_LEFT);
|
$key = $piece['Quality'].str_pad($piece['ItemLevel'], 3, 0, STR_PAD_LEFT);
|
||||||
|
|
||||||
if (!isset($tmp[$key]))
|
if (!isset($tmp[$key]))
|
||||||
$tmp[$key] = --$vIdx;
|
$tmp[$key] = --$vIdx;
|
||||||
|
|
||||||
$vId = $tmp[$key];
|
$vId = $tmp[$key];
|
||||||
|
|
||||||
// check only actual armor in rare quality or higher (or inherits holiday)
|
// check only actual armor in rare quality or higher (or inherits holiday)
|
||||||
if ($piece['class'] != ITEM_CLASS_ARMOR || $piece['subclass'] == 0)
|
if ($piece['class'] != ITEM_CLASS_ARMOR || $piece['subclass'] == 0)
|
||||||
$canReuse = false;
|
$canReuse = false;
|
||||||
|
|
||||||
/* gather relevant stats for use */
|
/* gather relevant stats for use */
|
||||||
|
|
||||||
if (!isset($quality[$vId]) || $piece['Quality'] > $quality[$vId])
|
if (!isset($quality[$vId]) || $piece['Quality'] > $quality[$vId])
|
||||||
$quality[$vId] = $piece['Quality'];
|
$quality[$vId] = $piece['Quality'];
|
||||||
|
|
||||||
if ($piece['Flags'] & ITEM_FLAG_HEROIC)
|
if ($piece['Flags'] & ITEM_FLAG_HEROIC)
|
||||||
$heroic[$vId] = true;
|
$heroic[$vId] = true;
|
||||||
|
|
||||||
if (!isset($reqLvl[$vId]) || $piece['RequiredLevel'] > $reqLvl[$vId])
|
if (!isset($reqLvl[$vId]) || $piece['RequiredLevel'] > $reqLvl[$vId])
|
||||||
$reqLvl[$vId] = $piece['RequiredLevel'];
|
$reqLvl[$vId] = $piece['RequiredLevel'];
|
||||||
|
|
||||||
if (!isset($min[$vId]) || $piece['ItemLevel'] < $min[$vId])
|
if (!isset($min[$vId]) || $piece['ItemLevel'] < $min[$vId])
|
||||||
$min[$vId] = $piece['ItemLevel'];
|
$min[$vId] = $piece['ItemLevel'];
|
||||||
|
|
||||||
if (!isset($max[$vId]) || $piece['ItemLevel'] > $max[$vId])
|
if (!isset($max[$vId]) || $piece['ItemLevel'] > $max[$vId])
|
||||||
$max[$vId] = $piece['ItemLevel'];
|
$max[$vId] = $piece['ItemLevel'];
|
||||||
|
|
||||||
if (!isset($items[$vId][$piece['slot']]) || !$canReuse)
|
if (!isset($items[$vId][$piece['slot']]) || !$canReuse)
|
||||||
{
|
{
|
||||||
if (!isset($nPieces[$vId]))
|
if (!isset($nPieces[$vId]))
|
||||||
$nPieces[$vId] = 1;
|
$nPieces[$vId] = 1;
|
||||||
else
|
else
|
||||||
$nPieces[$vId]++;
|
$nPieces[$vId]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($items[$vId][$piece['slot']]))
|
if (isset($items[$vId][$piece['slot']]))
|
||||||
{
|
{
|
||||||
// not reusable -> insert anyway on unique keys
|
// not reusable -> insert anyway on unique keys
|
||||||
if (!$canReuse)
|
if (!$canReuse)
|
||||||
$items[$vId][$piece['slot'].$itemId] = $itemId;
|
$items[$vId][$piece['slot'].$itemId] = $itemId;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLISetup::log("set: ".$setId." ilvl: ".$piece['ItemLevel']." - conflict between item: ".$items[$vId][$piece['slot']]." and item: ".$itemId." choosing lower itemId", CLISetup::LOG_WARN);
|
CLISetup::log("set: ".$setId." ilvl: ".$piece['ItemLevel']." - conflict between item: ".$items[$vId][$piece['slot']]." and item: ".$itemId." choosing lower itemId", CLISetup::LOG_WARN);
|
||||||
|
|
||||||
if ($items[$vId][$piece['slot']] > $itemId)
|
if ($items[$vId][$piece['slot']] > $itemId)
|
||||||
$items[$vId][$piece['slot']] = $itemId;
|
$items[$vId][$piece['slot']] = $itemId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$items[$vId][$piece['slot']] = $itemId;
|
$items[$vId][$piece['slot']] = $itemId;
|
||||||
|
|
||||||
/* check for type */
|
/* check for type */
|
||||||
|
|
||||||
// skip cloaks, they mess with armor classes
|
// skip cloaks, they mess with armor classes
|
||||||
if ($piece['slot'] == 16)
|
if ($piece['slot'] == 16)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip event-sets
|
// skip event-sets
|
||||||
if ($piece['Quality'] == 1)
|
if ($piece['Quality'] == 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ($piece['class'] == 2 && $piece['subclass'] == 0)
|
if ($piece['class'] == 2 && $piece['subclass'] == 0)
|
||||||
$type = 8; // 1H-Axe
|
$type = 8; // 1H-Axe
|
||||||
else if ($piece['class'] == 2 && $piece['subclass'] == 4)
|
else if ($piece['class'] == 2 && $piece['subclass'] == 4)
|
||||||
$type = 9; // 1H-Mace
|
$type = 9; // 1H-Mace
|
||||||
else if ($piece['class'] == 2 && $piece['subclass'] == 7)
|
else if ($piece['class'] == 2 && $piece['subclass'] == 7)
|
||||||
$type = 10; // 1H-Sword
|
$type = 10; // 1H-Sword
|
||||||
else if ($piece['class'] == 2 && $piece['subclass'] == 13)
|
else if ($piece['class'] == 2 && $piece['subclass'] == 13)
|
||||||
$type = 7; // Fist Weapon
|
$type = 7; // Fist Weapon
|
||||||
else if ($piece['class'] == 2 && $piece['subclass'] == 15)
|
else if ($piece['class'] == 2 && $piece['subclass'] == 15)
|
||||||
$type = 5; // Dagger
|
$type = 5; // Dagger
|
||||||
|
|
||||||
if (!$type)
|
if (!$type)
|
||||||
{
|
{
|
||||||
if ($piece['class'] == 4 && $piece['slot'] == 12)
|
if ($piece['class'] == 4 && $piece['slot'] == 12)
|
||||||
$type = 11; // trinket
|
$type = 11; // trinket
|
||||||
else if ($piece['class'] == 4 && $piece['slot'] == 2)
|
else if ($piece['class'] == 4 && $piece['slot'] == 2)
|
||||||
$type = 12; // amulet
|
$type = 12; // amulet
|
||||||
else if ($piece['class'] == 4 && $piece['subclass'] != 0)
|
else if ($piece['class'] == 4 && $piece['subclass'] != 0)
|
||||||
$type = $piece['subclass']; // 'armor' set
|
$type = $piece['subclass']; // 'armor' set
|
||||||
|
|
||||||
if ($piece['class'] == 4 && $piece['slot'] == 11)
|
if ($piece['class'] == 4 && $piece['slot'] == 11)
|
||||||
$hasRing = true; // contains ring
|
$hasRing = true; // contains ring
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($hasRing && !$type)
|
if ($hasRing && !$type)
|
||||||
$type = 6; // pure ring-set
|
$type = 6; // pure ring-set
|
||||||
|
|
||||||
$isMultiSet = false;
|
$isMultiSet = false;
|
||||||
$oldSlotMask = 0x0;
|
$oldSlotMask = 0x0;
|
||||||
foreach ($items as $subset)
|
foreach ($items as $subset)
|
||||||
{
|
{
|
||||||
$curSlotMask = 0x0;
|
$curSlotMask = 0x0;
|
||||||
foreach ($subset as $slot => $item)
|
foreach ($subset as $slot => $item)
|
||||||
$curSlotMask |= (1 << $slot);
|
$curSlotMask |= (1 << $slot);
|
||||||
|
|
||||||
if ($oldSlotMask && $oldSlotMask == $curSlotMask)
|
if ($oldSlotMask && $oldSlotMask == $curSlotMask)
|
||||||
{
|
{
|
||||||
$isMultiSet = true;
|
$isMultiSet = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oldSlotMask = $curSlotMask;
|
$oldSlotMask = $curSlotMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$isMultiSet || !$canReuse || $setId == 555)
|
if (!$isMultiSet || !$canReuse || $setId == 555)
|
||||||
{
|
{
|
||||||
$temp = [];
|
$temp = [];
|
||||||
foreach ($items as $subset)
|
foreach ($items as $subset)
|
||||||
{
|
{
|
||||||
foreach ($subset as $slot => $item)
|
foreach ($subset as $slot => $item)
|
||||||
{
|
{
|
||||||
if (isset($temp[$slot]) && $temp[$slot] < $item)
|
if (isset($temp[$slot]) && $temp[$slot] < $item)
|
||||||
CLISetup::log("set: ".$setId." - conflict between item: ".$item." and item: ".$temp[$slot]." choosing lower itemId", CLISetup::LOG_WARN);
|
CLISetup::log("set: ".$setId." - conflict between item: ".$item." and item: ".$temp[$slot]." choosing lower itemId", CLISetup::LOG_WARN);
|
||||||
else if ($slot == 13 || $slot = 11) // special case
|
else if ($slot == 13 || $slot = 11) // special case
|
||||||
$temp[] = $item;
|
$temp[] = $item;
|
||||||
else
|
else
|
||||||
$temp[$slot] = $item;
|
$temp[$slot] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$items = [$temp];
|
$items = [$temp];
|
||||||
$heroic = [reset($heroic)];
|
$heroic = [reset($heroic)];
|
||||||
$nPieces = [count($temp)];
|
$nPieces = [count($temp)];
|
||||||
$quality = [reset($quality)];
|
$quality = [reset($quality)];
|
||||||
$reqLvl = [reset($reqLvl)];
|
$reqLvl = [reset($reqLvl)];
|
||||||
$max = $max ? [max($max)] : [0];
|
$max = $max ? [max($max)] : [0];
|
||||||
$min = $min ? [min($min)] : [0];
|
$min = $min ? [min($min)] : [0];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($items as &$subsets)
|
foreach ($items as &$subsets)
|
||||||
$subsets = array_pad($subsets, 10, 0);
|
$subsets = array_pad($subsets, 10, 0);
|
||||||
|
|
||||||
/********************/
|
/********************/
|
||||||
/* calc statbonuses */
|
/* calc statbonuses */
|
||||||
/********************/
|
/********************/
|
||||||
|
|
||||||
for ($i = 1; $i < 9; $i++)
|
for ($i = 1; $i < 9; $i++)
|
||||||
if ($setData['spellId'.$i] > 0 && $setData['itemCount'.$i] > 0)
|
if ($setData['spellId'.$i] > 0 && $setData['itemCount'.$i] > 0)
|
||||||
$spells[] = [$setData['spellId'.$i], $setData['itemCount'.$i]];
|
$spells[] = [$setData['spellId'.$i], $setData['itemCount'.$i]];
|
||||||
|
|
||||||
$bonusSpells = new SpellList(array(['s.id', array_column($spells, 0)]));
|
$bonusSpells = new SpellList(array(['s.id', array_column($spells, 0)]));
|
||||||
$mods = $bonusSpells->getStatGain();
|
$mods = $bonusSpells->getStatGain();
|
||||||
|
|
||||||
$spells = array_pad($spells, 8, [0, 0]);
|
$spells = array_pad($spells, 8, [0, 0]);
|
||||||
|
|
||||||
for ($i = 1; $i < 9; $i++)
|
for ($i = 1; $i < 9; $i++)
|
||||||
if ($setData['itemCount'.$i] > 0 && !empty($mods[$setData['spellId'.$i]]))
|
if ($setData['itemCount'.$i] > 0 && !empty($mods[$setData['spellId'.$i]]))
|
||||||
$gains[$setData['itemCount'.$i]] = $mods[$setData['spellId'.$i]];
|
$gains[$setData['itemCount'.$i]] = $mods[$setData['spellId'.$i]];
|
||||||
|
|
||||||
/**************************/
|
/**************************/
|
||||||
/* get name & description */
|
/* get name & description */
|
||||||
/**************************/
|
/**************************/
|
||||||
|
|
||||||
foreach (array_keys(array_filter(Util::$localeStrings)) as $loc)
|
foreach (array_keys(array_filter(Util::$localeStrings)) as $loc)
|
||||||
{
|
{
|
||||||
User::useLocale($loc);
|
User::useLocale($loc);
|
||||||
|
|
||||||
$name[$loc] = Util::localizedString($setData, 'name');
|
$name[$loc] = Util::localizedString($setData, 'name');
|
||||||
|
|
||||||
foreach ($bonusSpells->iterate() as $__)
|
foreach ($bonusSpells->iterate() as $__)
|
||||||
{
|
{
|
||||||
if (!isset($descText[$loc]))
|
if (!isset($descText[$loc]))
|
||||||
$descText[$loc] = '';
|
$descText[$loc] = '';
|
||||||
|
|
||||||
$descText[$loc] .= $bonusSpells->parseText()[0]."\n";
|
$descText[$loc] .= $bonusSpells->parseText()[0]."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// strip rating blocks - e.g. <!--rtg19-->14 <small>(<!--rtg%19-->0.30% @ L<!--lvl-->80)</small>
|
// strip rating blocks - e.g. <!--rtg19-->14 <small>(<!--rtg%19-->0.30% @ L<!--lvl-->80)</small>
|
||||||
$descText[$loc] = preg_replace('/<!--rtg\d+-->(\d+) .*?<\/small>/i', '\1', $descText[$loc]);
|
$descText[$loc] = preg_replace('/<!--rtg\d+-->(\d+) .*?<\/small>/i', '\1', $descText[$loc]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************/
|
/****************************/
|
||||||
/* finalaize data and write */
|
/* finalaize data and write */
|
||||||
/****************************/
|
/****************************/
|
||||||
|
|
||||||
foreach ($items as $vId => $vSet)
|
foreach ($items as $vId => $vSet)
|
||||||
{
|
{
|
||||||
$note = 0;
|
$note = 0;
|
||||||
foreach ($tagsById as $tag => $sets)
|
foreach ($tagsById as $tag => $sets)
|
||||||
{
|
{
|
||||||
if (!in_array($setId, $sets))
|
if (!in_array($setId, $sets))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$note = $tag;
|
$note = $tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$note && $min > 120 && $classMask && $classMask != CLASS_MASK_ALL)
|
if (!$note && $min > 120 && $classMask && $classMask != CLASS_MASK_ALL)
|
||||||
{
|
{
|
||||||
foreach ($tagsByNamePart as $tag => $strings)
|
foreach ($tagsByNamePart as $tag => $strings)
|
||||||
{
|
{
|
||||||
foreach ($strings as $str)
|
foreach ($strings as $str)
|
||||||
{
|
{
|
||||||
if (isset($pieces[reset($vSet)]) && stripos($pieces[reset($vSet)]['name'], $str) === 0)
|
if (isset($pieces[reset($vSet)]) && stripos($pieces[reset($vSet)]['name'], $str) === 0)
|
||||||
{
|
{
|
||||||
$note = $tag;
|
$note = $tag;
|
||||||
break 2;
|
break 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
|
|
||||||
$row[] = $vId < 0 ? --$virtualId : $setId;
|
$row[] = $vId < 0 ? --$virtualId : $setId;
|
||||||
$row[] = $setId; // refSetId
|
$row[] = $setId; // refSetId
|
||||||
$row[] = 0; // cuFlags
|
$row[] = 0; // cuFlags
|
||||||
$row = array_merge($row, $name, $vSet);
|
$row = array_merge($row, $name, $vSet);
|
||||||
foreach (array_column($spells, 0) as $spellId)
|
foreach (array_column($spells, 0) as $spellId)
|
||||||
$row[] = $spellId;
|
$row[] = $spellId;
|
||||||
foreach (array_column($spells, 1) as $nItems)
|
foreach (array_column($spells, 1) as $nItems)
|
||||||
$row[] = $nItems;
|
$row[] = $nItems;
|
||||||
$row = array_merge($row, $descText);
|
$row = array_merge($row, $descText);
|
||||||
$row[] = serialize($gains);
|
$row[] = serialize($gains);
|
||||||
$row[] = $nPieces[$vId];
|
$row[] = $nPieces[$vId];
|
||||||
$row[] = $min[$vId];
|
$row[] = $min[$vId];
|
||||||
$row[] = $max[$vId];
|
$row[] = $max[$vId];
|
||||||
$row[] = $reqLvl[$vId];
|
$row[] = $reqLvl[$vId];
|
||||||
$row[] = $classMask == CLASS_MASK_ALL ? 0 : $classMask;
|
$row[] = $classMask == CLASS_MASK_ALL ? 0 : $classMask;
|
||||||
$row[] = !empty($heroic[$vId]) ? 1 : 0;
|
$row[] = !empty($heroic[$vId]) ? 1 : 0;
|
||||||
$row[] = $quality[$vId];
|
$row[] = $quality[$vId];
|
||||||
$row[] = $type;
|
$row[] = $type;
|
||||||
$row[] = $note; // contentGroup
|
$row[] = $note; // contentGroup
|
||||||
$row[] = $holiday;
|
$row[] = $holiday;
|
||||||
$row[] = $setData['reqSkillId'];
|
$row[] = $setData['reqSkillId'];
|
||||||
$row[] = $setData['reqSkillLevel'];
|
$row[] = $setData['reqSkillLevel'];
|
||||||
|
|
||||||
DB::Aowow()->query('REPLACE INTO ?_itemset VALUES (?a)', array_values($row));
|
DB::Aowow()->query('REPLACE INTO ?_itemset VALUES (?a)', array_values($row));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide empty sets
|
// hide empty sets
|
||||||
DB::Aowow()->query('UPDATE ?_itemset SET cuFlags = cuFlags | ?d WHERE item1 = 0', CUSTOM_EXCLUDE_FOR_LISTVIEW);
|
DB::Aowow()->query('UPDATE ?_itemset SET cuFlags = cuFlags | ?d WHERE item1 = 0', CUSTOM_EXCLUDE_FOR_LISTVIEW);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,127 +1,127 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/* deps:
|
/* deps:
|
||||||
* gameobject_template
|
* gameobject_template
|
||||||
* gameobject_template_locale
|
* gameobject_template_locale
|
||||||
* gameobject_questitem
|
* gameobject_questitem
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = ['lock'];
|
$reqDBC = ['lock'];
|
||||||
|
|
||||||
function objects(array $ids = [])
|
function objects(array $ids = [])
|
||||||
{
|
{
|
||||||
$baseQuery = '
|
$baseQuery = '
|
||||||
SELECT
|
SELECT
|
||||||
go.entry,
|
go.entry,
|
||||||
`type`,
|
`type`,
|
||||||
IF(`type` = 2, -2, -- quests 1
|
IF(`type` = 2, -2, -- quests 1
|
||||||
IF(`type` = 8 AND Data0 IN (1, 2, 3, 4, 1552), -6, -- tools
|
IF(`type` = 8 AND Data0 IN (1, 2, 3, 4, 1552), -6, -- tools
|
||||||
IF(`type` = 3 AND IFNULL(gqi.ItemId, 0) <> 0, -2, -- quests 2
|
IF(`type` = 3 AND IFNULL(gqi.ItemId, 0) <> 0, -2, -- quests 2
|
||||||
IF(`type` IN (3, 9, 25), `type`, 0)))), -- regular chests, books, pools
|
IF(`type` IN (3, 9, 25), `type`, 0)))), -- regular chests, books, pools
|
||||||
0 AS event, -- linked worldevent
|
0 AS event, -- linked worldevent
|
||||||
displayId,
|
displayId,
|
||||||
go.name,
|
go.name,
|
||||||
IFNULL(gtl2.`name`, "") AS name_loc2,
|
IFNULL(gtl2.`name`, "") AS name_loc2,
|
||||||
IFNULL(gtl3.`name`, "") AS name_loc3,
|
IFNULL(gtl3.`name`, "") AS name_loc3,
|
||||||
IFNULL(gtl6.`name`, "") AS name_loc6,
|
IFNULL(gtl6.`name`, "") AS name_loc6,
|
||||||
IFNULL(gtl8.`name`, "") AS name_loc8,
|
IFNULL(gtl8.`name`, "") AS name_loc8,
|
||||||
IFNULL(goa.faction, 0),
|
IFNULL(goa.faction, 0),
|
||||||
IFNULL(goa.flags, 0),
|
IFNULL(goa.flags, 0),
|
||||||
0 AS cuFlags, -- custom Flags
|
0 AS cuFlags, -- custom Flags
|
||||||
IF(`type` IN (3, 25), Data1, 0), -- lootId
|
IF(`type` IN (3, 25), Data1, 0), -- lootId
|
||||||
IF(`type` IN (2, 3, 6, 10, 13, 24, 26), Data0, IF(`type` IN (0, 1), Data1, 0)), -- lockId
|
IF(`type` IN (2, 3, 6, 10, 13, 24, 26), Data0, IF(`type` IN (0, 1), Data1, 0)), -- lockId
|
||||||
0 AS reqSkill, -- reqSkill
|
0 AS reqSkill, -- reqSkill
|
||||||
IF(`type` = 9, Data0, IF(`type` = 10, Data7, 0)), -- pageTextId
|
IF(`type` = 9, Data0, IF(`type` = 10, Data7, 0)), -- pageTextId
|
||||||
IF(`type` = 1, Data3, -- linkedTrapIds
|
IF(`type` = 1, Data3, -- linkedTrapIds
|
||||||
IF(`type` = 3, Data7,
|
IF(`type` = 3, Data7,
|
||||||
IF(`type` = 10, Data12,
|
IF(`type` = 10, Data12,
|
||||||
IF(`type` = 8, Data2, 0)))),
|
IF(`type` = 8, Data2, 0)))),
|
||||||
IF(`type` = 5, Data5, -- reqQuest
|
IF(`type` = 5, Data5, -- reqQuest
|
||||||
IF(`type` = 3, Data8,
|
IF(`type` = 3, Data8,
|
||||||
IF(`type` = 10, Data1,
|
IF(`type` = 10, Data1,
|
||||||
IF(`type` = 8, Data4, 0)))),
|
IF(`type` = 8, Data4, 0)))),
|
||||||
IF(`type` = 8, Data0, 0), -- spellFocusId
|
IF(`type` = 8, Data0, 0), -- spellFocusId
|
||||||
IF(`type` = 10, Data10, -- onUseSpell
|
IF(`type` = 10, Data10, -- onUseSpell
|
||||||
IF(`type` IN (18, 24), Data1,
|
IF(`type` IN (18, 24), Data1,
|
||||||
IF(`type` = 26, Data2,
|
IF(`type` = 26, Data2,
|
||||||
IF(`type` = 22, Data0, 0)))),
|
IF(`type` = 22, Data0, 0)))),
|
||||||
IF(`type` = 18, Data4, 0), -- onSuccessSpell
|
IF(`type` = 18, Data4, 0), -- onSuccessSpell
|
||||||
IF(`type` = 18, Data2, IF(`type` = 24, Data3, 0)), -- auraSpell
|
IF(`type` = 18, Data2, IF(`type` = 24, Data3, 0)), -- auraSpell
|
||||||
IF(`type` = 30, Data2, IF(`type` = 24, Data4, IF(`type` = 6, Data3, 0))), -- triggeredSpell
|
IF(`type` = 30, Data2, IF(`type` = 24, Data4, IF(`type` = 6, Data3, 0))), -- triggeredSpell
|
||||||
IF(`type` = 29, CONCAT_WS(" ", Data14, Data15, Data16, Data17, Data0), -- miscInfo: capturePoint
|
IF(`type` = 29, CONCAT_WS(" ", Data14, Data15, Data16, Data17, Data0), -- miscInfo: capturePoint
|
||||||
IF(`type` = 3, CONCAT_WS(" ", Data4, Data5, Data2), -- miscInfo: loot v
|
IF(`type` = 3, CONCAT_WS(" ", Data4, Data5, Data2), -- miscInfo: loot v
|
||||||
IF(`type` = 25, CONCAT_WS(" ", Data2, Data3, 0),
|
IF(`type` = 25, CONCAT_WS(" ", Data2, Data3, 0),
|
||||||
IF(`type` = 23, CONCAT_WS(" ", Data0, Data1, Data2), "")))), -- miscInfo: meetingStone
|
IF(`type` = 23, CONCAT_WS(" ", Data0, Data1, Data2), "")))), -- miscInfo: meetingStone
|
||||||
IF(ScriptName <> "", ScriptName, AIName)
|
IF(ScriptName <> "", ScriptName, AIName)
|
||||||
FROM
|
FROM
|
||||||
gameobject_template go
|
gameobject_template go
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
gameobject_template_addon goa ON go.entry = goa.entry
|
gameobject_template_addon goa ON go.entry = goa.entry
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
gameobject_template_locale gtl2 ON go.entry = gtl2.entry AND gtl2.`locale` = "frFR"
|
gameobject_template_locale gtl2 ON go.entry = gtl2.entry AND gtl2.`locale` = "frFR"
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
gameobject_template_locale gtl3 ON go.entry = gtl3.entry AND gtl3.`locale` = "deDE"
|
gameobject_template_locale gtl3 ON go.entry = gtl3.entry AND gtl3.`locale` = "deDE"
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
gameobject_template_locale gtl6 ON go.entry = gtl6.entry AND gtl6.`locale` = "esES"
|
gameobject_template_locale gtl6 ON go.entry = gtl6.entry AND gtl6.`locale` = "esES"
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
gameobject_template_locale gtl8 ON go.entry = gtl8.entry AND gtl8.`locale` = "ruRU"
|
gameobject_template_locale gtl8 ON go.entry = gtl8.entry AND gtl8.`locale` = "ruRU"
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
gameobject_questitem gqi ON gqi.GameObjectEntry = go.entry
|
gameobject_questitem gqi ON gqi.GameObjectEntry = go.entry
|
||||||
WHERE
|
WHERE
|
||||||
go.entry > ?d
|
go.entry > ?d
|
||||||
{
|
{
|
||||||
AND go.entry IN (?a)
|
AND go.entry IN (?a)
|
||||||
}
|
}
|
||||||
GROUP BY
|
GROUP BY
|
||||||
go.entry
|
go.entry
|
||||||
ORDER BY
|
ORDER BY
|
||||||
go.entry ASC
|
go.entry ASC
|
||||||
LIMIT
|
LIMIT
|
||||||
?d';
|
?d';
|
||||||
|
|
||||||
$updateQuery = '
|
$updateQuery = '
|
||||||
UPDATE
|
UPDATE
|
||||||
?_objects o
|
?_objects o
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
dbc_lock l ON l.id = IF(o.`type` = 3, lockId, null)
|
dbc_lock l ON l.id = IF(o.`type` = 3, lockId, null)
|
||||||
SET
|
SET
|
||||||
typeCat = IF(`type` = 3 AND (l.properties1 = 1 OR l.properties2 = 1), -5, -- footlocker
|
typeCat = IF(`type` = 3 AND (l.properties1 = 1 OR l.properties2 = 1), -5, -- footlocker
|
||||||
IF(`type` = 3 AND (l.properties1 = 2), -3, -- herb
|
IF(`type` = 3 AND (l.properties1 = 2), -3, -- herb
|
||||||
IF(`type` = 3 AND (l.properties1 = 3), -4, typeCat))), -- ore
|
IF(`type` = 3 AND (l.properties1 = 3), -4, typeCat))), -- ore
|
||||||
reqSkill = IF(`type` = 3 AND l.properties1 IN (1, 2, 3), IF(l.reqSkill1 > 1, l.reqSkill1, 1),
|
reqSkill = IF(`type` = 3 AND l.properties1 IN (1, 2, 3), IF(l.reqSkill1 > 1, l.reqSkill1, 1),
|
||||||
IF(`type` = 3 AND l.properties2 = 1, IF(l.reqSkill2 > 1, l.reqSkill2, 1), 0))
|
IF(`type` = 3 AND l.properties2 = 1, IF(l.reqSkill2 > 1, l.reqSkill2, 1), 0))
|
||||||
{
|
{
|
||||||
WHERE
|
WHERE
|
||||||
o.id IN (?a)
|
o.id IN (?a)
|
||||||
}';
|
}';
|
||||||
|
|
||||||
$lastMax = 0;
|
$lastMax = 0;
|
||||||
while ($objects = DB::World()->select($baseQuery, $lastMax, $ids ?: DBSIMPLE_SKIP, SqlGen::$stepSize))
|
while ($objects = DB::World()->select($baseQuery, $lastMax, $ids ?: DBSIMPLE_SKIP, SqlGen::$stepSize))
|
||||||
{
|
{
|
||||||
$newMax = max(array_column($objects, 'entry'));
|
$newMax = max(array_column($objects, 'entry'));
|
||||||
|
|
||||||
CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax);
|
CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax);
|
||||||
|
|
||||||
$lastMax = $newMax;
|
$lastMax = $newMax;
|
||||||
|
|
||||||
foreach ($objects as $o)
|
foreach ($objects as $o)
|
||||||
DB::Aowow()->query('REPLACE INTO ?_objects VALUES (?a)', array_values($o));
|
DB::Aowow()->query('REPLACE INTO ?_objects VALUES (?a)', array_values($o));
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply typeCat and reqSkill depending on locks
|
// apply typeCat and reqSkill depending on locks
|
||||||
DB::Aowow()->query($updateQuery, $ids ?: DBSIMPLE_SKIP);
|
DB::Aowow()->query($updateQuery, $ids ?: DBSIMPLE_SKIP);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,125 +1,125 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/* deps:
|
/* deps:
|
||||||
* creature_template
|
* creature_template
|
||||||
* creature
|
* creature
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = ['talent', 'spell', 'skilllineability', 'creaturefamily'];
|
$reqDBC = ['talent', 'spell', 'skilllineability', 'creaturefamily'];
|
||||||
|
|
||||||
function pet(array $ids = [])
|
function pet(array $ids = [])
|
||||||
{
|
{
|
||||||
$baseQuery = '
|
$baseQuery = '
|
||||||
REPLACE INTO
|
REPLACE INTO
|
||||||
?_pet
|
?_pet
|
||||||
SELECT
|
SELECT
|
||||||
f.id,
|
f.id,
|
||||||
categoryEnumId,
|
categoryEnumId,
|
||||||
0, -- cuFlags
|
0, -- cuFlags
|
||||||
0, -- minLevel
|
0, -- minLevel
|
||||||
0, -- maxLevel
|
0, -- maxLevel
|
||||||
petFoodMask,
|
petFoodMask,
|
||||||
petTalentType,
|
petTalentType,
|
||||||
0, -- exotic
|
0, -- exotic
|
||||||
0, -- expansion
|
0, -- expansion
|
||||||
name_loc0, name_loc2, name_loc3, name_lo6, name_loc8,
|
name_loc0, name_loc2, name_loc3, name_lo6, name_loc8,
|
||||||
LOWER(SUBSTRING_INDEX(iconString, "\\\\", -1)),
|
LOWER(SUBSTRING_INDEX(iconString, "\\\\", -1)),
|
||||||
skillLine1,
|
skillLine1,
|
||||||
0, 0, 0, 0, -- spell[1-4]
|
0, 0, 0, 0, -- spell[1-4]
|
||||||
0, 0, 0 -- armor, damage, health
|
0, 0, 0 -- armor, damage, health
|
||||||
FROM
|
FROM
|
||||||
dbc_creaturefamily f
|
dbc_creaturefamily f
|
||||||
WHERE
|
WHERE
|
||||||
petTalentType <> -1';
|
petTalentType <> -1';
|
||||||
|
|
||||||
$spawnQuery = '
|
$spawnQuery = '
|
||||||
SELECT
|
SELECT
|
||||||
ct.family AS ARRAY_KEY,
|
ct.family AS ARRAY_KEY,
|
||||||
MIN(ct.minlevel) AS minLevel,
|
MIN(ct.minlevel) AS minLevel,
|
||||||
MAX(ct.maxlevel) AS maxLevel,
|
MAX(ct.maxlevel) AS maxLevel,
|
||||||
IF(ct.type_flags & 0x10000, 1, 0) AS exotic
|
IF(ct.type_flags & 0x10000, 1, 0) AS exotic
|
||||||
FROM
|
FROM
|
||||||
creature_template ct
|
creature_template ct
|
||||||
JOIN
|
JOIN
|
||||||
creature c ON ct.entry = c.id
|
creature c ON ct.entry = c.id
|
||||||
WHERE
|
WHERE
|
||||||
ct.type_flags & 0x1
|
ct.type_flags & 0x1
|
||||||
GROUP BY
|
GROUP BY
|
||||||
ct.family';
|
ct.family';
|
||||||
|
|
||||||
$bonusQuery = '
|
$bonusQuery = '
|
||||||
UPDATE
|
UPDATE
|
||||||
?_pet p,
|
?_pet p,
|
||||||
dbc_skilllineability sla,
|
dbc_skilllineability sla,
|
||||||
dbc_spell s
|
dbc_spell s
|
||||||
SET
|
SET
|
||||||
armor = s.effect2BasePoints + s.effect2DieSides,
|
armor = s.effect2BasePoints + s.effect2DieSides,
|
||||||
damage = s.effect1BasePoints + s.effect1DieSides,
|
damage = s.effect1BasePoints + s.effect1DieSides,
|
||||||
health = s.effect3BasePoints + s.effect3DieSides
|
health = s.effect3BasePoints + s.effect3DieSides
|
||||||
WHERE
|
WHERE
|
||||||
p.skillLineId = sla.skillLineId AND
|
p.skillLineId = sla.skillLineId AND
|
||||||
sla.spellId = s.id AND
|
sla.spellId = s.id AND
|
||||||
s.name_loc0 = "Tamed Pet Passive (DND)"';
|
s.name_loc0 = "Tamed Pet Passive (DND)"';
|
||||||
|
|
||||||
$spellQuery = '
|
$spellQuery = '
|
||||||
SELECT
|
SELECT
|
||||||
p.id,
|
p.id,
|
||||||
MAX(s.id) AS spell
|
MAX(s.id) AS spell
|
||||||
FROM
|
FROM
|
||||||
dbc_skilllineability sla
|
dbc_skilllineability sla
|
||||||
JOIN
|
JOIN
|
||||||
?_pet p ON p.skillLineId = sla.skillLineId
|
?_pet p ON p.skillLineId = sla.skillLineId
|
||||||
JOIN
|
JOIN
|
||||||
dbc_spell s ON sla.spellId = s.id
|
dbc_spell s ON sla.spellId = s.id
|
||||||
LEFT OUTER JOIN
|
LEFT OUTER JOIN
|
||||||
dbc_talent t ON s.id = t.rank1
|
dbc_talent t ON s.id = t.rank1
|
||||||
WHERE
|
WHERE
|
||||||
(s.attributes0 & 0x40) = 0 AND
|
(s.attributes0 & 0x40) = 0 AND
|
||||||
t.id IS NULL
|
t.id IS NULL
|
||||||
GROUP BY
|
GROUP BY
|
||||||
s.name_loc0, p.id';
|
s.name_loc0, p.id';
|
||||||
|
|
||||||
// basic copy from creaturefamily.dbc
|
// basic copy from creaturefamily.dbc
|
||||||
DB::Aowow()->query($baseQuery);
|
DB::Aowow()->query($baseQuery);
|
||||||
|
|
||||||
// stats from craeture_template
|
// stats from craeture_template
|
||||||
$spawnInfo = DB::World()->query($spawnQuery);
|
$spawnInfo = DB::World()->query($spawnQuery);
|
||||||
foreach ($spawnInfo as $id => $info)
|
foreach ($spawnInfo as $id => $info)
|
||||||
DB::Aowow()->query('UPDATE ?_pet SET ?a WHERE id = ?d', $info, $id);
|
DB::Aowow()->query('UPDATE ?_pet SET ?a WHERE id = ?d', $info, $id);
|
||||||
|
|
||||||
// add petFamilyModifier to health, mana, dmg
|
// add petFamilyModifier to health, mana, dmg
|
||||||
DB::Aowow()->query($bonusQuery);
|
DB::Aowow()->query($bonusQuery);
|
||||||
|
|
||||||
// add expansion manually
|
// add expansion manually
|
||||||
DB::Aowow()->query('UPDATE ?_pet SET expansion = 1 WHERE id IN (30, 31, 32, 33, 34)');
|
DB::Aowow()->query('UPDATE ?_pet SET expansion = 1 WHERE id IN (30, 31, 32, 33, 34)');
|
||||||
DB::Aowow()->query('UPDATE ?_pet SET expansion = 2 WHERE id IN (37, 38, 39, 41, 42, 43, 44, 45, 46)');
|
DB::Aowow()->query('UPDATE ?_pet SET expansion = 2 WHERE id IN (37, 38, 39, 41, 42, 43, 44, 45, 46)');
|
||||||
|
|
||||||
// assign pet spells
|
// assign pet spells
|
||||||
$pets = DB::Aowow()->select($spellQuery);
|
$pets = DB::Aowow()->select($spellQuery);
|
||||||
$res = [];
|
$res = [];
|
||||||
|
|
||||||
foreach ($pets as $set) // convert to usable structure
|
foreach ($pets as $set) // convert to usable structure
|
||||||
{
|
{
|
||||||
if (!isset($res[$set['id']]))
|
if (!isset($res[$set['id']]))
|
||||||
$res[$set['id']] = [];
|
$res[$set['id']] = [];
|
||||||
|
|
||||||
$res[$set['id']]['spellId'.(count($res[$set['id']]) + 1)] = $set['spell'];
|
$res[$set['id']]['spellId'.(count($res[$set['id']]) + 1)] = $set['spell'];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($res as $pId => $row)
|
foreach ($res as $pId => $row)
|
||||||
DB::Aowow()->query('UPDATE ?_pet SET ?a WHERE id = ?d', $row, $pId);
|
DB::Aowow()->query('UPDATE ?_pet SET ?a WHERE id = ?d', $row, $pId);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,216 +1,216 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/* deps:
|
/* deps:
|
||||||
* quest_template
|
* quest_template
|
||||||
* quest_template_addon
|
* quest_template_addon
|
||||||
* locales_quest
|
* locales_quest
|
||||||
* game_event
|
* game_event
|
||||||
* game_event_seasonal_questrelation
|
* game_event_seasonal_questrelation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = ['questxp', 'questfactionreward'];
|
$reqDBC = ['questxp', 'questfactionreward'];
|
||||||
|
|
||||||
function quests(array $ids = [])
|
function quests(array $ids = [])
|
||||||
{
|
{
|
||||||
$baseQuery = '
|
$baseQuery = '
|
||||||
SELECT
|
SELECT
|
||||||
q.ID,
|
q.ID,
|
||||||
QuestType, -- Method
|
QuestType, -- Method
|
||||||
QuestLevel,
|
QuestLevel,
|
||||||
MinLevel,
|
MinLevel,
|
||||||
IFNULL(qa.MaxLevel, 0),
|
IFNULL(qa.MaxLevel, 0),
|
||||||
QuestSortID,
|
QuestSortID,
|
||||||
QuestSortID AS zoneOrSortBak, -- ZoneOrSortBak
|
QuestSortID AS zoneOrSortBak, -- ZoneOrSortBak
|
||||||
QuestInfoID, -- QuestType
|
QuestInfoID, -- QuestType
|
||||||
SuggestedGroupNum,
|
SuggestedGroupNum,
|
||||||
TimeAllowed,
|
TimeAllowed,
|
||||||
IFNULL(gesqr.eventEntry, 0) AS eventId,
|
IFNULL(gesqr.eventEntry, 0) AS eventId,
|
||||||
IFNULL(qa.PrevQuestId, 0),
|
IFNULL(qa.PrevQuestId, 0),
|
||||||
IFNULL(qa.NextQuestId, 0),
|
IFNULL(qa.NextQuestId, 0),
|
||||||
IFNULL(qa.ExclusiveGroup, 0),
|
IFNULL(qa.ExclusiveGroup, 0),
|
||||||
RewardNextQuest,
|
RewardNextQuest,
|
||||||
Flags,
|
Flags,
|
||||||
IFNULL(qa.SpecialFlags, 0),
|
IFNULL(qa.SpecialFlags, 0),
|
||||||
0 AS cuFlags, -- cuFlags
|
0 AS cuFlags, -- cuFlags
|
||||||
IFNULL(qa.AllowableClasses, 0),
|
IFNULL(qa.AllowableClasses, 0),
|
||||||
AllowableRaces,
|
AllowableRaces,
|
||||||
IFNULL(qa.RequiredSkillId, 0), IFNULL(qa.RequiredSkillPoints, 0),
|
IFNULL(qa.RequiredSkillId, 0), IFNULL(qa.RequiredSkillPoints, 0),
|
||||||
RequiredFactionId1, RequiredFactionId2,
|
RequiredFactionId1, RequiredFactionId2,
|
||||||
RequiredFactionValue1, RequiredFactionValue2,
|
RequiredFactionValue1, RequiredFactionValue2,
|
||||||
IFNULL(qa.RequiredMinRepFaction, 0),IFNULL(qa.RequiredMaxRepFaction, 0),
|
IFNULL(qa.RequiredMinRepFaction, 0),IFNULL(qa.RequiredMaxRepFaction, 0),
|
||||||
IFNULL(qa.RequiredMinRepValue, 0), IFNULL(qa.RequiredMaxRepValue, 0),
|
IFNULL(qa.RequiredMinRepValue, 0), IFNULL(qa.RequiredMaxRepValue, 0),
|
||||||
RequiredPlayerKills,
|
RequiredPlayerKills,
|
||||||
StartItem,
|
StartItem,
|
||||||
IFNULL(qa.ProvidedItemCount, 0),
|
IFNULL(qa.ProvidedItemCount, 0),
|
||||||
IFNULL(qa.SourceSpellId, 0),
|
IFNULL(qa.SourceSpellId, 0),
|
||||||
RewardXPDifficulty, -- QuestXP.dbc x level
|
RewardXPDifficulty, -- QuestXP.dbc x level
|
||||||
RewardMoney,
|
RewardMoney,
|
||||||
RewardBonusMoney,
|
RewardBonusMoney,
|
||||||
RewardDisplaySpell, RewardSpell,
|
RewardDisplaySpell, RewardSpell,
|
||||||
RewardHonor * 124 * RewardKillHonor, -- alt calculation in QuestDef.cpp -> Quest::CalculateHonorGain(playerLevel)
|
RewardHonor * 124 * RewardKillHonor, -- alt calculation in QuestDef.cpp -> Quest::CalculateHonorGain(playerLevel)
|
||||||
IFNULL(qa.RewardMailTemplateId, 0), IFNULL(qa.RewardMailDelay, 0),
|
IFNULL(qa.RewardMailTemplateId, 0), IFNULL(qa.RewardMailDelay, 0),
|
||||||
RewardTitle,
|
RewardTitle,
|
||||||
RewardTalents,
|
RewardTalents,
|
||||||
RewardArenaPoints,
|
RewardArenaPoints,
|
||||||
RewardItem1, RewardItem2, RewardItem3, RewardItem4,
|
RewardItem1, RewardItem2, RewardItem3, RewardItem4,
|
||||||
RewardAmount1, RewardAmount2, RewardAmount3, RewardAmount4,
|
RewardAmount1, RewardAmount2, RewardAmount3, RewardAmount4,
|
||||||
RewardChoiceItemID1, RewardChoiceItemID2, RewardChoiceItemID3, RewardChoiceItemID4, RewardChoiceItemID5, RewardChoiceItemID6,
|
RewardChoiceItemID1, RewardChoiceItemID2, RewardChoiceItemID3, RewardChoiceItemID4, RewardChoiceItemID5, RewardChoiceItemID6,
|
||||||
RewardChoiceItemQuantity1, RewardChoiceItemQuantity2, RewardChoiceItemQuantity3, RewardChoiceItemQuantity4, RewardChoiceItemQuantity5, RewardChoiceItemQuantity6,
|
RewardChoiceItemQuantity1, RewardChoiceItemQuantity2, RewardChoiceItemQuantity3, RewardChoiceItemQuantity4, RewardChoiceItemQuantity5, RewardChoiceItemQuantity6,
|
||||||
RewardFactionID1, RewardFactionID2, RewardFactionID3, RewardFactionID4, RewardFactionID5,
|
RewardFactionID1, RewardFactionID2, RewardFactionID3, RewardFactionID4, RewardFactionID5,
|
||||||
IF (RewardFactionOverride1 <> 0, RewardFactionOverride1 / 100, RewardFactionValue1),
|
IF (RewardFactionOverride1 <> 0, RewardFactionOverride1 / 100, RewardFactionValue1),
|
||||||
IF (RewardFactionOverride2 <> 0, RewardFactionOverride2 / 100, RewardFactionValue2),
|
IF (RewardFactionOverride2 <> 0, RewardFactionOverride2 / 100, RewardFactionValue2),
|
||||||
IF (RewardFactionOverride3 <> 0, RewardFactionOverride3 / 100, RewardFactionValue3),
|
IF (RewardFactionOverride3 <> 0, RewardFactionOverride3 / 100, RewardFactionValue3),
|
||||||
IF (RewardFactionOverride4 <> 0, RewardFactionOverride4 / 100, RewardFactionValue4),
|
IF (RewardFactionOverride4 <> 0, RewardFactionOverride4 / 100, RewardFactionValue4),
|
||||||
IF (RewardFactionOverride5 <> 0, RewardFactionOverride5 / 100, RewardFactionValue5),
|
IF (RewardFactionOverride5 <> 0, RewardFactionOverride5 / 100, RewardFactionValue5),
|
||||||
LogTitle, IFNULL(lq.Title_loc2, ""), IFNULL(lq.Title_loc3, ""), IFNULL(lq.Title_loc6, ""), IFNULL(lq.Title_loc8, ""),
|
LogTitle, IFNULL(lq.Title_loc2, ""), IFNULL(lq.Title_loc3, ""), IFNULL(lq.Title_loc6, ""), IFNULL(lq.Title_loc8, ""),
|
||||||
LogDescription, IFNULL(lq.Objectives_loc2, ""), IFNULL(lq.Objectives_loc3, ""), IFNULL(lq.Objectives_loc6, ""), IFNULL(lq.Objectives_loc8, ""),
|
LogDescription, IFNULL(lq.Objectives_loc2, ""), IFNULL(lq.Objectives_loc3, ""), IFNULL(lq.Objectives_loc6, ""), IFNULL(lq.Objectives_loc8, ""),
|
||||||
QuestDescription, IFNULL(lq.Details_loc2, ""), IFNULL(lq.Details_loc3, ""), IFNULL(lq.Details_loc6, ""), IFNULL(lq.Details_loc8, ""),
|
QuestDescription, IFNULL(lq.Details_loc2, ""), IFNULL(lq.Details_loc3, ""), IFNULL(lq.Details_loc6, ""), IFNULL(lq.Details_loc8, ""),
|
||||||
AreaDescription, IFNULL(lq.EndText_loc2, ""), IFNULL(lq.EndText_loc3, ""), IFNULL(lq.EndText_loc6, ""), IFNULL(lq.EndText_loc8, ""),
|
AreaDescription, IFNULL(lq.EndText_loc2, ""), IFNULL(lq.EndText_loc3, ""), IFNULL(lq.EndText_loc6, ""), IFNULL(lq.EndText_loc8, ""),
|
||||||
IFNULL(qor.RewardText, ""), IFNULL(lq.OfferRewardText_loc2, ""), IFNULL(lq.OfferRewardText_loc3, ""), IFNULL(lq.OfferRewardText_loc6, ""), IFNULL(lq.OfferRewardText_loc8, ""),
|
IFNULL(qor.RewardText, ""), IFNULL(lq.OfferRewardText_loc2, ""), IFNULL(lq.OfferRewardText_loc3, ""), IFNULL(lq.OfferRewardText_loc6, ""), IFNULL(lq.OfferRewardText_loc8, ""),
|
||||||
IFNULL(qri.CompletionText, ""), IFNULL(lq.RequestItemsText_loc2, ""), IFNULL(lq.RequestItemsText_loc3, ""), IFNULL(lq.RequestItemsText_loc6, ""), IFNULL(lq.RequestItemsText_loc8, ""),
|
IFNULL(qri.CompletionText, ""), IFNULL(lq.RequestItemsText_loc2, ""), IFNULL(lq.RequestItemsText_loc3, ""), IFNULL(lq.RequestItemsText_loc6, ""), IFNULL(lq.RequestItemsText_loc8, ""),
|
||||||
QuestCompletionLog, IFNULL(lq.CompletedText_loc2, ""), IFNULL(lq.CompletedText_loc3, ""), IFNULL(lq.CompletedText_loc6, ""), IFNULL(lq.CompletedText_loc8, ""),
|
QuestCompletionLog, IFNULL(lq.CompletedText_loc2, ""), IFNULL(lq.CompletedText_loc3, ""), IFNULL(lq.CompletedText_loc6, ""), IFNULL(lq.CompletedText_loc8, ""),
|
||||||
RequiredNpcOrGo1, RequiredNpcOrGo2, RequiredNpcOrGo3, RequiredNpcOrGo4,
|
RequiredNpcOrGo1, RequiredNpcOrGo2, RequiredNpcOrGo3, RequiredNpcOrGo4,
|
||||||
RequiredNpcOrGoCount1, RequiredNpcOrGoCount2, RequiredNpcOrGoCount3, RequiredNpcOrGoCount4,
|
RequiredNpcOrGoCount1, RequiredNpcOrGoCount2, RequiredNpcOrGoCount3, RequiredNpcOrGoCount4,
|
||||||
ItemDrop1, ItemDrop2, ItemDrop3, ItemDrop4,
|
ItemDrop1, ItemDrop2, ItemDrop3, ItemDrop4,
|
||||||
ItemDropQuantity1, ItemDropQuantity2, ItemDropQuantity3, ItemDropQuantity4,
|
ItemDropQuantity1, ItemDropQuantity2, ItemDropQuantity3, ItemDropQuantity4,
|
||||||
RequiredItemId1, RequiredItemId2, RequiredItemId3, RequiredItemId4, RequiredItemId5, RequiredItemId6,
|
RequiredItemId1, RequiredItemId2, RequiredItemId3, RequiredItemId4, RequiredItemId5, RequiredItemId6,
|
||||||
RequiredItemCount1, RequiredItemCount2, RequiredItemCount3, RequiredItemCount4, RequiredItemCount5, RequiredItemCount6,
|
RequiredItemCount1, RequiredItemCount2, RequiredItemCount3, RequiredItemCount4, RequiredItemCount5, RequiredItemCount6,
|
||||||
ObjectiveText1, IFNULL(lq.ObjectiveText1_loc2, ""), IFNULL(lq.ObjectiveText1_loc3, ""), IFNULL(lq.ObjectiveText1_loc6, ""), IFNULL(lq.ObjectiveText1_loc8, ""),
|
ObjectiveText1, IFNULL(lq.ObjectiveText1_loc2, ""), IFNULL(lq.ObjectiveText1_loc3, ""), IFNULL(lq.ObjectiveText1_loc6, ""), IFNULL(lq.ObjectiveText1_loc8, ""),
|
||||||
ObjectiveText2, IFNULL(lq.ObjectiveText2_loc2, ""), IFNULL(lq.ObjectiveText2_loc3, ""), IFNULL(lq.ObjectiveText2_loc6, ""), IFNULL(lq.ObjectiveText2_loc8, ""),
|
ObjectiveText2, IFNULL(lq.ObjectiveText2_loc2, ""), IFNULL(lq.ObjectiveText2_loc3, ""), IFNULL(lq.ObjectiveText2_loc6, ""), IFNULL(lq.ObjectiveText2_loc8, ""),
|
||||||
ObjectiveText3, IFNULL(lq.ObjectiveText3_loc2, ""), IFNULL(lq.ObjectiveText3_loc3, ""), IFNULL(lq.ObjectiveText3_loc6, ""), IFNULL(lq.ObjectiveText3_loc8, ""),
|
ObjectiveText3, IFNULL(lq.ObjectiveText3_loc2, ""), IFNULL(lq.ObjectiveText3_loc3, ""), IFNULL(lq.ObjectiveText3_loc6, ""), IFNULL(lq.ObjectiveText3_loc8, ""),
|
||||||
ObjectiveText4, IFNULL(lq.ObjectiveText4_loc2, ""), IFNULL(lq.ObjectiveText4_loc3, ""), IFNULL(lq.ObjectiveText4_loc6, ""), IFNULL(lq.ObjectiveText4_loc8, "")
|
ObjectiveText4, IFNULL(lq.ObjectiveText4_loc2, ""), IFNULL(lq.ObjectiveText4_loc3, ""), IFNULL(lq.ObjectiveText4_loc6, ""), IFNULL(lq.ObjectiveText4_loc8, "")
|
||||||
FROM
|
FROM
|
||||||
quest_template q
|
quest_template q
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
quest_template_addon qa ON q.ID = qa.ID
|
quest_template_addon qa ON q.ID = qa.ID
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
quest_offer_reward qor ON q.ID = qor.ID
|
quest_offer_reward qor ON q.ID = qor.ID
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
quest_request_items qri ON q.ID = qri.ID
|
quest_request_items qri ON q.ID = qri.ID
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
locales_quest lq ON q.ID = lq.Id
|
locales_quest lq ON q.ID = lq.Id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
game_event_seasonal_questrelation gesqr ON gesqr.questId = q.ID
|
game_event_seasonal_questrelation gesqr ON gesqr.questId = q.ID
|
||||||
WHERE
|
WHERE
|
||||||
q.Id > ?d
|
q.Id > ?d
|
||||||
{
|
{
|
||||||
AND q.Id IN (?a)
|
AND q.Id IN (?a)
|
||||||
}
|
}
|
||||||
ORDER BY
|
ORDER BY
|
||||||
q.ID ASC
|
q.ID ASC
|
||||||
LIMIT
|
LIMIT
|
||||||
?d';
|
?d';
|
||||||
|
|
||||||
$xpQuery = '
|
$xpQuery = '
|
||||||
UPDATE
|
UPDATE
|
||||||
?_quests q,
|
?_quests q,
|
||||||
dbc_questxp xp
|
dbc_questxp xp
|
||||||
SET
|
SET
|
||||||
rewardXP = (CASE rewardXP
|
rewardXP = (CASE rewardXP
|
||||||
WHEN 0 THEN xp.Field1 WHEN 1 THEN xp.Field2 WHEN 2 THEN xp.Field3 WHEN 3 THEN xp.Field4 WHEN 4 THEN xp.Field5
|
WHEN 0 THEN xp.Field1 WHEN 1 THEN xp.Field2 WHEN 2 THEN xp.Field3 WHEN 3 THEN xp.Field4 WHEN 4 THEN xp.Field5
|
||||||
WHEN 5 THEN xp.Field6 WHEN 6 THEN xp.Field7 WHEN 7 THEN xp.Field8 WHEN 8 THEN xp.Field9 WHEN 9 THEN xp.Field10
|
WHEN 5 THEN xp.Field6 WHEN 6 THEN xp.Field7 WHEN 7 THEN xp.Field8 WHEN 8 THEN xp.Field9 WHEN 9 THEN xp.Field10
|
||||||
ELSE 0
|
ELSE 0
|
||||||
END)
|
END)
|
||||||
WHERE
|
WHERE
|
||||||
xp.id = q.level { AND
|
xp.id = q.level { AND
|
||||||
q.id IN(?a)
|
q.id IN(?a)
|
||||||
}';
|
}';
|
||||||
|
|
||||||
$repQuery = '
|
$repQuery = '
|
||||||
UPDATE
|
UPDATE
|
||||||
?_quests q
|
?_quests q
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
dbc_questfactionreward rep ON rep.Id = IF(rewardFactionValue?d > 0, 1, 2)
|
dbc_questfactionreward rep ON rep.Id = IF(rewardFactionValue?d > 0, 1, 2)
|
||||||
SET
|
SET
|
||||||
rewardFactionValue?d = (CASE ABS(rewardFactionValue?d)
|
rewardFactionValue?d = (CASE ABS(rewardFactionValue?d)
|
||||||
WHEN 0 THEN rep.Field1 WHEN 1 THEN rep.Field2 WHEN 2 THEN rep.Field3 WHEN 3 THEN rep.Field4 WHEN 4 THEN rep.Field5
|
WHEN 0 THEN rep.Field1 WHEN 1 THEN rep.Field2 WHEN 2 THEN rep.Field3 WHEN 3 THEN rep.Field4 WHEN 4 THEN rep.Field5
|
||||||
WHEN 5 THEN rep.Field6 WHEN 6 THEN rep.Field7 WHEN 7 THEN rep.Field8 WHEN 8 THEN rep.Field9 WHEN 9 THEN rep.Field10
|
WHEN 5 THEN rep.Field6 WHEN 6 THEN rep.Field7 WHEN 7 THEN rep.Field8 WHEN 8 THEN rep.Field9 WHEN 9 THEN rep.Field10
|
||||||
ELSE 0
|
ELSE 0
|
||||||
END)
|
END)
|
||||||
WHERE
|
WHERE
|
||||||
ABS(rewardFactionValue?d) BETWEEN 1 AND 10 { AND
|
ABS(rewardFactionValue?d) BETWEEN 1 AND 10 { AND
|
||||||
q.id IN(?a)
|
q.id IN(?a)
|
||||||
}';
|
}';
|
||||||
|
|
||||||
|
|
||||||
$lastMax = 0;
|
$lastMax = 0;
|
||||||
while ($quests = DB::World()->select($baseQuery, $lastMax, $ids ?: DBSIMPLE_SKIP, SqlGen::$stepSize))
|
while ($quests = DB::World()->select($baseQuery, $lastMax, $ids ?: DBSIMPLE_SKIP, SqlGen::$stepSize))
|
||||||
{
|
{
|
||||||
$newMax = max(array_column($quests, 'ID'));
|
$newMax = max(array_column($quests, 'ID'));
|
||||||
|
|
||||||
CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax);
|
CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax);
|
||||||
|
|
||||||
$lastMax = $newMax;
|
$lastMax = $newMax;
|
||||||
|
|
||||||
foreach ($quests as $q)
|
foreach ($quests as $q)
|
||||||
DB::Aowow()->query('REPLACE INTO ?_quests VALUES (?a)', array_values($q));
|
DB::Aowow()->query('REPLACE INTO ?_quests VALUES (?a)', array_values($q));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
just some random thoughts here ..
|
just some random thoughts here ..
|
||||||
quest-custom-flags are derived from flags and specialFlags
|
quest-custom-flags are derived from flags and specialFlags
|
||||||
since they are not used further than being sent to JS as wFlags this is fine..
|
since they are not used further than being sent to JS as wFlags this is fine..
|
||||||
should they be saved to db anyway..?
|
should they be saved to db anyway..?
|
||||||
same with QUEST_FLAG_UNAVAILABLE => CUSTOM_EXCLUDE_FOR_LISTVIEW
|
same with QUEST_FLAG_UNAVAILABLE => CUSTOM_EXCLUDE_FOR_LISTVIEW
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// unpack XP-reward
|
// unpack XP-reward
|
||||||
DB::Aowow()->query($xpQuery, $ids ?: DBSIMPLE_SKIP);
|
DB::Aowow()->query($xpQuery, $ids ?: DBSIMPLE_SKIP);
|
||||||
|
|
||||||
// unpack Rep-rewards
|
// unpack Rep-rewards
|
||||||
for ($i = 1; $i < 6; $i++)
|
for ($i = 1; $i < 6; $i++)
|
||||||
DB::Aowow()->query($repQuery, $i, $i, $i, $i, $ids ?: DBSIMPLE_SKIP);
|
DB::Aowow()->query($repQuery, $i, $i, $i, $i, $ids ?: DBSIMPLE_SKIP);
|
||||||
|
|
||||||
// update zoneOrSort/QuestSortID .. well .. now "not documenting" bites me in the ass .. ~700 quests were changed, i don't know by what method
|
// update zoneOrSort/QuestSortID .. well .. now "not documenting" bites me in the ass .. ~700 quests were changed, i don't know by what method
|
||||||
$eventSet = DB::World()->selectCol('SELECT holiday AS ARRAY_KEY, eventEntry FROM game_event WHERE holiday <> 0');
|
$eventSet = DB::World()->selectCol('SELECT holiday AS ARRAY_KEY, eventEntry FROM game_event WHERE holiday <> 0');
|
||||||
$holidaySorts = array(
|
$holidaySorts = array(
|
||||||
141 => -1001, 181 => -374, 201 => -1002,
|
141 => -1001, 181 => -374, 201 => -1002,
|
||||||
301 => -101, 321 => -1005, 324 => -1003,
|
301 => -101, 321 => -1005, 324 => -1003,
|
||||||
327 => -366, 341 => -369, 372 => -370,
|
327 => -366, 341 => -369, 372 => -370,
|
||||||
374 => -364, 376 => -364, 404 => -375,
|
374 => -364, 376 => -364, 404 => -375,
|
||||||
409 => -41, 423 => -376, 424 => -101
|
409 => -41, 423 => -376, 424 => -101
|
||||||
);
|
);
|
||||||
foreach ($holidaySorts as $hId => $sort)
|
foreach ($holidaySorts as $hId => $sort)
|
||||||
if (!empty($eventSet[$hId]))
|
if (!empty($eventSet[$hId]))
|
||||||
DB::Aowow()->query('UPDATE ?_quests SET zoneOrSort = ?d WHERE eventId = ?d{ AND id IN (?a)}', $sort, $eventSet[$hId], $ids ?: DBSIMPLE_SKIP);
|
DB::Aowow()->query('UPDATE ?_quests SET zoneOrSort = ?d WHERE eventId = ?d{ AND id IN (?a)}', $sort, $eventSet[$hId], $ids ?: DBSIMPLE_SKIP);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
zoneorsort for quests will need updating
|
zoneorsort for quests will need updating
|
||||||
points non-instanced area with identic name for instance quests
|
points non-instanced area with identic name for instance quests
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT CONCAT('[',q.zoneorsort,',"',a.name_loc0,'"],')
|
DISTINCT CONCAT('[',q.zoneorsort,',"',a.name_loc0,'"],')
|
||||||
FROM
|
FROM
|
||||||
dbc_map m,
|
dbc_map m,
|
||||||
?_quests q,
|
?_quests q,
|
||||||
dbc_areatable a
|
dbc_areatable a
|
||||||
WHERE
|
WHERE
|
||||||
a.id = q.zoneOrSort AND
|
a.id = q.zoneOrSort AND
|
||||||
q.zoneOrSort > 0 AND
|
q.zoneOrSort > 0 AND
|
||||||
a.mapId = m.id AND
|
a.mapId = m.id AND
|
||||||
m.areaType = 1
|
m.areaType = 1
|
||||||
ORDER BY
|
ORDER BY
|
||||||
a.name_loc0
|
a.name_loc0
|
||||||
ASC;
|
ASC;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// 'special' special cases
|
// 'special' special cases
|
||||||
// fishing quests to stranglethorn extravaganza
|
// fishing quests to stranglethorn extravaganza
|
||||||
DB::Aowow()->query('UPDATE ?_quests SET zoneOrSort = ?d WHERE id IN (?a){ AND id IN (?a)}', -101, [8228, 8229], $ids ?: DBSIMPLE_SKIP);
|
DB::Aowow()->query('UPDATE ?_quests SET zoneOrSort = ?d WHERE id IN (?a){ AND id IN (?a)}', -101, [8228, 8229], $ids ?: DBSIMPLE_SKIP);
|
||||||
// dungeon quests to Misc/Dungeon Finder
|
// dungeon quests to Misc/Dungeon Finder
|
||||||
DB::Aowow()->query('UPDATE ?_quests SET zoneOrSort = ?d WHERE (specialFlags & ?d OR id IN (?a)){ AND id IN (?a)}', -1010, QUEST_FLAG_SPECIAL_DUNGEON_FINDER, [24789, 24791, 24923], $ids ?: DBSIMPLE_SKIP);
|
DB::Aowow()->query('UPDATE ?_quests SET zoneOrSort = ?d WHERE (specialFlags & ?d OR id IN (?a)){ AND id IN (?a)}', -1010, QUEST_FLAG_SPECIAL_DUNGEON_FINDER, [24789, 24791, 24923], $ids ?: DBSIMPLE_SKIP);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,54 +1,54 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/* deps:
|
/* deps:
|
||||||
* creature_queststarter
|
* creature_queststarter
|
||||||
* creature_questender
|
* creature_questender
|
||||||
* game_event_creature_quest
|
* game_event_creature_quest
|
||||||
* gameobject_queststarter
|
* gameobject_queststarter
|
||||||
* gameobject_questender
|
* gameobject_questender
|
||||||
* game_event_gameobject_quest
|
* game_event_gameobject_quest
|
||||||
* item_template
|
* item_template
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = array(
|
$reqDBC = array(
|
||||||
);
|
);
|
||||||
|
|
||||||
function quests_startend(/* array $ids = [] */)
|
function quests_startend(/* array $ids = [] */)
|
||||||
{
|
{
|
||||||
$query['creature'] = '
|
$query['creature'] = '
|
||||||
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';
|
||||||
|
|
||||||
// always rebuild this table from scratch
|
// always rebuild this table from scratch
|
||||||
// or how would i know what to fetch specifically
|
// or how would i know what to fetch specifically
|
||||||
DB::Aowow()->query('TRUNCATE TABLE ?_quests_startend');
|
DB::Aowow()->query('TRUNCATE TABLE ?_quests_startend');
|
||||||
|
|
||||||
foreach ($query as $q)
|
foreach ($query as $q)
|
||||||
{
|
{
|
||||||
$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) ON DUPLICATE KEY UPDATE method = method | VALUES(method), eventId = IF(eventId = 0, VALUES(eventId), eventId)', array_keys($d), array_values($d));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,47 +1,47 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
null,
|
null,
|
||||||
['leader' => 29611, 'factionId' => 72, 'startAreaId' => 12],
|
['leader' => 29611, 'factionId' => 72, 'startAreaId' => 12],
|
||||||
['leader' => 4949, 'factionId' => 76, 'startAreaId' => 14],
|
['leader' => 4949, 'factionId' => 76, 'startAreaId' => 14],
|
||||||
['leader' => 2784, 'factionId' => 47, 'startAreaId' => 1],
|
['leader' => 2784, 'factionId' => 47, 'startAreaId' => 1],
|
||||||
['leader' => 7999, 'factionId' => 96, 'startAreaId' => 141],
|
['leader' => 7999, 'factionId' => 69, 'startAreaId' => 141],
|
||||||
['leader' => 10181, 'factionId' => 68, 'startAreaId' => 85],
|
['leader' => 10181, 'factionId' => 68, 'startAreaId' => 85],
|
||||||
['leader' => 3057, 'factionId' => 81, 'startAreaId' => 215],
|
['leader' => 3057, 'factionId' => 81, 'startAreaId' => 215],
|
||||||
['leader' => 7937, 'factionId' => 54, 'startAreaId' => 1],
|
['leader' => 7937, 'factionId' => 54, 'startAreaId' => 1],
|
||||||
['leader' => 10540, 'factionId' => 530, 'startAreaId' => 14],
|
['leader' => 10540, 'factionId' => 530, 'startAreaId' => 14],
|
||||||
null,
|
null,
|
||||||
['leader' => 16802, 'factionId' => 911, 'startAreaId' => 3430],
|
['leader' => 16802, 'factionId' => 911, 'startAreaId' => 3430],
|
||||||
['leader' => 17468, 'factionId' => 930, 'startAreaId' => 3524]
|
['leader' => 17468, 'factionId' => 930, 'startAreaId' => 3524]
|
||||||
);
|
);
|
||||||
$reqDBC = ['chrraces', 'charbaseinfo'];
|
$reqDBC = ['chrraces', 'charbaseinfo'];
|
||||||
|
|
||||||
function races()
|
function races()
|
||||||
{
|
{
|
||||||
$baseQuery = '
|
$baseQuery = '
|
||||||
REPLACE INTO
|
REPLACE INTO
|
||||||
?_races
|
?_races
|
||||||
SELECT
|
SELECT
|
||||||
Id, 0, flags, 0, factionId, 0, 0, baseLanguage, IF(side = 2, 0, side + 1), fileString, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, expansion
|
Id, 0, flags, 0, factionId, 0, 0, baseLanguage, IF(side = 2, 0, side + 1), fileString, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, expansion
|
||||||
FROM
|
FROM
|
||||||
dbc_chrraces';
|
dbc_chrraces';
|
||||||
|
|
||||||
DB::Aowow()->query($baseQuery);
|
DB::Aowow()->query($baseQuery);
|
||||||
|
|
||||||
// add classMask
|
// add classMask
|
||||||
DB::Aowow()->query('UPDATE ?_races r JOIN (SELECT BIT_OR(1 << (classId - 1)) as classMask, raceId FROM dbc_charbaseinfo GROUP BY raceId) cbi ON cbi.raceId = r.id SET r.classMask = cbi.classMask');
|
DB::Aowow()->query('UPDATE ?_races r JOIN (SELECT BIT_OR(1 << (classId - 1)) as classMask, raceId FROM dbc_charbaseinfo GROUP BY raceId) cbi ON cbi.raceId = r.id SET r.classMask = cbi.classMask');
|
||||||
|
|
||||||
// add cuFlags
|
// add cuFlags
|
||||||
DB::Aowow()->query('UPDATE ?_races SET cuFlags = ?d WHERE flags & ?d', CUSTOM_EXCLUDE_FOR_LISTVIEW, 0x1);
|
DB::Aowow()->query('UPDATE ?_races SET cuFlags = ?d WHERE flags & ?d', CUSTOM_EXCLUDE_FOR_LISTVIEW, 0x1);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
1 => ['displayIdH' => 8571],
|
1 => ['displayIdH' => 8571],
|
||||||
15 => ['displayIdH' => 8571],
|
15 => ['displayIdH' => 8571],
|
||||||
5 => ['displayIdH' => 2289],
|
5 => ['displayIdH' => 2289],
|
||||||
8 => ['displayIdH' => 2289],
|
8 => ['displayIdH' => 2289],
|
||||||
14 => ['displayIdH' => 2289],
|
14 => ['displayIdH' => 2289],
|
||||||
27 => ['displayIdH' => 21244],
|
27 => ['displayIdH' => 21244],
|
||||||
29 => ['displayIdH' => 20872],
|
29 => ['displayIdH' => 20872],
|
||||||
);
|
);
|
||||||
$reqDBC = ['spellshapeshiftform'];
|
$reqDBC = ['spellshapeshiftform'];
|
||||||
|
|
||||||
function shapeshiftforms()
|
function shapeshiftforms()
|
||||||
{
|
{
|
||||||
DB::Aowow()->query('REPLACE INTO ?_shapeshiftforms SELECT * FROM dbc_spellshapeshiftform');
|
DB::Aowow()->query('REPLACE INTO ?_shapeshiftforms SELECT * FROM dbc_spellshapeshiftform');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,58 +1,58 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
393 => ['professionMask' => 0x0000, 'iconId' => 736], // Skinning
|
393 => ['professionMask' => 0x0000, 'iconId' => 736], // Skinning
|
||||||
171 => ['professionMask' => 0x0001, 'recipeSubClass' => 6, 'specializations' => '28677 28675 28672'], // Alchemy
|
171 => ['professionMask' => 0x0001, 'recipeSubClass' => 6, 'specializations' => '28677 28675 28672'], // Alchemy
|
||||||
164 => ['professionMask' => 0x0002, 'recipeSubClass' => 4, 'specializations' => '9788 9787 17041 17040 17039'], // Blacksmithing
|
164 => ['professionMask' => 0x0002, 'recipeSubClass' => 4, 'specializations' => '9788 9787 17041 17040 17039'], // Blacksmithing
|
||||||
185 => ['professionMask' => 0x0004, 'recipeSubClass' => 5], // Cooking
|
185 => ['professionMask' => 0x0004, 'recipeSubClass' => 5], // Cooking
|
||||||
333 => ['professionMask' => 0x0008, 'recipeSubClass' => 8], // Enchanting
|
333 => ['professionMask' => 0x0008, 'recipeSubClass' => 8], // Enchanting
|
||||||
202 => ['professionMask' => 0x0010, 'recipeSubClass' => 3, 'specializations' => '20219 20222'], // Engineering
|
202 => ['professionMask' => 0x0010, 'recipeSubClass' => 3, 'specializations' => '20219 20222'], // Engineering
|
||||||
129 => ['professionMask' => 0x0020, 'recipeSubClass' => 7], // First Aid
|
129 => ['professionMask' => 0x0020, 'recipeSubClass' => 7], // First Aid
|
||||||
755 => ['professionMask' => 0x0040, 'recipeSubClass' => 10], // Jewelcrafting
|
755 => ['professionMask' => 0x0040, 'recipeSubClass' => 10], // Jewelcrafting
|
||||||
165 => ['professionMask' => 0x0080, 'recipeSubClass' => 1, 'specializations' => '10656 10658 10660'], // Leatherworking
|
165 => ['professionMask' => 0x0080, 'recipeSubClass' => 1, 'specializations' => '10656 10658 10660'], // Leatherworking
|
||||||
186 => ['professionMask' => 0x0100], // Mining
|
186 => ['professionMask' => 0x0100], // Mining
|
||||||
197 => ['professionMask' => 0x0200, 'recipeSubClass' => 2, 'specializations' => '26798 26801 26797'], // Tailoring
|
197 => ['professionMask' => 0x0200, 'recipeSubClass' => 2, 'specializations' => '26798 26801 26797'], // Tailoring
|
||||||
356 => ['professionMask' => 0x0400, 'recipeSubClass' => 9], // Fishing
|
356 => ['professionMask' => 0x0400, 'recipeSubClass' => 9], // Fishing
|
||||||
182 => ['professionMask' => 0x0800], // Herbalism
|
182 => ['professionMask' => 0x0800], // Herbalism
|
||||||
773 => ['professionMask' => 0x1000, 'recipeSubClass' => 11], // Inscription
|
773 => ['professionMask' => 0x1000, 'recipeSubClass' => 11], // Inscription
|
||||||
633 => ['iconId' => 936], // lockpicking
|
633 => ['iconId' => 936], // lockpicking
|
||||||
785 => ['name_loc0' => 'Pet - Wasp'], // Pet - Wasp
|
785 => ['name_loc0' => 'Pet - Wasp'], // Pet - Wasp
|
||||||
781 => ['name_loc2' => 'Familier - diablosaure exotique'], // Pet - Exotic Devilsaur
|
781 => ['name_loc2' => 'Familier - diablosaure exotique'], // Pet - Exotic Devilsaur
|
||||||
758 => ['name_loc6' => 'Mascota: Evento - Control remoto', 'name_loc3' => 'Tier - Ereignis Ferngesteuert', 'categoryId' => 7], // Pet - Event - Remote Control
|
758 => ['name_loc6' => 'Mascota: Evento - Control remoto', 'name_loc3' => 'Tier - Ereignis Ferngesteuert', 'categoryId' => 7], // Pet - Event - Remote Control
|
||||||
788 => ['categoryId' => 7], // Pet - Exotic Spirit Beast
|
788 => ['categoryId' => 7], // Pet - Exotic Spirit Beast
|
||||||
);
|
);
|
||||||
$reqDBC = ['skillline', 'spell', 'skilllineability'];
|
$reqDBC = ['skillline', 'spell', 'skilllineability'];
|
||||||
|
|
||||||
function skillline()
|
function skillline()
|
||||||
{
|
{
|
||||||
$baseQuery = '
|
$baseQuery = '
|
||||||
REPLACE INTO
|
REPLACE INTO
|
||||||
?_skillline
|
?_skillline
|
||||||
SELECT
|
SELECT
|
||||||
Id, categoryId, 0, categoryId, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, description_loc0, description_loc2, description_loc3, description_loc6, description_loc8, iconId, 0, 0, ""
|
Id, categoryId, 0, categoryId, name_loc0, name_loc2, name_loc3, name_loc6, name_loc8, description_loc0, description_loc2, description_loc3, description_loc6, description_loc8, iconId, 0, 0, ""
|
||||||
FROM
|
FROM
|
||||||
dbc_skillline';
|
dbc_skillline';
|
||||||
|
|
||||||
DB::Aowow()->query($baseQuery);
|
DB::Aowow()->query($baseQuery);
|
||||||
|
|
||||||
// categorization
|
// categorization
|
||||||
DB::Aowow()->query('UPDATE ?_skillline SET typeCat = -5 WHERE id = 777 OR (categoryId = 9 AND id NOT IN (356, 129, 185, 142, 155))');
|
DB::Aowow()->query('UPDATE ?_skillline SET typeCat = -5 WHERE id = 777 OR (categoryId = 9 AND id NOT IN (356, 129, 185, 142, 155))');
|
||||||
DB::Aowow()->query('UPDATE ?_skillline SET typeCat = -4 WHERE categoryId = 9 AND name_loc0 LIKE "%racial%"');
|
DB::Aowow()->query('UPDATE ?_skillline SET typeCat = -4 WHERE categoryId = 9 AND name_loc0 LIKE "%racial%"');
|
||||||
DB::Aowow()->query('UPDATE ?_skillline SET typeCat = -6 WHERE id IN (778, 788, 758) OR (categoryId = 7 AND name_loc0 LIKE "%pet%")');
|
DB::Aowow()->query('UPDATE ?_skillline SET typeCat = -6 WHERE id IN (778, 788, 758) OR (categoryId = 7 AND name_loc0 LIKE "%pet%")');
|
||||||
|
|
||||||
// more complex fixups
|
// more complex fixups
|
||||||
DB::Aowow()->query('UPDATE ?_skillline sl, dbc_spell s, dbc_skilllineability sla SET sl.iconId = s.iconId WHERE (s.effect1Id IN (25, 26, 40) OR s.effect2Id = 60) AND sla.spellId = s.id AND sl.id = sla.skillLineId');
|
DB::Aowow()->query('UPDATE ?_skillline sl, dbc_spell s, dbc_skilllineability sla SET sl.iconId = s.iconId WHERE (s.effect1Id IN (25, 26, 40) OR s.effect2Id = 60) AND sla.spellId = s.id AND sl.id = sla.skillLineId');
|
||||||
DB::Aowow()->query('UPDATE ?_skillline SET name_loc8 = REPLACE(name_loc8, " - ", ": ") WHERE categoryId = 7 OR id IN (758, 788)');
|
DB::Aowow()->query('UPDATE ?_skillline SET name_loc8 = REPLACE(name_loc8, " - ", ": ") WHERE categoryId = 7 OR id IN (758, 788)');
|
||||||
DB::Aowow()->query('UPDATE ?_skillline SET iconId = ?d WHERE iconId = 0', 1776); // inv_misc_questionmark
|
DB::Aowow()->query('UPDATE ?_skillline SET iconId = ?d WHERE iconId = 0', 1776); // inv_misc_questionmark
|
||||||
DB::Aowow()->query('UPDATE ?_skillline SET cuFlags = ?d WHERE id IN (?a)', CUSTOM_EXCLUDE_FOR_LISTVIEW, [142, 148, 149, 150, 152, 155, 183, 533, 553, 554, 713, 769]);
|
DB::Aowow()->query('UPDATE ?_skillline SET cuFlags = ?d WHERE id IN (?a)', CUSTOM_EXCLUDE_FOR_LISTVIEW, [142, 148, 149, 150, 152, 155, 183, 533, 553, 554, 713, 769]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,271 +1,271 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
// requires https://github.com/TrinityCore/TrinityCore/commit/f989c7182c4cc30f1d0ffdc566c7624a5e108a2f
|
// requires https://github.com/TrinityCore/TrinityCore/commit/f989c7182c4cc30f1d0ffdc566c7624a5e108a2f
|
||||||
|
|
||||||
/* deps:
|
/* deps:
|
||||||
* creature
|
* creature
|
||||||
* creature_addon
|
* creature_addon
|
||||||
* gameobject
|
* gameobject
|
||||||
* gameobject_template
|
* gameobject_template
|
||||||
* vehicle_accessory
|
* vehicle_accessory
|
||||||
* vehicle_accessory_template
|
* vehicle_accessory_template
|
||||||
* script_waypoint
|
* script_waypoint
|
||||||
* waypoints
|
* waypoints
|
||||||
* waypoint_data
|
* waypoint_data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = ['worldmaparea', 'map', 'worldmaptransforms', 'dungeonmap', 'taxipathnode'];
|
$reqDBC = ['worldmaparea', 'map', 'worldmaptransforms', 'dungeonmap', 'taxipathnode'];
|
||||||
|
|
||||||
function spawns() // and waypoints
|
function spawns() // and waypoints
|
||||||
{
|
{
|
||||||
$alphaMapCache = [];
|
$alphaMapCache = [];
|
||||||
$alphaMapCheck = function ($areaId, array &$set) use (&$alphaMapCache)
|
$alphaMapCheck = function ($areaId, array &$set) use (&$alphaMapCache)
|
||||||
{
|
{
|
||||||
$file = 'setup/generated/alphaMaps/'.$areaId.'.png';
|
$file = 'setup/generated/alphaMaps/'.$areaId.'.png';
|
||||||
if (!file_exists($file)) // file does not exist (probably instanced area)
|
if (!file_exists($file)) // file does not exist (probably instanced area)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// invalid and corner cases (literally)
|
// invalid and corner cases (literally)
|
||||||
if (!is_array($set) || empty($set['posX']) || empty($set['posY']) || $set['posX'] >= 100 || $set['posY'] >= 100)
|
if (!is_array($set) || empty($set['posX']) || empty($set['posY']) || $set['posX'] >= 100 || $set['posY'] >= 100)
|
||||||
{
|
{
|
||||||
$set = null;
|
$set = null;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($alphaMapCache[$areaId]))
|
if (empty($alphaMapCache[$areaId]))
|
||||||
$alphaMapCache[$areaId] = imagecreatefrompng($file);
|
$alphaMapCache[$areaId] = imagecreatefrompng($file);
|
||||||
|
|
||||||
// alphaMaps are 1000 x 1000, adapt points [black => valid point]
|
// alphaMaps are 1000 x 1000, adapt points [black => valid point]
|
||||||
if (!imagecolorat($alphaMapCache[$areaId], $set['posX'] * 10, $set['posY'] * 10))
|
if (!imagecolorat($alphaMapCache[$areaId], $set['posX'] * 10, $set['posY'] * 10))
|
||||||
$set = null;
|
$set = null;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
$checkCoords = function ($points) use($alphaMapCheck)
|
$checkCoords = function ($points) use($alphaMapCheck)
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
$capitals = array( // capitals take precedence over their surroundings
|
$capitals = array( // capitals take precedence over their surroundings
|
||||||
1497, 1637, 1638, 3487, // Undercity, Ogrimmar, Thunder Bluff, Silvermoon City
|
1497, 1637, 1638, 3487, // Undercity, Ogrimmar, Thunder Bluff, Silvermoon City
|
||||||
1519, 1537, 1657, 3557, // Stormwind City, Ironforge, Darnassus, The Exodar
|
1519, 1537, 1657, 3557, // Stormwind City, Ironforge, Darnassus, The Exodar
|
||||||
3703, 4395 // Shattrath City, Dalaran
|
3703, 4395 // Shattrath City, Dalaran
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($points as $res)
|
foreach ($points as $res)
|
||||||
{
|
{
|
||||||
if ($alphaMapCheck($res['areaId'], $res))
|
if ($alphaMapCheck($res['areaId'], $res))
|
||||||
{
|
{
|
||||||
if (!$res)
|
if (!$res)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// some rough measure how central the spawn is on the map (the lower the number, the better)
|
// some rough measure how central the spawn is on the map (the lower the number, the better)
|
||||||
// 0: perfect center; 1: touches a border
|
// 0: perfect center; 1: touches a border
|
||||||
$q = abs( (($res['posX'] - 50) / 50) * (($res['posY'] - 50) / 50) );
|
$q = abs( (($res['posX'] - 50) / 50) * (($res['posY'] - 50) / 50) );
|
||||||
|
|
||||||
if (empty($result) || $result[0] > $q)
|
if (empty($result) || $result[0] > $q)
|
||||||
$result = [$q, $res];
|
$result = [$q, $res];
|
||||||
}
|
}
|
||||||
else if (in_array($res['areaId'], $capitals)) // capitals (auto-discovered) and no hand-made alphaMap available
|
else if (in_array($res['areaId'], $capitals)) // capitals (auto-discovered) and no hand-made alphaMap available
|
||||||
return $res;
|
return $res;
|
||||||
else if (empty($result)) // add with lowest quality if alpha map is missing
|
else if (empty($result)) // add with lowest quality if alpha map is missing
|
||||||
$result = [1.0, $res];
|
$result = [1.0, $res];
|
||||||
}
|
}
|
||||||
|
|
||||||
// spawn does not really match on a map, but we need at least one result
|
// spawn does not really match on a map, but we need at least one result
|
||||||
if (!$result)
|
if (!$result)
|
||||||
{
|
{
|
||||||
usort($points, function ($a, $b) { return ($a['quality'] < $b['quality']) ? -1 : 1; });
|
usort($points, function ($a, $b) { return ($a['quality'] < $b['quality']) ? -1 : 1; });
|
||||||
$result = [1.0, $points[0]];
|
$result = [1.0, $points[0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result[1];
|
return $result[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
$query[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` ' .
|
$query[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 '.CLISetup::bold('creature').' spawns'];
|
' - assembling '.CLISetup::bold('creature').' spawns'];
|
||||||
|
|
||||||
$query[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` ' .
|
$query[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 '.CLISetup::bold('gameobject').' spawns'];
|
' - assembling '.CLISetup::bold('gameobject').' spawns'];
|
||||||
|
|
||||||
$query[3] = ['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` ' .
|
$query[3] = ['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 '.CLISetup::bold('script_waypoint')];
|
' - assembling waypoints from '.CLISetup::bold('script_waypoint')];
|
||||||
|
|
||||||
$query[4] = ['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` ' .
|
$query[4] = ['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 '.CLISetup::bold('waypoints')];
|
' - assembling waypoints from '.CLISetup::bold('waypoints')];
|
||||||
|
|
||||||
$query[5] = ['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` ' .
|
$query[5] = ['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 '.CLISetup::bold('waypoint_data')];
|
' - assembling waypoints from '.CLISetup::bold('waypoint_data')];
|
||||||
|
|
||||||
$queryPost = 'SELECT dm.Id, wma.areaId, IFNULL(dm.floor, 0) AS floor, ' .
|
$queryPost = 'SELECT dm.Id, wma.areaId, IFNULL(dm.floor, 0) AS floor, ' .
|
||||||
'100 - ROUND(IF(dm.Id IS NOT NULL, (?f - dm.minY) * 100 / (dm.maxY - dm.minY), (?f - wma.right) * 100 / (wma.left - wma.right)), 1) AS `posX`, ' .
|
'100 - ROUND(IF(dm.Id IS NOT NULL, (?f - dm.minY) * 100 / (dm.maxY - dm.minY), (?f - wma.right) * 100 / (wma.left - wma.right)), 1) AS `posX`, ' .
|
||||||
'100 - ROUND(IF(dm.Id IS NOT NULL, (?f - dm.minX) * 100 / (dm.maxX - dm.minX), (?f - wma.bottom) * 100 / (wma.top - wma.bottom)), 1) AS `posY`, ' .
|
'100 - ROUND(IF(dm.Id IS NOT NULL, (?f - dm.minX) * 100 / (dm.maxX - dm.minX), (?f - wma.bottom) * 100 / (wma.top - wma.bottom)), 1) AS `posY`, ' .
|
||||||
'((abs(IF(dm.Id IS NOT NULL, (?f - dm.minY) * 100 / (dm.maxY - dm.minY), (?f - wma.right) * 100 / (wma.left - wma.right)) - 50) / 50) * ' .
|
'((abs(IF(dm.Id IS NOT NULL, (?f - dm.minY) * 100 / (dm.maxY - dm.minY), (?f - wma.right) * 100 / (wma.left - wma.right)) - 50) / 50) * ' .
|
||||||
' (abs(IF(dm.Id IS NOT NULL, (?f - dm.minX) * 100 / (dm.maxX - dm.minX), (?f - wma.bottom) * 100 / (wma.top - wma.bottom)) - 50) / 50)) AS quality ' .
|
' (abs(IF(dm.Id IS NOT NULL, (?f - dm.minX) * 100 / (dm.maxX - dm.minX), (?f - wma.bottom) * 100 / (wma.top - wma.bottom)) - 50) / 50)) AS quality ' .
|
||||||
'FROM dbc_worldmaparea wma ' .
|
'FROM dbc_worldmaparea wma ' .
|
||||||
'LEFT JOIN dbc_dungeonmap dm ON dm.mapId = IF(?d AND (wma.mapId NOT IN (0, 1, 530, 571) OR wma.areaId = 4395), wma.mapId, -1) ' .
|
'LEFT JOIN dbc_dungeonmap dm ON dm.mapId = IF(?d AND (wma.mapId NOT IN (0, 1, 530, 571) OR wma.areaId = 4395), wma.mapId, -1) ' .
|
||||||
'WHERE wma.mapId = ?d AND IF(?d, wma.areaId = ?d, wma.areaId <> 0) ' .
|
'WHERE wma.mapId = ?d AND IF(?d, wma.areaId = ?d, wma.areaId <> 0) ' .
|
||||||
'HAVING (`posX` BETWEEN 0.1 AND 99.9 AND `posY` BETWEEN 0.1 AND 99.9) AND (dm.Id IS NULL OR ?d) ' .
|
'HAVING (`posX` BETWEEN 0.1 AND 99.9 AND `posY` BETWEEN 0.1 AND 99.9) AND (dm.Id IS NULL OR ?d) ' .
|
||||||
'ORDER BY quality ASC';
|
'ORDER BY quality ASC';
|
||||||
|
|
||||||
|
|
||||||
/*********************/
|
/*********************/
|
||||||
/* truncate old data */
|
/* truncate old data */
|
||||||
/*********************/
|
/*********************/
|
||||||
|
|
||||||
DB::Aowow()->query('TRUNCATE TABLE ?_spawns');
|
DB::Aowow()->query('TRUNCATE TABLE ?_spawns');
|
||||||
DB::Aowow()->query('TRUNCATE TABLE ?_creature_waypoints');
|
DB::Aowow()->query('TRUNCATE TABLE ?_creature_waypoints');
|
||||||
|
|
||||||
|
|
||||||
/**************************/
|
/**************************/
|
||||||
/* offsets for transports */
|
/* offsets for transports */
|
||||||
/**************************/
|
/**************************/
|
||||||
|
|
||||||
$transports = DB::World()->selectCol('SELECT Data0 AS pathId, Data6 AS ARRAY_KEY FROM gameobject_template WHERE type = 15 AND Data6 <> 0');
|
$transports = DB::World()->selectCol('SELECT Data0 AS pathId, Data6 AS ARRAY_KEY FROM gameobject_template WHERE type = 15 AND Data6 <> 0');
|
||||||
foreach ($transports as &$t)
|
foreach ($transports as &$t)
|
||||||
$t = DB::Aowow()->selectRow('SELECT posX, posY, mapId FROM dbc_taxipathnode tpn WHERE tpn.pathId = ?d AND nodeIdx = 0', $t);
|
$t = DB::Aowow()->selectRow('SELECT posX, posY, mapId FROM dbc_taxipathnode tpn WHERE tpn.pathId = ?d AND nodeIdx = 0', $t);
|
||||||
|
|
||||||
|
|
||||||
/**************/
|
/**************/
|
||||||
/* perform... */
|
/* perform... */
|
||||||
/**************/
|
/**************/
|
||||||
|
|
||||||
foreach ($query as $idx => $q)
|
foreach ($query as $idx => $q)
|
||||||
{
|
{
|
||||||
CLISetup::log($q[1]);
|
CLISetup::log($q[1]);
|
||||||
|
|
||||||
$n = 0;
|
$n = 0;
|
||||||
$sum = 0;
|
$sum = 0;
|
||||||
foreach (DB::World()->select($q[0]) as $spawn)
|
foreach (DB::World()->select($q[0]) as $spawn)
|
||||||
{
|
{
|
||||||
if (!$n)
|
if (!$n)
|
||||||
CLISetup::log(' * sets '.($sum + 1).' - '.($sum += SqlGen::$stepSize));
|
CLISetup::log(' * sets '.($sum + 1).' - '.($sum += SqlGen::$stepSize));
|
||||||
|
|
||||||
if ($n++ > SqlGen::$stepSize)
|
if ($n++ > SqlGen::$stepSize)
|
||||||
$n = 0;
|
$n = 0;
|
||||||
|
|
||||||
// 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
|
||||||
// also note, that transport DO spawn outside of displayable area maps .. another todo i guess..
|
// also note, that transport DO spawn outside of displayable area maps .. another todo i guess..
|
||||||
if (isset($transports[$spawn['map']]))
|
if (isset($transports[$spawn['map']]))
|
||||||
{
|
{
|
||||||
$spawn['posX'] += $transports[$spawn['map']]['posY'];
|
$spawn['posX'] += $transports[$spawn['map']]['posY'];
|
||||||
$spawn['posY'] += $transports[$spawn['map']]['posX'];
|
$spawn['posY'] += $transports[$spawn['map']]['posX'];
|
||||||
$spawn['map'] = $transports[$spawn['map']]['mapId'];
|
$spawn['map'] = $transports[$spawn['map']]['mapId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$points = DB::Aowow()->select($queryPost, $spawn['posX'], $spawn['posX'], $spawn['posY'], $spawn['posY'], $spawn['posX'], $spawn['posX'], $spawn['posY'], $spawn['posY'], 1, $spawn['map'], $spawn['areaId'], $spawn['areaId'], $spawn['areaId'] ? 1 : 0);
|
$points = DB::Aowow()->select($queryPost, $spawn['posX'], $spawn['posX'], $spawn['posY'], $spawn['posY'], $spawn['posX'], $spawn['posX'], $spawn['posY'], $spawn['posY'], 1, $spawn['map'], $spawn['areaId'], $spawn['areaId'], $spawn['areaId'] ? 1 : 0);
|
||||||
if (!$points) // retry: TC counts pre-instance subareas as instance-maps .. which have no map file
|
if (!$points) // retry: TC counts pre-instance subareas as instance-maps .. which have no map file
|
||||||
$points = DB::Aowow()->select($queryPost, $spawn['posX'], $spawn['posX'], $spawn['posY'], $spawn['posY'], $spawn['posX'], $spawn['posX'], $spawn['posY'], $spawn['posY'], 0, $spawn['map'], 0, 0, 1);
|
$points = DB::Aowow()->select($queryPost, $spawn['posX'], $spawn['posX'], $spawn['posY'], $spawn['posY'], $spawn['posX'], $spawn['posX'], $spawn['posY'], $spawn['posY'], 0, $spawn['map'], 0, 0, 1);
|
||||||
|
|
||||||
if (!$points) // still impossible (there are areas that are intentionally off the map (e.g. the isles south of tanaris))
|
if (!$points) // still impossible (there are areas that are intentionally off the map (e.g. the isles south of tanaris))
|
||||||
{
|
{
|
||||||
CLISetup::log('GUID '.$spawn['guid'].($idx < 3 ? '' : ' on path/point '.$spawn['npcOrPath'].'/'.$spawn['point']).' could not be matched to displayable area [A:'.$spawn['areaId'].'; X:'.$spawn['posY'].'; Y:'.$spawn['posX'].']', CLISetup::LOG_WARN);
|
CLISetup::log('GUID '.$spawn['guid'].($idx < 3 ? '' : ' on path/point '.$spawn['npcOrPath'].'/'.$spawn['point']).' could not be matched to displayable area [A:'.$spawn['areaId'].'; X:'.$spawn['posY'].'; Y:'.$spawn['posX'].']', CLISetup::LOG_WARN);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if areaId is set, area was determined by TC .. we're fine .. mostly
|
// if areaId is set, area was determined by TC .. we're fine .. mostly
|
||||||
$final = $spawn['areaId'] ? $points[0] : $checkCoords($points);
|
$final = $spawn['areaId'] ? $points[0] : $checkCoords($points);
|
||||||
|
|
||||||
if ($idx < 3)
|
if ($idx < 3)
|
||||||
{
|
{
|
||||||
$set = array(
|
$set = array(
|
||||||
'guid' => $spawn['guid'],
|
'guid' => $spawn['guid'],
|
||||||
'type' => $spawn['type'],
|
'type' => $spawn['type'],
|
||||||
'typeId' => $spawn['typeId'],
|
'typeId' => $spawn['typeId'],
|
||||||
'respawn' => $spawn['respawn'],
|
'respawn' => $spawn['respawn'],
|
||||||
'phaseMask' => $spawn['phaseMask'],
|
'phaseMask' => $spawn['phaseMask'],
|
||||||
'pathId' => $spawn['pathId'],
|
'pathId' => $spawn['pathId'],
|
||||||
'areaId' => $final['areaId'],
|
'areaId' => $final['areaId'],
|
||||||
'floor' => $final['floor'],
|
'floor' => $final['floor'],
|
||||||
'posX' => $final['posX'],
|
'posX' => $final['posX'],
|
||||||
'posY' => $final['posY']
|
'posY' => $final['posY']
|
||||||
);
|
);
|
||||||
|
|
||||||
DB::Aowow()->query('REPLACE INTO ?_spawns (?#) VALUES (?a)', array_keys($set), array_values($set));
|
DB::Aowow()->query('REPLACE INTO ?_spawns (?#) VALUES (?a)', array_keys($set), array_values($set));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$set = array(
|
$set = array(
|
||||||
'creatureOrPath' => $spawn['npcOrPath'],
|
'creatureOrPath' => $spawn['npcOrPath'],
|
||||||
'point' => $spawn['point'],
|
'point' => $spawn['point'],
|
||||||
'wait' => $spawn['wait'],
|
'wait' => $spawn['wait'],
|
||||||
'areaId' => $final['areaId'],
|
'areaId' => $final['areaId'],
|
||||||
'floor' => $final['floor'],
|
'floor' => $final['floor'],
|
||||||
'posX' => $final['posX'],
|
'posX' => $final['posX'],
|
||||||
'posY' => $final['posY']
|
'posY' => $final['posY']
|
||||||
);
|
);
|
||||||
|
|
||||||
DB::Aowow()->query('REPLACE INTO ?_creature_waypoints (?#) VALUES (?a)', array_keys($set), array_values($set));
|
DB::Aowow()->query('REPLACE INTO ?_creature_waypoints (?#) VALUES (?a)', array_keys($set), array_values($set));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************/
|
/*****************************/
|
||||||
/* spawn vehicle accessories */
|
/* spawn vehicle accessories */
|
||||||
/*****************************/
|
/*****************************/
|
||||||
|
|
||||||
// get vehicle template accessories
|
// get vehicle template accessories
|
||||||
$accessories = DB::World()->select('
|
$accessories = DB::World()->select('
|
||||||
SELECT vta.accessory_entry AS typeId, c.guid, vta.entry, count(1) AS nSeats FROM vehicle_template_accessory vta LEFT JOIN creature c ON c.id = vta.entry GROUP BY accessory_entry, c.guid UNION
|
SELECT vta.accessory_entry AS typeId, c.guid, vta.entry, count(1) AS nSeats FROM vehicle_template_accessory vta LEFT JOIN creature c ON c.id = vta.entry GROUP BY accessory_entry, c.guid UNION
|
||||||
SELECT va.accessory_entry AS typeId, va.guid, 0 AS entry, count(1) AS nSeats FROM vehicle_accessory va GROUP BY accessory_entry, va.guid');
|
SELECT va.accessory_entry AS typeId, va.guid, 0 AS entry, count(1) AS nSeats FROM vehicle_accessory va GROUP BY accessory_entry, va.guid');
|
||||||
|
|
||||||
// accessories may also be vehicles (e.g. "Kor'kron Infiltrator" is seated on "Kor'kron Suppression Turret" is seated on "Kor'kron Troop Transport")
|
// accessories may also be vehicles (e.g. "Kor'kron Infiltrator" is seated on "Kor'kron Suppression Turret" is seated on "Kor'kron Troop Transport")
|
||||||
// so we will retry finding a spawned vehicle if none were found on the previous pass and a change occured
|
// so we will retry finding a spawned vehicle if none were found on the previous pass and a change occured
|
||||||
$vGuid = 0; // not really used, but we need some kind of index
|
$vGuid = 0; // not really used, but we need some kind of index
|
||||||
$n = 0;
|
$n = 0;
|
||||||
$matches = -1;
|
$matches = -1;
|
||||||
while ($matches)
|
while ($matches)
|
||||||
{
|
{
|
||||||
$matches = 0;
|
$matches = 0;
|
||||||
foreach ($accessories as $idx => $data)
|
foreach ($accessories as $idx => $data)
|
||||||
{
|
{
|
||||||
$vehicles = [];
|
$vehicles = [];
|
||||||
if ($data['guid']) // vehicle already spawned
|
if ($data['guid']) // vehicle already spawned
|
||||||
$vehicles = DB::Aowow()->select('SELECT s.areaId, s.posX, s.posY, s.floor FROM ?_spawns s WHERE s.guid = ?d AND s.type = ?d', $data['guid'], TYPE_NPC);
|
$vehicles = DB::Aowow()->select('SELECT s.areaId, s.posX, s.posY, s.floor FROM ?_spawns s WHERE s.guid = ?d AND s.type = ?d', $data['guid'], TYPE_NPC);
|
||||||
else if ($data['entry']) // vehicle on unspawned vehicle action
|
else if ($data['entry']) // vehicle on unspawned vehicle action
|
||||||
$vehicles = DB::Aowow()->select('SELECT s.areaId, s.posX, s.posY, s.floor FROM ?_spawns s WHERE s.typeId = ?d AND s.type = ?d', $data['entry'], TYPE_NPC);
|
$vehicles = DB::Aowow()->select('SELECT s.areaId, s.posX, s.posY, s.floor FROM ?_spawns s WHERE s.typeId = ?d AND s.type = ?d', $data['entry'], TYPE_NPC);
|
||||||
|
|
||||||
if ($vehicles)
|
if ($vehicles)
|
||||||
{
|
{
|
||||||
$matches++;
|
$matches++;
|
||||||
foreach ($vehicles as $v) // if there is more than one vehicle, its probably due to overlapping zones
|
foreach ($vehicles as $v) // if there is more than one vehicle, its probably due to overlapping zones
|
||||||
for ($i = 0; $i < $data['nSeats']; $i++)
|
for ($i = 0; $i < $data['nSeats']; $i++)
|
||||||
DB::Aowow()->query('
|
DB::Aowow()->query('
|
||||||
REPLACE INTO ?_spawns (`guid`, `type`, `typeId`, `respawn`, `spawnMask`, `phaseMask`, `areaId`, `floor`, `posX`, `posY`, `pathId`) VALUES
|
REPLACE INTO ?_spawns (`guid`, `type`, `typeId`, `respawn`, `spawnMask`, `phaseMask`, `areaId`, `floor`, `posX`, `posY`, `pathId`) VALUES
|
||||||
(?d, ?d, ?d, 0, 0, 1, ?d, ?d, ?d, ?d, 0)', --$vGuid, TYPE_NPC, $data['typeId'], $v['areaId'], $v['floor'], $v['posX'], $v['posY']);
|
(?d, ?d, ?d, 0, 0, 1, ?d, ?d, ?d, ?d, 0)', --$vGuid, TYPE_NPC, $data['typeId'], $v['areaId'], $v['floor'], $v['posX'], $v['posY']);
|
||||||
|
|
||||||
unset($accessories[$idx]);
|
unset($accessories[$idx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($matches)
|
if ($matches)
|
||||||
CLISetup::log(' * assigned '.$matches.' accessories on '.++$n.'. pass on vehicle accessories');
|
CLISetup::log(' * assigned '.$matches.' accessories on '.++$n.'. pass on vehicle accessories');
|
||||||
}
|
}
|
||||||
if ($accessories)
|
if ($accessories)
|
||||||
CLISetup::log(count($accessories).' accessories could not be fitted onto a spawned vehicle.', CLISetup::LOG_WARN);
|
CLISetup::log(count($accessories).' accessories could not be fitted onto a spawned vehicle.', CLISetup::LOG_WARN);
|
||||||
|
|
||||||
|
|
||||||
/********************************/
|
/********************************/
|
||||||
/* restrict difficulty displays */
|
/* restrict difficulty displays */
|
||||||
/********************************/
|
/********************************/
|
||||||
|
|
||||||
DB::Aowow()->query('UPDATE ?_spawns s, dbc_worldmaparea wma, dbc_map m SET s.spawnMask = 0 WHERE s.areaId = wma.areaId AND wma.mapId = m.Id AND m.areaType IN (0, 3, 4)');
|
DB::Aowow()->query('UPDATE ?_spawns s, dbc_worldmaparea wma, dbc_map m SET s.spawnMask = 0 WHERE s.areaId = wma.areaId AND wma.mapId = m.Id AND m.areaType IN (0, 3, 4)');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,32 +1,32 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/* deps:
|
/* deps:
|
||||||
* spelldifficulty_dbc
|
* spelldifficulty_dbc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = ['spelldifficulty'];
|
$reqDBC = ['spelldifficulty'];
|
||||||
|
|
||||||
function spelldifficulty(array $ids = [])
|
function spelldifficulty(array $ids = [])
|
||||||
{
|
{
|
||||||
// has no unique keys..
|
// has no unique keys..
|
||||||
DB::Aowow()->query('TRUNCATE TABLE ?_spelldifficulty');
|
DB::Aowow()->query('TRUNCATE TABLE ?_spelldifficulty');
|
||||||
|
|
||||||
DB::Aowow()->query('INSERT INTO ?_spelldifficulty SELECT * FROM dbc_spelldifficulty');
|
DB::Aowow()->query('INSERT INTO ?_spelldifficulty SELECT * FROM dbc_spelldifficulty');
|
||||||
|
|
||||||
$rows = DB::World()->select('SELECT spellid0, spellid1, spellid2, spellid3 FROM spelldifficulty_dbc');
|
$rows = DB::World()->select('SELECT spellid0, spellid1, spellid2, spellid3 FROM spelldifficulty_dbc');
|
||||||
foreach ($rows as $r)
|
foreach ($rows as $r)
|
||||||
DB::Aowow()->query('INSERT INTO ?_spelldifficulty VALUES (?a)', array_values($r));
|
DB::Aowow()->query('INSERT INTO ?_spelldifficulty VALUES (?a)', array_values($r));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = ['talent', 'talenttab'];
|
$reqDBC = ['talent', 'talenttab'];
|
||||||
|
|
||||||
function talents()
|
function talents()
|
||||||
{
|
{
|
||||||
// class: 0 => hunter pets
|
// class: 0 => hunter pets
|
||||||
for ($i = 1; $i < 6; $i++)
|
for ($i = 1; $i < 6; $i++)
|
||||||
DB::Aowow()->query(
|
DB::Aowow()->query(
|
||||||
'REPLACE INTO ?_talents SELECT t.Id, IF(tt.classMask <> 0, LOG(2, tt.classMask) + 1, 0), IF(tt.creaturefamilyMask <> 0, LOG(2, tt.creaturefamilyMask), tt.tabNumber), t.row, t.column, t.rank?d, ?d FROM dbc_talenttab tt JOIN dbc_talent t ON tt.Id = t.tabId WHERE t.rank?d <> 0',
|
'REPLACE INTO ?_talents SELECT t.Id, IF(tt.classMask <> 0, LOG(2, tt.classMask) + 1, 0), IF(tt.creaturefamilyMask <> 0, LOG(2, tt.creaturefamilyMask), tt.tabNumber), t.row, t.column, t.rank?d, ?d FROM dbc_talenttab tt JOIN dbc_talent t ON tt.Id = t.tabId WHERE t.rank?d <> 0',
|
||||||
$i, $i, $i
|
$i, $i, $i
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,173 +1,173 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/* deps
|
/* deps
|
||||||
* creature_template
|
* creature_template
|
||||||
* creature
|
* creature
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
);
|
);
|
||||||
$reqDBC = ['taxipath', 'taxinodes', 'worldmaparea', 'worldmaptransforms', 'factiontemplate'];
|
$reqDBC = ['taxipath', 'taxinodes', 'worldmaparea', 'worldmaptransforms', 'factiontemplate'];
|
||||||
|
|
||||||
function taxi() // path & nodes
|
function taxi() // path & nodes
|
||||||
{
|
{
|
||||||
/*********/
|
/*********/
|
||||||
/* paths */
|
/* paths */
|
||||||
/*********/
|
/*********/
|
||||||
|
|
||||||
DB::Aowow()->query('REPLACE INTO ?_taxipath SELECT tp.id, tp.startNodeId, tp.endNodeId FROM dbc_taxipath tp WHERE tp.startNodeId > 0 AND tp.EndNodeId > 0');
|
DB::Aowow()->query('REPLACE INTO ?_taxipath SELECT tp.id, tp.startNodeId, tp.endNodeId FROM dbc_taxipath tp WHERE tp.startNodeId > 0 AND tp.EndNodeId > 0');
|
||||||
|
|
||||||
// paths are monodirectional and thus exist twice for regular flight travel (which is bidirectional)
|
// paths are monodirectional and thus exist twice for regular flight travel (which is bidirectional)
|
||||||
$paths = DB::Aowow()->select('SELECT id AS ARRAY_KEY, tp.* FROM ?_taxipath tp');
|
$paths = DB::Aowow()->select('SELECT id AS ARRAY_KEY, tp.* FROM ?_taxipath tp');
|
||||||
foreach ($paths as $i => $p)
|
foreach ($paths as $i => $p)
|
||||||
{
|
{
|
||||||
foreach ($paths as $j => $_)
|
foreach ($paths as $j => $_)
|
||||||
{
|
{
|
||||||
if ($_['startNodeId'] == $p['endNodeId'] AND $_['endNodeId'] == $p['startNodeId'])
|
if ($_['startNodeId'] == $p['endNodeId'] AND $_['endNodeId'] == $p['startNodeId'])
|
||||||
{
|
{
|
||||||
DB::Aowow()->query('DELETE FROM ?_taxipath WHERE Id = ?d', $j);
|
DB::Aowow()->query('DELETE FROM ?_taxipath WHERE Id = ?d', $j);
|
||||||
unset($paths[$j]);
|
unset($paths[$j]);
|
||||||
unset($paths[$i]);
|
unset($paths[$i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********/
|
/*********/
|
||||||
/* nodes */
|
/* nodes */
|
||||||
/*********/
|
/*********/
|
||||||
|
|
||||||
// all sensible nodes
|
// all sensible nodes
|
||||||
$fNodes = DB::Aowow()->select(
|
$fNodes = DB::Aowow()->select(
|
||||||
'SELECT
|
'SELECT
|
||||||
tn.id,
|
tn.id,
|
||||||
tn.mapId,
|
tn.mapId,
|
||||||
100 - ROUND((tn.posY - wma.right) * 100 / (wma.left - wma.right), 1) AS posX,
|
100 - ROUND((tn.posY - wma.right) * 100 / (wma.left - wma.right), 1) AS posX,
|
||||||
100 - ROUND((tn.posX - wma.bottom) * 100 / (wma.top - wma.bottom), 1) AS poxY,
|
100 - ROUND((tn.posX - wma.bottom) * 100 / (wma.top - wma.bottom), 1) AS poxY,
|
||||||
1 AS type,
|
1 AS type,
|
||||||
0 AS typeId,
|
0 AS typeId,
|
||||||
1 AS reactA,
|
1 AS reactA,
|
||||||
1 AS reactH,
|
1 AS reactH,
|
||||||
tn.name_loc0, tn.name_loc2, tn.name_loc3, tn.name_loc6, tn.name_loc8,
|
tn.name_loc0, tn.name_loc2, tn.name_loc3, tn.name_loc6, tn.name_loc8,
|
||||||
tn.mapId AS origMap,
|
tn.mapId AS origMap,
|
||||||
tn.posX AS origPosX,
|
tn.posX AS origPosX,
|
||||||
tn.posY AS origPosY
|
tn.posY AS origPosY
|
||||||
FROM
|
FROM
|
||||||
dbc_taxinodes tn
|
dbc_taxinodes tn
|
||||||
JOIN
|
JOIN
|
||||||
dbc_worldmaparea wma ON ( tn.mapId = wma.mapId AND tn.posX BETWEEN wma.bottom AND wma.top AND tn.posY BETWEEN wma.right AND wma.left)
|
dbc_worldmaparea wma ON ( tn.mapId = wma.mapId AND tn.posX BETWEEN wma.bottom AND wma.top AND tn.posY BETWEEN wma.right AND wma.left)
|
||||||
WHERE
|
WHERE
|
||||||
wma.areaId = 0 AND
|
wma.areaId = 0 AND
|
||||||
wma.mapId = tn.mapId AND
|
wma.mapId = tn.mapId AND
|
||||||
tn.id NOT IN (15, 148, 225, 235) AND
|
tn.id NOT IN (15, 148, 225, 235) AND
|
||||||
(
|
(
|
||||||
tn.id IN (64, 250) OR
|
tn.id IN (64, 250) OR
|
||||||
(
|
(
|
||||||
tn.name_loc0 NOT LIKE "%Transport%" AND
|
tn.name_loc0 NOT LIKE "%Transport%" AND
|
||||||
tn.name_loc0 NOT LIKE "%Quest%" AND
|
tn.name_loc0 NOT LIKE "%Quest%" AND
|
||||||
tn.name_loc0 NOT LIKE "%Start%" AND
|
tn.name_loc0 NOT LIKE "%Start%" AND
|
||||||
tn.name_loc0 NOT LIKE "%End%"
|
tn.name_loc0 NOT LIKE "%End%"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
UNION
|
UNION
|
||||||
SELECT
|
SELECT
|
||||||
tn.id,
|
tn.id,
|
||||||
wmt.targetMapId,
|
wmt.targetMapId,
|
||||||
100 - ROUND((tn.posY + wmt.offsetY - wma.right) * 100 / (wma.left - wma.right), 1) AS posX,
|
100 - ROUND((tn.posY + wmt.offsetY - wma.right) * 100 / (wma.left - wma.right), 1) AS posX,
|
||||||
100 - ROUND((tn.posX + wmt.offsetX - wma.bottom) * 100 / (wma.top - wma.bottom), 1) AS poxY,
|
100 - ROUND((tn.posX + wmt.offsetX - wma.bottom) * 100 / (wma.top - wma.bottom), 1) AS poxY,
|
||||||
1 AS type,
|
1 AS type,
|
||||||
0 AS typeId,
|
0 AS typeId,
|
||||||
1 AS reactA,
|
1 AS reactA,
|
||||||
1 AS reactH,
|
1 AS reactH,
|
||||||
tn.name_loc0, tn.name_loc2, tn.name_loc3, tn.name_loc6, tn.name_loc8,
|
tn.name_loc0, tn.name_loc2, tn.name_loc3, tn.name_loc6, tn.name_loc8,
|
||||||
tn.mapId AS origMap,
|
tn.mapId AS origMap,
|
||||||
tn.posX AS origPosX,
|
tn.posX AS origPosX,
|
||||||
tn.posY AS origPosY
|
tn.posY AS origPosY
|
||||||
FROM
|
FROM
|
||||||
dbc_taxinodes tn
|
dbc_taxinodes tn
|
||||||
JOIN
|
JOIN
|
||||||
dbc_worldmaptransforms wmt ON ( tn.mapId = wmt.sourceMapId AND tn.posX BETWEEN wmt.minX AND wmt.maxX AND tn.posY BETWEEN wmt.minY AND wmt.maxY)
|
dbc_worldmaptransforms wmt ON ( tn.mapId = wmt.sourceMapId AND tn.posX BETWEEN wmt.minX AND wmt.maxX AND tn.posY BETWEEN wmt.minY AND wmt.maxY)
|
||||||
JOIN
|
JOIN
|
||||||
dbc_worldmaparea wma ON ( wmt.targetMapId = wma.mapId AND tn.posX + wmt.offsetX BETWEEN wma.bottom AND wma.top AND tn.posY + wmt.offsetY BETWEEN wma.right AND wma.left)
|
dbc_worldmaparea wma ON ( wmt.targetMapId = wma.mapId AND tn.posX + wmt.offsetX BETWEEN wma.bottom AND wma.top AND tn.posY + wmt.offsetY BETWEEN wma.right AND wma.left)
|
||||||
WHERE
|
WHERE
|
||||||
wma.areaId = 0 AND
|
wma.areaId = 0 AND
|
||||||
wmt.sourcemapId = tn.mapId AND
|
wmt.sourcemapId = tn.mapId AND
|
||||||
tn.name_loc0 NOT LIKE "%Transport%" AND
|
tn.name_loc0 NOT LIKE "%Transport%" AND
|
||||||
tn.name_loc0 NOT LIKE "%Quest%" AND
|
tn.name_loc0 NOT LIKE "%Quest%" AND
|
||||||
tn.name_loc0 NOT LIKE "%Start%" AND
|
tn.name_loc0 NOT LIKE "%Start%" AND
|
||||||
tn.name_loc0 NOT LIKE "%End%"');
|
tn.name_loc0 NOT LIKE "%End%"');
|
||||||
|
|
||||||
// all available flightmaster
|
// all available flightmaster
|
||||||
$fMaster = DB::World()->select(
|
$fMaster = DB::World()->select(
|
||||||
'SELECT ct.entry, ct.faction, c.map, c.position_x AS posX, c.position_y AS posY FROM creature_template ct JOIN creature c ON c.id = ct.entry WHERE ct.npcflag & ?d OR c.npcflag & ?d',
|
'SELECT ct.entry, ct.faction, c.map, c.position_x AS posX, c.position_y AS posY FROM creature_template ct JOIN creature c ON c.id = ct.entry WHERE ct.npcflag & ?d OR c.npcflag & ?d',
|
||||||
NPC_FLAG_FLIGHT_MASTER, NPC_FLAG_FLIGHT_MASTER
|
NPC_FLAG_FLIGHT_MASTER, NPC_FLAG_FLIGHT_MASTER
|
||||||
);
|
);
|
||||||
|
|
||||||
// assign nearest flightmaster to node
|
// assign nearest flightmaster to node
|
||||||
foreach ($fNodes as &$n)
|
foreach ($fNodes as &$n)
|
||||||
{
|
{
|
||||||
foreach ($fMaster as &$c)
|
foreach ($fMaster as &$c)
|
||||||
{
|
{
|
||||||
if ($c['map'] != $n['origMap'])
|
if ($c['map'] != $n['origMap'])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$dist = pow($c['posX'] - $n['origPosX'], 2) + pow($c['posY'] - $n['origPosY'], 2);
|
$dist = pow($c['posX'] - $n['origPosX'], 2) + pow($c['posY'] - $n['origPosY'], 2);
|
||||||
if ($dist > 1000)
|
if ($dist > 1000)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!isset($n['dist']) || $n['dist'] < $dist)
|
if (!isset($n['dist']) || $n['dist'] < $dist)
|
||||||
{
|
{
|
||||||
$n['dist'] = $dist;
|
$n['dist'] = $dist;
|
||||||
$n['typeId'] = $c['entry'];
|
$n['typeId'] = $c['entry'];
|
||||||
$n['faction'] = $c['faction'];
|
$n['faction'] = $c['faction'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($n);
|
unset($n);
|
||||||
|
|
||||||
// fetch reactions per faction
|
// fetch reactions per faction
|
||||||
$factions = DB::Aowow()->query('
|
$factions = DB::Aowow()->query('
|
||||||
SELECT
|
SELECT
|
||||||
Id AS ARRAY_KEY,
|
Id AS ARRAY_KEY,
|
||||||
IF(enemyFactionId1 = 1 OR enemyFactionId2 = 1 OR enemyFactionId3 = 1 OR enemyFactionId4 = 1 OR hostileMask & 0x3, -1, 1) AS reactA,
|
IF(enemyFactionId1 = 1 OR enemyFactionId2 = 1 OR enemyFactionId3 = 1 OR enemyFactionId4 = 1 OR hostileMask & 0x3, -1, 1) AS reactA,
|
||||||
IF(enemyFactionId1 = 2 OR enemyFactionId2 = 2 OR enemyFactionId3 = 2 OR enemyFactionId4 = 2 OR hostileMask & 0x5, -1, 1) AS reactH
|
IF(enemyFactionId1 = 2 OR enemyFactionId2 = 2 OR enemyFactionId3 = 2 OR enemyFactionId4 = 2 OR hostileMask & 0x5, -1, 1) AS reactH
|
||||||
FROM
|
FROM
|
||||||
dbc_factiontemplate
|
dbc_factiontemplate
|
||||||
WHERE
|
WHERE
|
||||||
Id IN (?a)',
|
Id IN (?a)',
|
||||||
array_column($fNodes, 'faction')
|
array_column($fNodes, 'faction')
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($fNodes as $n)
|
foreach ($fNodes as $n)
|
||||||
{
|
{
|
||||||
if (empty($n['faction']))
|
if (empty($n['faction']))
|
||||||
{
|
{
|
||||||
CLISetup::log(' - ['.$n['id'].'] "'.$n['name_loc0'].'" has no NPC assigned ... skipping', CLISetup::LOG_WARN);
|
CLISetup::log(' - ['.$n['id'].'] "'.$n['name_loc0'].'" has no NPC assigned ... skipping', CLISetup::LOG_WARN);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($factions[$n['faction']]))
|
if (isset($factions[$n['faction']]))
|
||||||
{
|
{
|
||||||
$n['reactA'] = $factions[$n['faction']]['reactA'];
|
$n['reactA'] = $factions[$n['faction']]['reactA'];
|
||||||
$n['reactH'] = $factions[$n['faction']]['reactH'];
|
$n['reactH'] = $factions[$n['faction']]['reactH'];
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($n['faction'], $n['origMap'], $n['origPosX'], $n['origPosY'], $n['dist']);
|
unset($n['faction'], $n['origMap'], $n['origPosX'], $n['origPosY'], $n['dist']);
|
||||||
|
|
||||||
DB::Aowow()->query('REPLACE INTO ?_taxinodes VALUES (?a)', array_values($n));
|
DB::Aowow()->query('REPLACE INTO ?_taxinodes VALUES (?a)', array_values($n));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,103 +1,103 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
/* deps:
|
/* deps:
|
||||||
* quest_template
|
* quest_template
|
||||||
* game_event_seasonal_questrelation
|
* game_event_seasonal_questrelation
|
||||||
* game_event
|
* game_event
|
||||||
* achievement_reward
|
* achievement_reward
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
137 => ['gender' => 2],
|
137 => ['gender' => 2],
|
||||||
138 => ['gender' => 1],
|
138 => ['gender' => 1],
|
||||||
);
|
);
|
||||||
$reqDBC = ['chartitles'];
|
$reqDBC = ['chartitles'];
|
||||||
|
|
||||||
function titles()
|
function titles()
|
||||||
{
|
{
|
||||||
$titleHoliday = array(
|
$titleHoliday = array(
|
||||||
137 => 201,
|
137 => 201,
|
||||||
138 => 201,
|
138 => 201,
|
||||||
124 => 324,
|
124 => 324,
|
||||||
135 => 423,
|
135 => 423,
|
||||||
155 => 181,
|
155 => 181,
|
||||||
133 => 372,
|
133 => 372,
|
||||||
74 => 327,
|
74 => 327,
|
||||||
75 => 341,
|
75 => 341,
|
||||||
76 => 341,
|
76 => 341,
|
||||||
134 => 141,
|
134 => 141,
|
||||||
168 => 404
|
168 => 404
|
||||||
);
|
);
|
||||||
|
|
||||||
$questQuery = '
|
$questQuery = '
|
||||||
SELECT
|
SELECT
|
||||||
qt.RewardTitle AS ARRAY_KEY,
|
qt.RewardTitle AS ARRAY_KEY,
|
||||||
qt.AllowableRaces,
|
qt.AllowableRaces,
|
||||||
IFNULL(ge.eventEntry, 0) AS eventEntry
|
IFNULL(ge.eventEntry, 0) AS eventEntry
|
||||||
FROM
|
FROM
|
||||||
quest_template qt
|
quest_template qt
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
game_event_seasonal_questrelation sq ON sq.questId = qt.ID
|
game_event_seasonal_questrelation sq ON sq.questId = qt.ID
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
game_event ge ON ge.eventEntry = sq.eventEntry
|
game_event ge ON ge.eventEntry = sq.eventEntry
|
||||||
WHERE
|
WHERE
|
||||||
qt.RewardTitle <> 0';
|
qt.RewardTitle <> 0';
|
||||||
|
|
||||||
DB::Aowow()->query('REPLACE INTO ?_titles SELECT Id, 0, 0, 0, 0, 0, 0, 0, bitIdx, male_loc0, male_loc2, male_loc3, male_loc6, male_loc8, female_loc0, female_loc2, female_loc3, female_loc6, female_loc8 FROM dbc_chartitles');
|
DB::Aowow()->query('REPLACE INTO ?_titles SELECT Id, 0, 0, 0, 0, 0, 0, 0, bitIdx, male_loc0, male_loc2, male_loc3, male_loc6, male_loc8, female_loc0, female_loc2, female_loc3, female_loc6, female_loc8 FROM dbc_chartitles');
|
||||||
|
|
||||||
// hide unused titles
|
// hide unused titles
|
||||||
DB::Aowow()->query('UPDATE ?_titles SET cuFlags = ?d WHERE id BETWEEN 85 AND 123 AND id NOT IN (113, 120, 121, 122)', CUSTOM_EXCLUDE_FOR_LISTVIEW);
|
DB::Aowow()->query('UPDATE ?_titles SET cuFlags = ?d WHERE id BETWEEN 85 AND 123 AND id NOT IN (113, 120, 121, 122)', CUSTOM_EXCLUDE_FOR_LISTVIEW);
|
||||||
|
|
||||||
// set expansion
|
// set expansion
|
||||||
DB::Aowow()->query('UPDATE ?_titles SET expansion = 2 WHERE id >= 72 AND id <> 80');
|
DB::Aowow()->query('UPDATE ?_titles SET expansion = 2 WHERE id >= 72 AND id <> 80');
|
||||||
DB::Aowow()->query('UPDATE ?_titles SET expansion = 1 WHERE id >= 42 AND id <> 46 AND expansion = 0');
|
DB::Aowow()->query('UPDATE ?_titles SET expansion = 1 WHERE id >= 42 AND id <> 46 AND expansion = 0');
|
||||||
|
|
||||||
// set category
|
// set category
|
||||||
DB::Aowow()->query('UPDATE ?_titles SET category = 1 WHERE id <= 28 OR id IN (42, 43, 44, 45, 47, 48, 62, 71, 72, 80, 82, 126, 127, 128, 157, 163, 167, 169, 177)');
|
DB::Aowow()->query('UPDATE ?_titles SET category = 1 WHERE id <= 28 OR id IN (42, 43, 44, 45, 47, 48, 62, 71, 72, 80, 82, 126, 127, 128, 157, 163, 167, 169, 177)');
|
||||||
DB::Aowow()->query('UPDATE ?_titles SET category = 5 WHERE id BETWEEN 96 AND 109 OR id IN (83, 84)');
|
DB::Aowow()->query('UPDATE ?_titles SET category = 5 WHERE id BETWEEN 96 AND 109 OR id IN (83, 84)');
|
||||||
DB::Aowow()->query('UPDATE ?_titles SET category = 2 WHERE id BETWEEN 144 AND 156 OR id IN (63, 77, 79, 113, 123, 130, 131, 132, 176)');
|
DB::Aowow()->query('UPDATE ?_titles SET category = 2 WHERE id BETWEEN 144 AND 156 OR id IN (63, 77, 79, 113, 123, 130, 131, 132, 176)');
|
||||||
DB::Aowow()->query('UPDATE ?_titles SET category = 6 WHERE id IN (46, 74, 75, 76, 124, 133, 134, 135, 137, 138, 155, 168)');
|
DB::Aowow()->query('UPDATE ?_titles SET category = 6 WHERE id IN (46, 74, 75, 76, 124, 133, 134, 135, 137, 138, 155, 168)');
|
||||||
DB::Aowow()->query('UPDATE ?_titles SET category = 4 WHERE id IN (81, 125)');
|
DB::Aowow()->query('UPDATE ?_titles SET category = 4 WHERE id IN (81, 125)');
|
||||||
DB::Aowow()->query('UPDATE ?_titles SET category = 3 WHERE id IN (53, 64, 120, 121, 122, 129, 139, 140, 141, 142) OR (id >= 158 AND category = 0)');
|
DB::Aowow()->query('UPDATE ?_titles SET category = 3 WHERE id IN (53, 64, 120, 121, 122, 129, 139, 140, 141, 142) OR (id >= 158 AND category = 0)');
|
||||||
|
|
||||||
// update event
|
// update event
|
||||||
if ($assoc = DB::World()->selectCol('SELECT holiday AS ARRAY_KEY, eventEntry FROM game_event WHERE holiday IN (?a)', array_values($titleHoliday)))
|
if ($assoc = DB::World()->selectCol('SELECT holiday AS ARRAY_KEY, eventEntry FROM game_event WHERE holiday IN (?a)', array_values($titleHoliday)))
|
||||||
foreach ($titleHoliday as $tId => $hId)
|
foreach ($titleHoliday as $tId => $hId)
|
||||||
if (!empty($assoc[$hId]))
|
if (!empty($assoc[$hId]))
|
||||||
DB::Aowow()->query('UPDATE ?_titles SET eventId = ?d WHERE id = ?d', $assoc[$hId], $tId);
|
DB::Aowow()->query('UPDATE ?_titles SET eventId = ?d WHERE id = ?d', $assoc[$hId], $tId);
|
||||||
|
|
||||||
// update side
|
// update side
|
||||||
$questInfo = DB::World()->select($questQuery);
|
$questInfo = DB::World()->select($questQuery);
|
||||||
$sideUpd = DB::World()->selectCol('SELECT IF (title_A, title_A, title_H) AS ARRAY_KEY, BIT_OR(IF(title_A, 1, 2)) AS side FROM achievement_reward WHERE (title_A <> 0 AND title_H = 0) OR (title_H <> 0 AND title_A = 0) GROUP BY ARRAY_KEY HAVING side <> 3');
|
$sideUpd = DB::World()->selectCol('SELECT IF (title_A, title_A, title_H) AS ARRAY_KEY, BIT_OR(IF(title_A, 1, 2)) AS side FROM achievement_reward WHERE (title_A <> 0 AND title_H = 0) OR (title_H <> 0 AND title_A = 0) GROUP BY ARRAY_KEY HAVING side <> 3');
|
||||||
foreach ($questInfo as $tId => $data)
|
foreach ($questInfo as $tId => $data)
|
||||||
{
|
{
|
||||||
if ($data['eventEntry'])
|
if ($data['eventEntry'])
|
||||||
DB::Aowow()->query('UPDATE ?_titles SET eventId = ?d WHERE id = ?d', $data['eventEntry'], $tId);
|
DB::Aowow()->query('UPDATE ?_titles SET eventId = ?d WHERE id = ?d', $data['eventEntry'], $tId);
|
||||||
|
|
||||||
$side = Util::sideByRaceMask($data['AllowableRaces']);
|
$side = Util::sideByRaceMask($data['AllowableRaces']);
|
||||||
if ($side == 3)
|
if ($side == 3)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!isset($sideUpd[$tId]))
|
if (!isset($sideUpd[$tId]))
|
||||||
$sideUpd[$tId] = $side;
|
$sideUpd[$tId] = $side;
|
||||||
else
|
else
|
||||||
$sideUpd[$tId] |= $side;
|
$sideUpd[$tId] |= $side;
|
||||||
}
|
}
|
||||||
foreach ($sideUpd as $tId => $side)
|
foreach ($sideUpd as $tId => $side)
|
||||||
if ($side != 3)
|
if ($side != 3)
|
||||||
DB::Aowow()->query("UPDATE ?_titles SET side = ?d WHERE id = ?d", $side, $tId);
|
DB::Aowow()->query("UPDATE ?_titles SET side = ?d WHERE id = ?d", $side, $tId);
|
||||||
|
|
||||||
// update side - sourceless titles (maintain query order)
|
// update side - sourceless titles (maintain query order)
|
||||||
DB::Aowow()->query('UPDATE ?_titles SET side = 2 WHERE id <= 28 OR id IN (118, 119, 116, 117, 110, 127)');
|
DB::Aowow()->query('UPDATE ?_titles SET side = 2 WHERE id <= 28 OR id IN (118, 119, 116, 117, 110, 127)');
|
||||||
DB::Aowow()->query('UPDATE ?_titles SET side = 1 WHERE id <= 14 OR id IN (111, 115, 112, 114, 126)');
|
DB::Aowow()->query('UPDATE ?_titles SET side = 1 WHERE id <= 14 OR id IN (111, 115, 112, 114, 126)');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,232 +1,232 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('AOWOW_REVISION'))
|
if (!defined('AOWOW_REVISION'))
|
||||||
die('illegal access');
|
die('illegal access');
|
||||||
|
|
||||||
if (!CLI)
|
if (!CLI)
|
||||||
die('not in cli mode');
|
die('not in cli mode');
|
||||||
|
|
||||||
|
|
||||||
/* deps
|
/* deps
|
||||||
* access_requirement
|
* access_requirement
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$customData = array(
|
$customData = array(
|
||||||
2257 => ['cuFlags' => 0, 'category' => 0, 'type' => 1], // deeprun tram => type: transit
|
2257 => ['cuFlags' => 0, 'category' => 0, 'type' => 1], // deeprun tram => type: transit
|
||||||
3698 => ['expansion' => 1], // arenas
|
3698 => ['expansion' => 1], // arenas
|
||||||
3702 => ['expansion' => 1],
|
3702 => ['expansion' => 1],
|
||||||
3968 => ['expansion' => 1],
|
3968 => ['expansion' => 1],
|
||||||
4378 => ['expansion' => 2],
|
4378 => ['expansion' => 2],
|
||||||
4406 => ['expansion' => 2],
|
4406 => ['expansion' => 2],
|
||||||
2597 => ['maxPlayer' => 40], // is 5 in battlemasterlist ... dafuque?
|
2597 => ['maxPlayer' => 40], // is 5 in battlemasterlist ... dafuque?
|
||||||
4710 => ['maxPlayer' => 40],
|
4710 => ['maxPlayer' => 40],
|
||||||
3456 => ['parentAreaId' => 65, 'parentX' => 87.3, 'parentY' => 51.1], // has no coordinates set in map.dbc
|
3456 => ['parentAreaId' => 65, 'parentX' => 87.3, 'parentY' => 51.1], // has no coordinates set in map.dbc
|
||||||
3849 => ['parentAreaId' => 3523, 'parentX' => 70.5, 'parentY' => 69.6],
|
3849 => ['parentAreaId' => 3523, 'parentX' => 70.5, 'parentY' => 69.6],
|
||||||
3847 => ['parentAreaId' => 3523, 'parentX' => 71.7, 'parentY' => 55.1],
|
3847 => ['parentAreaId' => 3523, 'parentX' => 71.7, 'parentY' => 55.1],
|
||||||
3848 => ['parentAreaId' => 3523, 'parentX' => 74.3, 'parentY' => 57.8],
|
3848 => ['parentAreaId' => 3523, 'parentX' => 74.3, 'parentY' => 57.8],
|
||||||
3456 => ['parentAreaId' => 3523, 'parentX' => 73.5, 'parentY' => 63.7]
|
3456 => ['parentAreaId' => 3523, 'parentX' => 73.5, 'parentY' => 63.7]
|
||||||
);
|
);
|
||||||
$reqDBC = ['worldmaptransforms', 'worldmaparea', 'map', 'mapdifficulty', 'areatable', 'lfgdungeons', 'battlemasterlist'];
|
$reqDBC = ['worldmaptransforms', 'worldmaparea', 'map', 'mapdifficulty', 'areatable', 'lfgdungeons', 'battlemasterlist'];
|
||||||
|
|
||||||
function zones()
|
function zones()
|
||||||
{
|
{
|
||||||
// base query
|
// base query
|
||||||
DB::Aowow()->query('
|
DB::Aowow()->query('
|
||||||
REPLACE INTO ?_zones
|
REPLACE INTO ?_zones
|
||||||
SELECT
|
SELECT
|
||||||
a.id,
|
a.id,
|
||||||
IFNULL(wmt.targetMapId, a.mapId), -- map
|
IFNULL(wmt.targetMapId, a.mapId), -- map
|
||||||
a.mapId, -- mapBak
|
a.mapId, -- mapBak
|
||||||
a.areaTable, -- parentArea
|
a.areaTable, -- parentArea
|
||||||
IFNULL(wmt.targetMapId, -- g_zone_categories
|
IFNULL(wmt.targetMapId, -- g_zone_categories
|
||||||
IF(m.areaType = 1, 2,
|
IF(m.areaType = 1, 2,
|
||||||
IF(m.areaType = 2, 3,
|
IF(m.areaType = 2, 3,
|
||||||
IF(m.areaType = 4, 9,
|
IF(m.areaType = 4, 9,
|
||||||
IF(m.isBG = 1, 6,
|
IF(m.isBG = 1, 6,
|
||||||
IF(a.mapId = 571, 10,
|
IF(a.mapId = 571, 10,
|
||||||
IF(a.mapId = 530, 8, a.mapId))))))),
|
IF(a.mapId = 530, 8, a.mapId))))))),
|
||||||
a.flags,
|
a.flags,
|
||||||
IF(areaTable <> 0 OR -- cuFlags
|
IF(areaTable <> 0 OR -- cuFlags
|
||||||
(wma.id IS NULL AND pa.areaId IS NULL AND (flags & 0x11000) = 0), ?d, 0),
|
(wma.id IS NULL AND pa.areaId IS NULL AND (flags & 0x11000) = 0), ?d, 0),
|
||||||
IF(a.flags & 0x01000000, 5, -- g_zone_territories
|
IF(a.flags & 0x01000000, 5, -- g_zone_territories
|
||||||
IF(m.isBG = 1, 4,
|
IF(m.isBG = 1, 4,
|
||||||
IF(m.areaType = 4, 4,
|
IF(m.areaType = 4, 4,
|
||||||
IF(a.flags & 0x00000800, 3,
|
IF(a.flags & 0x00000800, 3,
|
||||||
IF(a.factionGroupMask = 6, 2,
|
IF(a.factionGroupMask = 6, 2,
|
||||||
IF(a.factionGroupMask > 0, LOG2(a.factionGroupMask) - 1, 2)))))),
|
IF(a.factionGroupMask > 0, LOG2(a.factionGroupMask) - 1, 2)))))),
|
||||||
m.expansion,
|
m.expansion,
|
||||||
IF(m.areaType = 0, 0, -- g_zone_instancetypes
|
IF(m.areaType = 0, 0, -- g_zone_instancetypes
|
||||||
IF(m.isBG = 1, 4,
|
IF(m.isBG = 1, 4,
|
||||||
IF(m.areaType = 4, 6,
|
IF(m.areaType = 4, 6,
|
||||||
IF(md.modeMask & 0xC, 8,
|
IF(md.modeMask & 0xC, 8,
|
||||||
IF(md.minPl = 10 AND md.maxPL = 25, 7,
|
IF(md.minPl = 10 AND md.maxPL = 25, 7,
|
||||||
IF(m.areaType = 2, 3,
|
IF(m.areaType = 2, 3,
|
||||||
IF(m.areaType = 1 AND md.modeMask & 0x2, 5, 2))))))),
|
IF(m.areaType = 1 AND md.modeMask & 0x2, 5, 2))))))),
|
||||||
IF (md.minPl = 10 AND md.maxPl = 25, -2,
|
IF (md.minPl = 10 AND md.maxPl = 25, -2,
|
||||||
IFNULL(bm.maxPlayers, IFNULL(md.maxPl, m.maxPlayers))),
|
IFNULL(bm.maxPlayers, IFNULL(md.maxPl, m.maxPlayers))),
|
||||||
0, -- itemLevelN
|
0, -- itemLevelN
|
||||||
0, -- itemLevelH
|
0, -- itemLevelH
|
||||||
0, -- levelReq
|
0, -- levelReq
|
||||||
IFNULL(lfgIni.levelLFG, 0), -- levelReqLFG
|
IFNULL(lfgIni.levelLFG, 0), -- levelReqLFG
|
||||||
0, -- levelHeroic
|
0, -- levelHeroic
|
||||||
IF(a.flags & 0x8, 1, -- levelMin
|
IF(a.flags & 0x8, 1, -- levelMin
|
||||||
IFNULL(bm.minLevel,
|
IFNULL(bm.minLevel,
|
||||||
IFNULL(lfgIni.levelMin,
|
IFNULL(lfgIni.levelMin,
|
||||||
IFNULL(lfgOpen.levelMin, 0)))),
|
IFNULL(lfgOpen.levelMin, 0)))),
|
||||||
IF(a.flags & 0x8, ?d, -- levelMax
|
IF(a.flags & 0x8, ?d, -- levelMax
|
||||||
IFNULL(bm.maxLevel,
|
IFNULL(bm.maxLevel,
|
||||||
IFNULL(lfgIni.levelMax,
|
IFNULL(lfgIni.levelMax,
|
||||||
IFNULL(lfgOpen.levelMax, 0)))),
|
IFNULL(lfgOpen.levelMax, 0)))),
|
||||||
"", -- attunements
|
"", -- attunements
|
||||||
"", -- heroic attunements
|
"", -- heroic attunements
|
||||||
IFNULL(pa.areaId, 0),
|
IFNULL(pa.areaId, 0),
|
||||||
IFNULL(pa.posX, 0),
|
IFNULL(pa.posX, 0),
|
||||||
IFNULL(pa.posY, 0),
|
IFNULL(pa.posY, 0),
|
||||||
IF(wma.id IS NULL OR m.areaType = 0 OR a.mapId IN (269, 560) OR a.areaTable, a.name_loc0, m.name_loc0),
|
IF(wma.id IS NULL OR m.areaType = 0 OR a.mapId IN (269, 560) OR a.areaTable, a.name_loc0, m.name_loc0),
|
||||||
IF(wma.id IS NULL OR m.areaType = 0 OR a.mapId IN (269, 560) OR a.areaTable, a.name_loc2, m.name_loc2),
|
IF(wma.id IS NULL OR m.areaType = 0 OR a.mapId IN (269, 560) OR a.areaTable, a.name_loc2, m.name_loc2),
|
||||||
IF(wma.id IS NULL OR m.areaType = 0 OR a.mapId IN (269, 560) OR a.areaTable, a.name_loc3, m.name_loc3),
|
IF(wma.id IS NULL OR m.areaType = 0 OR a.mapId IN (269, 560) OR a.areaTable, a.name_loc3, m.name_loc3),
|
||||||
IF(wma.id IS NULL OR m.areaType = 0 OR a.mapId IN (269, 560) OR a.areaTable, a.name_loc6, m.name_loc6),
|
IF(wma.id IS NULL OR m.areaType = 0 OR a.mapId IN (269, 560) OR a.areaTable, a.name_loc6, m.name_loc6),
|
||||||
IF(wma.id IS NULL OR m.areaType = 0 OR a.mapId IN (269, 560) OR a.areaTable, a.name_loc8, m.name_loc8)
|
IF(wma.id IS NULL OR m.areaType = 0 OR a.mapId IN (269, 560) OR a.areaTable, a.name_loc8, m.name_loc8)
|
||||||
FROM
|
FROM
|
||||||
dbc_areatable a
|
dbc_areatable a
|
||||||
JOIN
|
JOIN
|
||||||
dbc_map m ON a.mapId = m.id
|
dbc_map m ON a.mapId = m.id
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT mapId, BIT_OR(1 << difficulty) AS modeMask, MIN(nPlayer) AS minPl, MAX(nPlayer) AS maxPl FROM dbc_mapdifficulty GROUP BY mapId
|
SELECT mapId, BIT_OR(1 << difficulty) AS modeMask, MIN(nPlayer) AS minPl, MAX(nPlayer) AS maxPl FROM dbc_mapdifficulty GROUP BY mapId
|
||||||
) md ON md.mapId = a.mapId
|
) md ON md.mapId = a.mapId
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
dbc_lfgdungeons lfgOpen ON a.mapId IN (0, 1, 530, 571) AND a.name_loc0 LIKE CONCAT("%", lfgOpen.name_loc0) AND lfgOpen.type = 4
|
dbc_lfgdungeons lfgOpen ON a.mapId IN (0, 1, 530, 571) AND a.name_loc0 LIKE CONCAT("%", lfgOpen.name_loc0) AND lfgOpen.type = 4
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT
|
SELECT
|
||||||
mapId, m.id, `left`, `right`, `top`, `bottom`,
|
mapId, m.id, `left`, `right`, `top`, `bottom`,
|
||||||
IF((abs(((m.parentY - `right`) * 100 / (`left` - `right`)) - 50)) > abs(((m.parentX - `bottom`) * 100 / (`top` - `bottom`)) - 50),
|
IF((abs(((m.parentY - `right`) * 100 / (`left` - `right`)) - 50)) > abs(((m.parentX - `bottom`) * 100 / (`top` - `bottom`)) - 50),
|
||||||
(abs(((m.parentY - `right`) * 100 / (`left` - `right`)) - 50)),
|
(abs(((m.parentY - `right`) * 100 / (`left` - `right`)) - 50)),
|
||||||
(abs(((m.parentX - `bottom`) * 100 / (`top` - `bottom`)) - 50))) AS diff,
|
(abs(((m.parentX - `bottom`) * 100 / (`top` - `bottom`)) - 50))) AS diff,
|
||||||
areaId, -- parentArea
|
areaId, -- parentArea
|
||||||
100 - ROUND((m.parentY - `right`) * 100 / (`left` - `right`), 1) as posX,
|
100 - ROUND((m.parentY - `right`) * 100 / (`left` - `right`), 1) as posX,
|
||||||
100 - ROUND((m.parentX - `bottom`) * 100 / (`top` - `bottom`), 1) as posY
|
100 - ROUND((m.parentX - `bottom`) * 100 / (`top` - `bottom`), 1) as posY
|
||||||
FROM
|
FROM
|
||||||
dbc_worldmaparea wma
|
dbc_worldmaparea wma
|
||||||
JOIN
|
JOIN
|
||||||
dbc_map m ON m.parentMapId = wma.mapid
|
dbc_map m ON m.parentMapId = wma.mapid
|
||||||
WHERE
|
WHERE
|
||||||
m.parentMapId IN (0, 1, 530, 571) AND areaId <> 0 AND
|
m.parentMapId IN (0, 1, 530, 571) AND areaId <> 0 AND
|
||||||
m.parentY BETWEEN `right` AND `left` AND
|
m.parentY BETWEEN `right` AND `left` AND
|
||||||
m.parentX BETWEEN bottom AND top
|
m.parentX BETWEEN bottom AND top
|
||||||
ORDER BY
|
ORDER BY
|
||||||
diff ASC
|
diff ASC
|
||||||
) pa ON pa.id = m.id AND m.parentMapId > -1 AND m.parentX <> 0 AND m.parentY <> 0 AND m.parentMapId = pa.mapId AND m.parentY BETWEEN pa.`right` AND pa.`left` AND m.parentX BETWEEN pa.bottom AND pa.top
|
) pa ON pa.id = m.id AND m.parentMapId > -1 AND m.parentX <> 0 AND m.parentY <> 0 AND m.parentMapId = pa.mapId AND m.parentY BETWEEN pa.`right` AND pa.`left` AND m.parentX BETWEEN pa.bottom AND pa.top
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT
|
SELECT
|
||||||
mapId,
|
mapId,
|
||||||
MIN(IF(targetLevelMin, targetLevelMin, levelMin)) AS levelMin,
|
MIN(IF(targetLevelMin, targetLevelMin, levelMin)) AS levelMin,
|
||||||
MAX(IF(targetLevelMax, targetLevelMax, targetLevel)) AS levelMax,
|
MAX(IF(targetLevelMax, targetLevelMax, targetLevel)) AS levelMax,
|
||||||
MIN(IF(levelMin, levelMin, targetLevel)) AS levelLFG
|
MIN(IF(levelMin, levelMin, targetLevel)) AS levelLFG
|
||||||
FROM
|
FROM
|
||||||
dbc_lfgdungeons
|
dbc_lfgdungeons
|
||||||
WHERE
|
WHERE
|
||||||
type NOT IN (4, 6) AND
|
type NOT IN (4, 6) AND
|
||||||
groupId <> 11
|
groupId <> 11
|
||||||
GROUP BY
|
GROUP BY
|
||||||
mapId
|
mapId
|
||||||
) lfgIni ON lfgIni.mapId = a.mapId
|
) lfgIni ON lfgIni.mapId = a.mapId
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
dbc_battlemasterlist bm ON bm.mapId = a.mapId AND bm.moreMapId < 0
|
dbc_battlemasterlist bm ON bm.mapId = a.mapId AND bm.moreMapId < 0
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
dbc_worldmaparea wma ON wma.areaId = a.id
|
dbc_worldmaparea wma ON wma.areaId = a.id
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
dbc_worldmaptransforms wmt ON
|
dbc_worldmaptransforms wmt ON
|
||||||
wmt.targetMapId <> wmt.sourceMapId AND
|
wmt.targetMapId <> wmt.sourceMapId AND
|
||||||
wma.mapId = wmt.sourceMapId AND
|
wma.mapId = wmt.sourceMapId AND
|
||||||
wma.left < wmt.maxY AND
|
wma.left < wmt.maxY AND
|
||||||
wma.right > wmt.minY AND
|
wma.right > wmt.minY AND
|
||||||
wma.top < wmt.maxX AND
|
wma.top < wmt.maxX AND
|
||||||
wma.bottom > wmt.minX
|
wma.bottom > wmt.minX
|
||||||
GROUP BY
|
GROUP BY
|
||||||
a.id
|
a.id
|
||||||
', CUSTOM_EXCLUDE_FOR_LISTVIEW, MAX_LEVEL);
|
', CUSTOM_EXCLUDE_FOR_LISTVIEW, MAX_LEVEL);
|
||||||
|
|
||||||
// get requirements from world.access_requirement
|
// get requirements from world.access_requirement
|
||||||
$zoneReq = DB::World()->select('
|
$zoneReq = DB::World()->select('
|
||||||
SELECT
|
SELECT
|
||||||
mapId AS ARRAY_KEY,
|
mapId AS ARRAY_KEY,
|
||||||
MIN(level_min) AS reqLevel,
|
MIN(level_min) AS reqLevel,
|
||||||
MAX(IF(difficulty > 0, level_min, 0)) AS heroicLevel,
|
MAX(IF(difficulty > 0, level_min, 0)) AS heroicLevel,
|
||||||
MAX(IF(difficulty = 0, item_level, 0)) AS reqItemLevelN,
|
MAX(IF(difficulty = 0, item_level, 0)) AS reqItemLevelN,
|
||||||
MAX(IF(difficulty > 0, item_level, 0)) AS reqItemLevelH,
|
MAX(IF(difficulty > 0, item_level, 0)) AS reqItemLevelH,
|
||||||
CONCAT_WS(" ", GROUP_CONCAT(IF(difficulty = 0 AND item, item, NULL) SEPARATOR " "), GROUP_CONCAT(IF(difficulty = 0 AND item2 AND item2 <> item, item2, NULL) SEPARATOR " ")) AS reqItemN,
|
CONCAT_WS(" ", GROUP_CONCAT(IF(difficulty = 0 AND item, item, NULL) SEPARATOR " "), GROUP_CONCAT(IF(difficulty = 0 AND item2 AND item2 <> item, item2, NULL) SEPARATOR " ")) AS reqItemN,
|
||||||
CONCAT_WS(" ", GROUP_CONCAT(IF(difficulty > 0 AND item, item, NULL) SEPARATOR " "), GROUP_CONCAT(IF(difficulty > 0 AND item2 AND item2 <> item, item2, NULL) SEPARATOR " ")) AS reqItemH,
|
CONCAT_WS(" ", GROUP_CONCAT(IF(difficulty > 0 AND item, item, NULL) SEPARATOR " "), GROUP_CONCAT(IF(difficulty > 0 AND item2 AND item2 <> item, item2, NULL) SEPARATOR " ")) AS reqItemH,
|
||||||
CONCAT_WS(" ", GROUP_CONCAT(IF(difficulty = 0 AND quest_done_A, quest_done_A, NULL) SEPARATOR " "), GROUP_CONCAT(IF(difficulty = 0 AND quest_done_H AND quest_done_H <> quest_done_A, quest_done_H, NULL) SEPARATOR " ")) AS reqQuestN,
|
CONCAT_WS(" ", GROUP_CONCAT(IF(difficulty = 0 AND quest_done_A, quest_done_A, NULL) SEPARATOR " "), GROUP_CONCAT(IF(difficulty = 0 AND quest_done_H AND quest_done_H <> quest_done_A, quest_done_H, NULL) SEPARATOR " ")) AS reqQuestN,
|
||||||
CONCAT_WS(" ", GROUP_CONCAT(IF(difficulty > 0 AND quest_done_A, quest_done_A, NULL) SEPARATOR " "), GROUP_CONCAT(IF(difficulty > 0 AND quest_done_H AND quest_done_H <> quest_done_A, quest_done_H, NULL) SEPARATOR " ")) AS reqQuestH,
|
CONCAT_WS(" ", GROUP_CONCAT(IF(difficulty > 0 AND quest_done_A, quest_done_A, NULL) SEPARATOR " "), GROUP_CONCAT(IF(difficulty > 0 AND quest_done_H AND quest_done_H <> quest_done_A, quest_done_H, NULL) SEPARATOR " ")) AS reqQuestH,
|
||||||
CONCAT_WS(" ", GROUP_CONCAT(IF(difficulty = 0 AND completed_achievement, completed_achievement, NULL) SEPARATOR " ")) AS reqAchievementN,
|
CONCAT_WS(" ", GROUP_CONCAT(IF(difficulty = 0 AND completed_achievement, completed_achievement, NULL) SEPARATOR " ")) AS reqAchievementN,
|
||||||
CONCAT_WS(" ", GROUP_CONCAT(IF(difficulty > 0 AND completed_achievement, completed_achievement, NULL) SEPARATOR " ")) AS reqAchievementH
|
CONCAT_WS(" ", GROUP_CONCAT(IF(difficulty > 0 AND completed_achievement, completed_achievement, NULL) SEPARATOR " ")) AS reqAchievementH
|
||||||
FROM
|
FROM
|
||||||
access_requirement
|
access_requirement
|
||||||
GROUP BY
|
GROUP BY
|
||||||
mapId
|
mapId
|
||||||
');
|
');
|
||||||
|
|
||||||
foreach ($zoneReq as $mapId => $req)
|
foreach ($zoneReq as $mapId => $req)
|
||||||
{
|
{
|
||||||
$update = ['levelReq' => $req['reqLevel']];
|
$update = ['levelReq' => $req['reqLevel']];
|
||||||
$aN = $aH = [];
|
$aN = $aH = [];
|
||||||
|
|
||||||
if ($req['heroicLevel'])
|
if ($req['heroicLevel'])
|
||||||
$update['levelHeroic'] = $req['heroicLevel'];
|
$update['levelHeroic'] = $req['heroicLevel'];
|
||||||
|
|
||||||
if ($req['reqItemLevelN'])
|
if ($req['reqItemLevelN'])
|
||||||
$update['itemLevelReqN'] = $req['reqItemLevelN'];
|
$update['itemLevelReqN'] = $req['reqItemLevelN'];
|
||||||
|
|
||||||
if ($req['reqItemLevelH'] && $req['reqItemLevelH'] > $req['reqItemLevelN'])
|
if ($req['reqItemLevelH'] && $req['reqItemLevelH'] > $req['reqItemLevelN'])
|
||||||
$update['itemLevelReqH'] = $req['reqItemLevelH'];
|
$update['itemLevelReqH'] = $req['reqItemLevelH'];
|
||||||
|
|
||||||
if ($req['reqItemN'] && ($entries = explode(' ', $req['reqItemN'])))
|
if ($req['reqItemN'] && ($entries = explode(' ', $req['reqItemN'])))
|
||||||
foreach ($entries as $_)
|
foreach ($entries as $_)
|
||||||
$aN[TYPE_ITEM][] = $_;
|
$aN[TYPE_ITEM][] = $_;
|
||||||
|
|
||||||
if ($req['reqItemH'] && ($entries = explode(' ', $req['reqItemH'])))
|
if ($req['reqItemH'] && ($entries = explode(' ', $req['reqItemH'])))
|
||||||
if ($entries = array_diff($entries, @(array)$aN[TYPE_ITEM]))
|
if ($entries = array_diff($entries, @(array)$aN[TYPE_ITEM]))
|
||||||
foreach ($entries as $_)
|
foreach ($entries as $_)
|
||||||
$aH[TYPE_ITEM][] = $_;
|
$aH[TYPE_ITEM][] = $_;
|
||||||
|
|
||||||
if ($req['reqQuestN'] && ($entries = explode(' ', $req['reqQuestN'])))
|
if ($req['reqQuestN'] && ($entries = explode(' ', $req['reqQuestN'])))
|
||||||
foreach ($entries as $_)
|
foreach ($entries as $_)
|
||||||
$aN[TYPE_QUEST][] = $_;
|
$aN[TYPE_QUEST][] = $_;
|
||||||
|
|
||||||
if ($req['reqQuestH'] && ($entries = explode(' ', $req['reqQuestH'])))
|
if ($req['reqQuestH'] && ($entries = explode(' ', $req['reqQuestH'])))
|
||||||
if ($entries = array_diff($entries, @(array)$aN[TYPE_QUEST]))
|
if ($entries = array_diff($entries, @(array)$aN[TYPE_QUEST]))
|
||||||
foreach ($entries as $_)
|
foreach ($entries as $_)
|
||||||
$aH[TYPE_QUEST][] = $_;
|
$aH[TYPE_QUEST][] = $_;
|
||||||
|
|
||||||
if ($req['reqAchievementN'] && ($entries = explode(' ', $req['reqAchievementN'])))
|
if ($req['reqAchievementN'] && ($entries = explode(' ', $req['reqAchievementN'])))
|
||||||
foreach ($entries as $_)
|
foreach ($entries as $_)
|
||||||
$aN[TYPE_ACHIEVEMENT][] = $_;
|
$aN[TYPE_ACHIEVEMENT][] = $_;
|
||||||
|
|
||||||
if ($req['reqAchievementH'] && ($entries = explode(' ', $req['reqAchievementH'])))
|
if ($req['reqAchievementH'] && ($entries = explode(' ', $req['reqAchievementH'])))
|
||||||
if ($entries = array_diff($entries, @(array)$aN[TYPE_ACHIEVEMENT]))
|
if ($entries = array_diff($entries, @(array)$aN[TYPE_ACHIEVEMENT]))
|
||||||
foreach ($entries as $_)
|
foreach ($entries as $_)
|
||||||
$aH[TYPE_ACHIEVEMENT][] = $_;
|
$aH[TYPE_ACHIEVEMENT][] = $_;
|
||||||
|
|
||||||
if ($aN)
|
if ($aN)
|
||||||
{
|
{
|
||||||
foreach ($aN as $type => $entries)
|
foreach ($aN as $type => $entries)
|
||||||
$aN[$type] = $type.':'.implode(' '.$type.':', $entries);
|
$aN[$type] = $type.':'.implode(' '.$type.':', $entries);
|
||||||
|
|
||||||
$update['attunementsN'] = implode(' ', $aN);
|
$update['attunementsN'] = implode(' ', $aN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aH)
|
if ($aH)
|
||||||
{
|
{
|
||||||
foreach ($aH as $type => $entries)
|
foreach ($aH as $type => $entries)
|
||||||
$aH[$type] = $type.':'.implode(' '.$type.':', $entries);
|
$aH[$type] = $type.':'.implode(' '.$type.':', $entries);
|
||||||
|
|
||||||
$update['attunementsH'] = implode(' ', $aH);
|
$update['attunementsH'] = implode(' ', $aH);
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::Aowow()->query('UPDATE ?_zones SET ?a WHERE mapId = ?d', $update, $mapId);
|
DB::Aowow()->query('UPDATE ?_zones SET ?a WHERE mapId = ?d', $update, $mapId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
9
setup/updates/1488061468_01.sql
Normal file
9
setup/updates/1488061468_01.sql
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
UPDATE aowow_races SET factionId = 69 WHERE id = 4; -- was 96 *sigh*
|
||||||
|
|
||||||
|
UPDATE aowow_creature SET cuFlags = cuFlags | 0x40000000 WHERE
|
||||||
|
name_loc0 LIKE '%[%' OR
|
||||||
|
name_loc0 LIKE '%(%' OR
|
||||||
|
name_loc0 LIKE '%visual%' OR
|
||||||
|
name_loc0 LIKE '%trigger%' OR
|
||||||
|
name_loc0 LIKE '%credit%' OR
|
||||||
|
name_loc0 LIKE '%marker%';
|
||||||
Reference in New Issue
Block a user