Setup/Scripts

* restructure setup to allow for self contained setup steps to self register (just the sql for now)
 * should ease adding new scripts in future
This commit is contained in:
Sarjuuk
2019-07-31 23:25:44 +02:00
parent 163e3d82b0
commit ccef11323b
51 changed files with 5345 additions and 4964 deletions

View File

@@ -17,6 +17,7 @@ define('ERR_MISSING_INCL', 'required function %s() could not be found at %s');
require_once 'setup/tools/CLISetup.class.php'; require_once 'setup/tools/CLISetup.class.php';
require_once 'setup/tools/setupScript.class.php';
require_once 'setup/tools/dbc.class.php'; require_once 'setup/tools/dbc.class.php';
require_once 'setup/tools/imagecreatefromblp.func.php'; require_once 'setup/tools/imagecreatefromblp.func.php';

View File

@@ -0,0 +1,76 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
trait TrDBCcopy
{
public function generate() : bool
{
if (!$this->dbcSourceFiles)
{
CLI::write(' SetupScript '.$this->command.' is set up for DBCcopy but has no source set!', CLI::LOG_ERROR);
return false;
}
else if (count($this->dbcSourceFiles) != 1)
CLI::write(' SetupScript '.$this->command.' is set up for DBCcopy but has multiple sources set!', CLI::LOG_WARN);
CLI::write('SqlGen::generate() - copying '.$this->dbcSourceFiles[0].'.dbc into aowow_'.$this->command);
$dbc = new DBC($this->dbcSourceFiles[0], ['temporary' => false, 'tableName' => 'aowow_'.$this->command]);
if ($dbc->error)
return false;
return !!$dbc->readFile();
}
}
trait TrCustomData
{
// apply post generator custom data
public function applyCustomData() : void
{
if (!$this->customData)
return;
foreach ($this->customData as $id => $data)
if ($data)
DB::Aowow()->query('UPDATE ?_'.$this->command.' SET ?a WHERE id = ?d', $data, $id);
}
}
abstract class SetupScript
{
protected $fileTemplatePath = '';
protected $fileTemplateFile = '';
protected $tblDependancyAowow = [];
protected $tblDependancyTC = [];
protected $dbcSourceFiles = [];
// abstract protected $command;
abstract public function generate() : bool;
public function getRequiredDBCs() : array
{
return $this->dbcSourceFiles;
}
public function getDependancies(bool $aowow) : array
{
return $aowow ? $this->tblDependancyAowow : $this->tblDependancyTC;
}
public function getName() : string
{
return $this->command;
}
}
?>

View File

@@ -7,74 +7,14 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* provide these with basic content
aowow_announcements
aowow_articles
aowow_config
aowow_home_featuredbox
aowow_home_featuredbox_overlay
aowow_home_oneliners
aowow_home_titles
aowow_sourcestrings
*/
class SqlGen class SqlGen
{ {
const MODE_NORMAL = 1; const MODE_NORMAL = 1;
const MODE_FIRSTRUN = 2; const MODE_FIRSTRUN = 2;
const MODE_UPDATE = 3; const MODE_UPDATE = 3;
private static $tables = array( // [dbcName, saveDbc, AowowDeps, TCDeps] private static $tables = [];
'achievementcategory' => ['achievement_category', false, null, null], private static $tmpStore = [];
'achievementcriteria' => ['achievement_criteria', false, null, null],
'itemenchantmentcondition' => ['spellitemenchantmentcondition', false, null, null],
'itemextendedcost' => ['itemextendedcost', false, null, null],
'itemlimitcategory' => ['itemlimitcategory', false, null, null],
'itemrandomproppoints' => ['randproppoints', false, null, null],
'lock' => ['lock', true, null, null],
'mailtemplate' => ['mailtemplate', false, null, null],
'scalingstatdistribution' => ['scalingstatdistribution', true, null, null],
'scalingstatvalues' => ['scalingstatvalues', true, null, null],
'spellfocusobject' => ['spellfocusobject', false, null, null],
'spelloverride' => ['overridespelldata', false, null, null],
'spellrange' => ['spellrange', false, null, null],
'spellvariables' => ['spelldescriptionvariables', false, null, null],
'totemcategory' => ['totemcategory', false, null, null],
'icons' => [null, null, null, null],
'glyphproperties' => [null, true, ['icons'], null],
'talents' => [null, null, null, null],
'classes' => [null, null, null, null],
'factions' => [null, null, null, null],
'factiontemplate' => [null, null, null, null],
'holidays' => [null, null, null, null],
'itemrandomenchant' => [null, null, null, null],
'races' => [null, null, null, null],
'shapeshiftforms' => [null, null, null, null],
'skillline' => [null, null, ['icons'], null],
'emotes' => [null, null, null, null],
'sounds' => [null, null, null, null],
'areatrigger' => [null, null, null, ['areatrigger_involvedrelation', 'areatrigger_scripts', 'areatrigger_tavern', 'areatrigger_teleport', 'quest_template', 'quest_template_addon']],
'itemenchantment' => [null, null, null, ['spell_enchant_proc_data']],
'achievement' => [null, null, ['icons'], ['dbc_achievement', 'disables']],
'creature' => [null, null, null, ['creature_template', 'creature_template_locale', 'creature_classlevelstats', 'instance_encounters']],
'currencies' => [null, null, null, ['item_template', 'item_template_locale']],
'events' => [null, null, null, ['game_event', 'game_event_prerequisite']],
'objects' => [null, null, null, ['gameobject_template', 'gameobject_template_locale', 'gameobject_questitem']],
'pet' => [null, null, ['icons'], ['creature_template', 'creature']],
'quests' => [null, null, null, ['quest_template', 'quest_template_addon', 'quest_template_locale', 'game_event', 'game_event_seasonal_questrelation', 'disables']],
'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, ['icons'], ['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']],
'taxi' /* nodes + paths */ => [null, null, null, ['creature_template', 'creature']],
'titles' => [null, null, null, ['quest_template', 'game_event_seasonal_questrelation', 'game_event', 'achievement_reward']],
'items' => [null, null, ['icons'], ['item_template', 'item_template_locale', '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']],
'zones' => [null, null, null, ['access_requirement']],
'itemset' => [null, null, ['spell'], ['item_template', 'game_event']],
'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']]
);
public static $cliOpts = []; public static $cliOpts = [];
private static $shortOpts = 'h'; private static $shortOpts = 'h';
@@ -84,13 +24,61 @@ class SqlGen
public static $subScripts = []; public static $subScripts = [];
public static $defaultExecTime = 30; public static $defaultExecTime = 30;
public static $stepSize = 1000; public static $sqlBatchSize = 1000;
public static function init($mode = self::MODE_NORMAL, array $updScripts = []) public static function init(int $mode = self::MODE_NORMAL, array $updScripts = []) : void
{ {
self::$defaultExecTime = ini_get('max_execution_time'); self::$defaultExecTime = ini_get('max_execution_time');
$doScripts = null; $doScripts = null;
// register subscripts
foreach (glob('setup/tools/sqlgen/*.func.php') as $file)
include_once $file;
while (self::$tmpStore)
{
$nDepsMissing = count(self::$tmpStore);
foreach (self::$tmpStore as $idx => $ts)
{
$depsOK = true;
foreach ($ts->getDependancies(true) as $d)
{
if (isset(self::$tables[$d]))
continue;
$depsOK = false;
break;
}
if ($depsOK)
{
if (isset(self::$tables[$ssRef->getName()]))
{
CLI::write('a SetupScript named '.CLI::bold($ts->getName()).' was already registered. Skipping...', CLI::LOG_WARN);
unset(self::$tmpStore[$idx]);
continue;
}
self::$tables[$ts->getName()] = $ts;
unset(self::$tmpStore[$idx]);
}
}
if ($nDepsMissing == count(self::$tmpStore))
{
CLI::write('the flollowing SetupScripts have unresolved dependancies and have not been registered:', CLI::LOG_ERROR);
foreach (self::$tmpStore as $ts)
CLI::write(' * '.CLI::bold($ts->getName()).' => '.implode(', ', $ts->getDependancies(true)));
self::$tmpStore = [];
break;
}
}
// handle command prompts
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)
@@ -115,7 +103,50 @@ class SqlGen
self::$mode = $mode; self::$mode = $mode;
} }
private static function handleCLIOpts(&$doTbls) public static function register(SetupScript $ssRef) : bool
{
// if dependancies haven't been stored yet, put aside for later use
foreach ($ssRef->getDependancies(true) as $d)
{
if (isset(self::$tables[$d]))
continue;
self::$tmpStore[] = $ssRef;
return false;
}
if (isset(self::$tables[$ssRef->getName()]))
{
CLI::write('a SetupScript named '.CLI::bold($ssRef->getName()).' was already registered. Skipping...', CLI::LOG_WARN);
return false;
}
self::$tables[$ssRef->getName()] = $ssRef;
// recheck temp stored dependancies
foreach (self::$tmpStore as $idx => $ts)
{
$depsOK = true;
foreach ($ts->getDependancies(true) as $d)
{
if (isset(self::$tables[$d]))
continue;
$depsOK = false;
break;
}
if ($depsOK)
{
self::$tables[$ts->getName()] = $ts;
unset(self::$tmpStore[$idx]);
}
}
return true;
}
private static function handleCLIOpts(&$doTbls) : void
{ {
$doTbls = []; $doTbls = [];
$_ = getopt(self::$shortOpts, self::$longOpts); $_ = getopt(self::$shortOpts, self::$longOpts);
@@ -130,13 +161,13 @@ class SqlGen
if (!empty($_['sync'])) if (!empty($_['sync']))
{ {
$sync = explode(',', $_['sync']); $sync = explode(',', $_['sync']);
foreach (self::$tables as $name => $info) foreach (self::$tables as $name => &$ssRef)
if (!empty($info[3]) && array_intersect($sync, $info[3])) if (array_intersect($sync, $ssRef->getDependancies(false)))
$doTbls[] = $name; $doTbls[] = $name;
// recursive dependencies // recursive dependencies
foreach (self::$tables as $name => $info) foreach (self::$tables as $name => &$ssRef)
if (!empty($info[2]) && array_intersect($doTbls, $info[2])) if (array_intersect($sync, $ssRef->getDependancies(true)))
$doTbls[] = $name; $doTbls[] = $name;
$doTbls = $doTbls ? array_unique($doTbls) : null; $doTbls = $doTbls ? array_unique($doTbls) : null;
@@ -145,17 +176,17 @@ class SqlGen
$doTbls = explode(',', $_['sql']); $doTbls = explode(',', $_['sql']);
} }
public static function printCLIHelp() public static function printCLIHelp() : void
{ {
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 => &$ssRef)
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).($ssRef->getDependancies(false) ? ' - TC deps: '.implode(', ', $ssRef->getDependancies(false)) : '').($ssRef->getDependancies(true) ? ' - Aowow deps: '.implode(', ', $ssRef->getDependancies(true)) : '')."\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(string $tableName, array $updateIds = []) : bool
{ {
if (!isset(self::$tables[$tableName])) if (!isset(self::$tables[$tableName]))
{ {
@@ -163,50 +194,28 @@ class SqlGen
return false; return false;
} }
if (!empty(self::$tables[$tableName][0])) // straight copy from dbc source $ssRef = &self::$tables[$tableName];
{
$tbl = self::$tables[$tableName]; // shorthand
CLI::write('SqlGen::generate() - copying '.$tbl[0].'.dbc into aowow_'.$tableName);
$dbc = new DBC($tbl[0], ['temporary' => CLISetup::$tmpDBC, 'tableName' => 'aowow_'.$tableName]);
if ($dbc->error)
return false;
return !!$dbc->readFile();
}
else if (file_exists('setup/tools/sqlgen/'.$tableName.'.func.php'))
{
$customData = $reqDBC = [];
CLI::write('SqlGen::generate() - filling aowow_'.$tableName.' with data'); CLI::write('SqlGen::generate() - filling aowow_'.$tableName.' with data');
require_once 'setup/tools/sqlgen/'.$tableName.'.func.php';
if (function_exists($tableName))
{
// check for required auxiliary DBC files // check for required auxiliary DBC files
foreach ($reqDBC as $req) if (!in_array('TrDBCcopy', class_uses($ssRef)))
foreach ($ssRef->getRequiredDBCs() as $req)
if (!CLISetup::loadDBC($req)) if (!CLISetup::loadDBC($req))
return false; return false;
$success = $tableName($updateIds); if ($ssRef->generate($updateIds))
{
// apply post generator custom data if (method_exists($ssRef, 'applyCustomData'))
foreach ($customData as $id => $data) $ssRef->applyCustomData();
if ($data)
DB::Aowow()->query('UPDATE ?_'.$tableName.' SET ?a WHERE id = ?d', $data, $id);
}
else
CLI::write(' - subscript \''.$tableName.'\' not defined in included file', CLI::LOG_ERROR);
return $success;
}
else
CLI::write(sprintf(ERR_MISSING_INCL, $tableName, 'setup/tools/sqlgen/'.$tableName.'.func.php'), CLI::LOG_ERROR);
return true;
} }
public static function getMode() return false;
}
public static function getMode() : int
{ {
return self::$mode; return self::$mode;
} }

View File

@@ -7,22 +7,21 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps: SqlGen::register(new class extends SetupScript
* dbc_achievement
* disables
*/
// Higher Learning - item rewarded through gossip
$customData = array(
1956 => ['itemExtra' => 44738]
);
$reqDBC = ['achievement_category', 'achievement', 'spellicon'];
function achievement(array $ids = [])
{ {
if ($ids) use TrCustomData;
DB::Aowow()->query('DELETE FROM ?_achievement WHERE id IN (?a)', $ids);
else protected $command = 'achievement';
protected $tblDependancyAowow = ['icons'];
protected $tblDependancyTC = ['dbc_achievement', 'disables'];
protected $dbcSourceFiles = ['achievement_category', 'achievement', 'spellicon'];
private $customData = array(
1956 => ['itemExtra' => 44738] // Higher Learning - item rewarded through gossip
);
public function generate(array $ids = []) : bool
{ {
DB::Aowow()->query(' DB::Aowow()->query('
REPLACE INTO REPLACE INTO
@@ -55,8 +54,8 @@ function achievement(array $ids = [])
dbc_spellicon si ON si.id = a.iconId dbc_spellicon si ON si.id = a.iconId
LEFT JOIN LEFT JOIN
?_icons i ON LOWER(SUBSTRING_INDEX(si.iconPath, "\\\\", -1)) = i.name ?_icons i ON LOWER(SUBSTRING_INDEX(si.iconPath, "\\\\", -1)) = i.name
'); { WHERE a.id IN (?a) }
} ', $ids ?: DBSIMPLE_SKIP);
// 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)}',
@@ -100,5 +99,6 @@ function achievement(array $ids = [])
return true; return true;
} }
});
?> ?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'achievementcategory';
protected $dbcSourceFiles = ['achievement_category'];
});
?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'achievementcriteria';
protected $dbcSourceFiles = ['achievement_criteria'];
});
?>

View File

@@ -7,20 +7,14 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps: SqlGen::register(new class extends SetupScript
* areatrigger_tavern {
* areatrigger_scripts protected $command = 'areatrigger';
* areatrigger_involvedrelation
* quest_template
* quest_template_addon
* areatrigger_teleport
*/
$customData = array( protected $tblDependancyTC = ['areatrigger_involvedrelation', 'areatrigger_scripts', 'areatrigger_tavern', 'areatrigger_teleport', 'quest_template', 'quest_template_addon'];
); protected $dbcSourceFiles = ['areatrigger'];
$reqDBC = ['areatrigger'];
function areatrigger(/*array $ids = [] */) public function generate(array $ids = []) : bool
{ {
DB::Aowow()->query('TRUNCATE ?_areatrigger'); DB::Aowow()->query('TRUNCATE ?_areatrigger');
DB::Aowow()->query('INSERT INTO ?_areatrigger SELECT id, 0, 0, NULL, orientation, NULL, NULL, NULL, NULL, NULL, NULL FROM dbc_areatrigger'); DB::Aowow()->query('INSERT INTO ?_areatrigger SELECT id, 0, 0, NULL, orientation, NULL, NULL, NULL, NULL, NULL, NULL FROM dbc_areatrigger');
@@ -103,5 +97,6 @@ function areatrigger(/*array $ids = [] */)
return true; return true;
} }
});
?> ?>

View File

@@ -7,8 +7,16 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrCustomData;
protected $command = 'classes';
protected $dbcSourceFiles = ['spell', 'charbaseinfo', 'skillraceclassinfo', 'skilllineability', 'chrclasses'];
// roles (1:heal; 2:mleDPS; 4:rngDPS; 8:tank) // roles (1:heal; 2:mleDPS; 4:rngDPS; 8:tank)
$customData = array( private $customData = array(
1 => ['roles' => 0xA], 1 => ['roles' => 0xA],
2 => ['roles' => 0xB], 2 => ['roles' => 0xB],
3 => ['roles' => 0x4], 3 => ['roles' => 0x4],
@@ -20,9 +28,8 @@ $customData = array(
9 => ['roles' => 0x4], 9 => ['roles' => 0x4],
11 => ['roles' => 0xF], 11 => ['roles' => 0xF],
); );
$reqDBC = ['spell', 'charbaseinfo', 'skillraceclassinfo', 'skilllineability', 'chrclasses'];
function classes() public function generate(array $ids = []) : bool
{ {
$classes = DB::Aowow()->select('SELECT *, id AS ARRAY_KEY FROM dbc_chrclasses'); $classes = DB::Aowow()->select('SELECT *, id AS ARRAY_KEY FROM dbc_chrclasses');
@@ -46,5 +53,6 @@ function classes()
return true; return true;
} }
});
?> ?>

View File

@@ -7,19 +7,14 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps: SqlGen::register(new class extends SetupScript
* creature_template {
* creature_template_locale protected $command = 'creature';
* creature_classlevelstats
* instance_encounters
*/
protected $tblDependancyTC = ['creature_template', 'creature_template_locale', 'creature_classlevelstats', 'instance_encounters'];
protected $dbcSourceFiles = ['creaturedisplayinfo', 'creaturedisplayinfoextra'];
$customData = array( public function generate(array $ids = []) : bool
);
$reqDBC = ['creaturedisplayinfo', 'creaturedisplayinfoextra'];
function creature(array $ids = [])
{ {
$baseQuery = ' $baseQuery = '
SELECT SELECT
@@ -132,7 +127,7 @@ function creature(array $ids = [])
c.humanoid = IF(cdie.id IS NULL, 0, 1)'; c.humanoid = IF(cdie.id IS NULL, 0, 1)';
$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::$sqlBatchSize))
{ {
$newMax = max(array_column($npcs, 'entry')); $newMax = max(array_column($npcs, 'entry'));
@@ -158,5 +153,6 @@ function creature(array $ids = [])
return true; return true;
} }
});
?> ?>

View File

@@ -7,13 +7,18 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps: SqlGen::register(new class extends SetupScript
* item_template {
* item_template_locale use TrCustomData;
*/
protected $command = 'currencies';
protected $tblDependancyAowow = ['icons'];
protected $tblDependancyTC = ['item_template', 'item_template_locale'];
protected $dbcSourceFiles = ['itemdisplayinfo', 'currencytypes'];
// hide test tokens and move them to unused // hide test tokens and move them to unused
$customData = array( private $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,9 +27,8 @@ $customData = array(
103 => ['cap' => 10000], // Arena Points 103 => ['cap' => 10000], // Arena Points
104 => ['cap' => 75000] // Honor Points 104 => ['cap' => 75000] // Honor Points
); );
$reqDBC = ['itemdisplayinfo', 'currencytypes'];
function currencies(array $ids = []) public function generate(array $ids = []) : bool
{ {
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');
@@ -84,5 +88,6 @@ function currencies(array $ids = [])
return true; return true;
} }
});
?> ?>

View File

@@ -7,11 +7,13 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
$customData = array( SqlGen::register(new class extends SetupScript
); {
$reqDBC = ['emotes', 'emotestext', 'emotestextdata']; protected $command = 'emotes';
function emotes(/*array $ids = [] */) protected $dbcSourceFiles = ['emotes', 'emotestext', 'emotestextdata'];
public function generate(array $ids = []) : bool
{ {
/**********/ /**********/
/* Basics */ /* Basics */
@@ -95,5 +97,6 @@ function emotes(/*array $ids = [] */)
return $allOK; return $allOK;
} }
});
?> ?>

View File

@@ -7,17 +7,13 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps: SqlGen::register(new class extends SetupScript
* game_event {
* game_event_prerequisite protected $command = 'events';
*/
$customData = array( protected $tblDependancyTC = ['game_event', 'game_event_prerequisite'];
);
$reqDBC = array(
);
function events(array $ids = []) public function generate(array $ids = []) : bool
{ {
$eventQuery = ' $eventQuery = '
SELECT SELECT
@@ -48,5 +44,6 @@ function events(array $ids = [])
return true; return true;
} }
});
?> ?>

View File

@@ -7,7 +7,15 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
$customData = array( SqlGen::register(new class extends SetupScript
{
use TrCustomData;
protected $command = 'factions';
protected $dbcSourceFiles = ['faction', 'factiontemplate'];
private $customData = array(
47 => ['qmNpcIds' => '33310'], 47 => ['qmNpcIds' => '33310'],
68 => ['qmNpcIds' => '33555'], 68 => ['qmNpcIds' => '33555'],
69 => ['qmNpcIds' => '33653'], 69 => ['qmNpcIds' => '33653'],
@@ -43,9 +51,8 @@ $customData = array(
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'];
function factions() public function generate(array $ids = []) : bool
{ {
$factionQuery = ' $factionQuery = '
REPLACE INTO REPLACE INTO
@@ -128,5 +135,6 @@ function factions()
return true; return true;
} }
});
?> ?>

View File

@@ -7,11 +7,13 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
$customData = array( SqlGen::register(new class extends SetupScript
); {
$reqDBC = ['factiontemplate']; protected $command = 'factiontemplate';
function factiontemplate() protected $dbcSourceFiles = ['factiontemplate'];
public function generate(array $ids = []) : bool
{ {
$query = ' $query = '
REPLACE INTO REPLACE INTO
@@ -34,5 +36,6 @@ function factiontemplate()
return true; return true;
} }
});
?> ?>

View File

@@ -6,9 +6,15 @@ if (!defined('AOWOW_REVISION'))
if (!CLI) if (!CLI)
die('not in cli mode'); die('not in cli mode');
$reqDBC = ['glyphproperties', 'spellicon'];
function glyphproperties() SqlGen::register(new class extends SetupScript
{
protected $command = 'glyphproperties';
protected $tblDependancyAowow = ['icons'];
protected $dbcSourceFiles = ['glyphproperties', 'spellicon'];
public function generate(array $ids = []) : bool
{ {
DB::Aowow()->query('REPLACE INTO ?_glyphproperties SELECT id, spellId, typeFlags, 0, iconId FROM dbc_glyphproperties'); DB::Aowow()->query('REPLACE INTO ?_glyphproperties SELECT id, spellId, typeFlags, 0, iconId FROM dbc_glyphproperties');
@@ -16,5 +22,6 @@ function glyphproperties()
return true; return true;
} }
});
?> ?>

View File

@@ -7,7 +7,16 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
$customData = array(
SqlGen::register(new class extends SetupScript
{
use TrCustomData;
protected $command = 'holidays';
protected $dbcSourceFiles = ['holidays', 'holidaydescriptions', 'holidaynames'];
private $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 ],
@@ -35,9 +44,8 @@ $customData = array(
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'];
function holidays() public function generate(array $ids = []) : bool
{ {
$query = ' $query = '
REPLACE INTO REPLACE INTO
@@ -55,5 +63,6 @@ function holidays()
return true; return true;
} }
});
?> ?>

View File

@@ -7,11 +7,13 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
$customData = array( SqlGen::register(new class extends SetupScript
); {
$reqDBC = ['spellicon', 'itemdisplayinfo', 'creaturefamily']; protected $command = 'icons';
function icons() protected $dbcSourceFiles = ['spellicon', 'itemdisplayinfo', 'creaturefamily'];
public function generate(array $ids = []) : bool
{ {
DB::Aowow()->query('TRUNCATE ?_icons'); DB::Aowow()->query('TRUNCATE ?_icons');
DB::Aowow()->query('ALTER TABLE ?_icons AUTO_INCREMENT = 1'); DB::Aowow()->query('ALTER TABLE ?_icons AUTO_INCREMENT = 1');
@@ -34,5 +36,6 @@ function icons()
return true; return true;
} }
});
?> ?>

View File

@@ -7,16 +7,6 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps:
* ?_items finalized
* ?_spell finalized
* dbc_spellitemenchantment
*/
$customData = array(
);
$reqDBC = ['spellitemenchantment'];
class ItemStatSetup extends ItemList class ItemStatSetup extends ItemList
{ {
private $statCols = []; private $statCols = [];
@@ -138,35 +128,14 @@ class ItemStatSetup extends ItemList
} }
} }
function item_stats(array $ids = []) SqlGen::register(new class extends SetupScript
{ {
$offset = 0; protected $command = 'item_stats'; // and enchantment stats
CLI::write(' - applying stats for enchantments'); protected $tblDependancyAowow = ['items', 'spell'];
$enchStats = enchantment_stats(); protected $dbcSourceFiles = ['spellitemenchantment'];
CLI::write(' '.count($enchStats).' enchantments parsed');
CLI::write(' - applying stats for items');
while (true) private function enchantment_stats() : array
{
$items = new ItemStatSetup($offset, SqlGen::$stepSize, $ids, $enchStats);
if ($items->error)
break;
$max = max($items->getFoundIDs());
$num = count($items->getFoundIDs());
CLI::write(' * sets '.($offset + 1).' - '.($max));
$offset = $max;
$items->writeStatsTable();
}
return true;
}
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');
@@ -274,4 +243,33 @@ function enchantment_stats()
return $result; return $result;
} }
public function generate(array $ids = []) : bool
{
$offset = 0;
CLI::write(' - applying stats for enchantments');
$enchStats = enchantment_stats();
CLI::write(' '.count($enchStats).' enchantments parsed');
CLI::write(' - applying stats for items');
while (true)
{
$items = new ItemStatSetup($offset, SqlGen::$sqlBatchSize, $ids, $enchStats);
if ($items->error)
break;
$max = max($items->getFoundIDs());
$num = count($items->getFoundIDs());
CLI::write(' * sets '.($offset + 1).' - '.($max));
$offset = $max;
$items->writeStatsTable();
}
return true;
}
});
?> ?>

View File

@@ -7,11 +7,14 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
$customData = array( SqlGen::register(new class extends SetupScript
); {
$reqDBC = ['spellitemenchantment']; protected $command = 'itemenchantment';
function itemenchantment() protected $tblDependancyTC = ['spell_enchant_proc_data'];
protected $dbcSourceFiles = ['spellitemenchantment'];
public function generate(array $ids = []) : bool
{ {
$baseQuery = ' $baseQuery = '
REPLACE INTO REPLACE INTO
@@ -33,5 +36,6 @@ function itemenchantment()
return true; return true;
} }
});
?> ?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'itemenchantmentcondition';
protected $dbcSourceFiles = ['spellitemenchantmentcondition'];
});
?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'itemextendedcost';
protected $dbcSourceFiles = ['itemextendedcost'];
});
?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'itemlimitcategory';
protected $dbcSourceFiles = ['itemlimitcategory'];
});
?>

View File

@@ -7,11 +7,13 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
$customData = array( SqlGen::register(new class extends SetupScript
); {
$reqDBC = ['itemrandomsuffix', 'itemrandomproperties']; protected $command = 'itemrandomenchant';
function itemrandomenchant() protected $dbcSourceFiles = ['itemrandomsuffix', 'itemrandomproperties'];
public function generate(array $ids = []) : bool
{ {
$query = ' $query = '
REPLACE INTO ?_itemrandomenchant REPLACE INTO ?_itemrandomenchant
@@ -23,5 +25,6 @@ function itemrandomenchant()
return true; return true;
} }
});
?> ?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'itemrandomproppoints';
protected $dbcSourceFiles = ['itemrandomproperties'];
});
?>

View File

@@ -7,14 +7,17 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps: SqlGen::register(new class extends SetupScript
* item_template {
* item_template_locale use TrCustomData;
* spell_group
* game_event
*/
$customData = array( protected $command = 'items';
protected $tblDependancyAowow = ['icons'];
protected $tblDependancyTC = ['item_template', 'item_template_locale', 'spell_group', 'game_event'];
protected $dbcSourceFiles = ['gemproperties', 'itemdisplayinfo', 'spell', 'glyphproperties', 'durabilityquality', 'durabilitycosts'];
private $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],
@@ -24,9 +27,15 @@ $customData = array(
7953 => ['itemset' => 221] 7953 => ['itemset' => 221]
); );
$reqDBC = ['gemproperties', 'itemdisplayinfo', 'spell', 'glyphproperties', 'durabilityquality', 'durabilitycosts']; private $skill2cat = array(
773 => 11, // inscription
356 => 9, // fishing
186 => 12, // mining
185 => 5, // cooking
171 => 6 // alchemy
);
function items(array $ids = []) public function generate(array $ids = []) : bool
{ {
$baseQuery = ' $baseQuery = '
SELECT SELECT
@@ -143,7 +152,7 @@ function items(array $ids = [])
?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::$sqlBatchSize))
{ {
$newMax = max(array_column($items, 'entry')); $newMax = max(array_column($items, 'entry'));
@@ -218,15 +227,7 @@ function items(array $ids = [])
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( foreach ($this->skill2cat as $skill => $cat)
773 => 11, // inscription
356 => 9, // fishing
186 => 12, // mining
185 => 5, // cooking
171 => 6 // alchemy
);
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
@@ -254,5 +255,6 @@ function items(array $ids = [])
return true; return true;
} }
});
?> ?>

View File

@@ -8,39 +8,35 @@ if (!CLI)
/* /*
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 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: SqlGen::register(new class extends SetupScript
* item_template {
* game_event use TrCustomData;
*/
protected $command = 'itemset';
$customData = array( protected $tblDependancyAowow = ['spell'];
protected $tblDependancyTC = ['item_template', 'game_event'];
protected $dbcSourceFiles = ['itemset'];
private $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'];
function itemset() private $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
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)
$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( private $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"
@@ -88,7 +84,7 @@ function itemset()
); );
// well .. fuck // well .. fuck
$tagsByNamePart = array( private $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",
@@ -99,6 +95,13 @@ function itemset()
30 => ['wrathful'] // "Arena Season 8 Set", 30 => ['wrathful'] // "Arena Season 8 Set",
); );
public function generate(array $ids = []) : bool
{
// 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($this->setToHoliday)))
foreach ($this->setToHoliday as &$hId)
$hId = !empty($pairs[$hId]) ? $pairs[$hId] : 0;
DB::Aowow()->query('TRUNCATE TABLE ?_itemset'); DB::Aowow()->query('TRUNCATE TABLE ?_itemset');
$vIdx = 0; $vIdx = 0;
@@ -111,7 +114,7 @@ function itemset()
$classMask = $type = 0; $classMask = $type = 0;
$hasRing = false; $hasRing = false;
$holiday = isset($setToHoliday[$setId]) ? $setToHoliday[$setId] : 0; $holiday = $this->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);
@@ -309,7 +312,7 @@ function itemset()
foreach ($items as $vId => $vSet) foreach ($items as $vId => $vSet)
{ {
$note = 0; $note = 0;
foreach ($tagsById as $tag => $sets) foreach ($this->tagsById as $tag => $sets)
{ {
if (!in_array($setId, $sets)) if (!in_array($setId, $sets))
continue; continue;
@@ -319,7 +322,7 @@ function itemset()
if (!$note && $min > 120 && $classMask && $classMask != CLASS_MASK_ALL) if (!$note && $min > 120 && $classMask && $classMask != CLASS_MASK_ALL)
{ {
foreach ($tagsByNamePart as $tag => $strings) foreach ($this->tagsByNamePart as $tag => $strings)
{ {
foreach ($strings as $str) foreach ($strings as $str)
{ {
@@ -366,5 +369,5 @@ function itemset()
return true; return true;
} }
});
?> ?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'lock';
protected $dbcSourceFiles = ['lock'];
});
?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'mailtemplate';
protected $dbcSourceFiles = ['mailtemplate'];
});
?>

View File

@@ -7,18 +7,14 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps: SqlGen::register(new class extends SetupScript
* gameobject_template {
* gameobject_template_locale protected $command = 'objects';
* gameobject_questitem
*/
protected $tblDependancyTC = ['gameobject_template', 'gameobject_template_locale', 'gameobject_questitem'];
protected $dbcSourceFiles = ['lock'];
$customData = array( public function generate(array $ids = []) : bool
);
$reqDBC = ['lock'];
function objects(array $ids = [])
{ {
$baseQuery = ' $baseQuery = '
SELECT SELECT
@@ -109,7 +105,7 @@ function objects(array $ids = [])
}'; }';
$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::$sqlBatchSize))
{ {
$newMax = max(array_column($objects, 'entry')); $newMax = max(array_column($objects, 'entry'));
@@ -126,5 +122,6 @@ function objects(array $ids = [])
return true; return true;
} }
});
?> ?>

View File

@@ -7,17 +7,15 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps: SqlGen::register(new class extends SetupScript
* creature_template {
* creature protected $command = 'pet';
*/
protected $tblDependancyAowow = ['icons'];
protected $tblDependancyTC = ['creature_template', 'creature'];
protected $dbcSourceFiles = ['talent', 'spell', 'skilllineability', 'creaturefamily'];
$customData = array( public function generate(array $ids = []) : bool
);
$reqDBC = ['talent', 'spell', 'skilllineability', 'creaturefamily'];
function pet(array $ids = [])
{ {
$baseQuery = ' $baseQuery = '
REPLACE INTO REPLACE INTO
@@ -123,5 +121,6 @@ function pet(array $ids = [])
return true; return true;
} }
});
?> ?>

View File

@@ -7,21 +7,14 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps: SqlGen::register(new class extends SetupScript
* quest_template {
* quest_template_addon protected $command = 'quests';
* quest_template_locale
* game_event
* game_event_seasonal_questrelation
* disables
*/
protected $tblDependancyTC = ['quest_template', 'quest_template_addon', 'quest_template_locale', 'game_event', 'game_event_seasonal_questrelation', 'disables'];
protected $dbcSourceFiles = ['questxp', 'questfactionreward'];
$customData = array( public function generate(array $ids = []) : bool
);
$reqDBC = ['questxp', 'questfactionreward'];
function quests(array $ids = [])
{ {
$baseQuery = ' $baseQuery = '
SELECT SELECT
@@ -178,7 +171,7 @@ function quests(array $ids = [])
$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::$sqlBatchSize))
{ {
$newMax = max(array_column($quests, 'ID')); $newMax = max(array_column($quests, 'ID'));
@@ -268,5 +261,6 @@ function quests(array $ids = [])
return true; return true;
} }
});
?> ?>

View File

@@ -7,23 +7,13 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps: SqlGen::register(new class extends SetupScript
* creature_queststarter {
* creature_questender protected $command = 'quests_startend';
* game_event_creature_quest
* gameobject_queststarter
* gameobject_questender
* game_event_gameobject_quest
* item_template
*/
protected $tblDependancyTC = ['creature_queststarter', 'creature_questender', 'game_event_creature_quest', 'gameobject_queststarter', 'gameobject_questender', 'game_event_gameobject_quest', 'item_template'];
$customData = array( public function generate(array $ids = []) : bool
);
$reqDBC = array(
);
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
@@ -53,5 +43,6 @@ function quests_startend(/* array $ids = [] */)
return true; return true;
} }
});
?> ?>

View File

@@ -7,7 +7,15 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
$customData = array( SqlGen::register(new class extends SetupScript
{
use TrCustomData;
protected $command = 'races';
protected $dbcSourceFiles = ['chrraces', 'charbaseinfo'];
private $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],
@@ -21,9 +29,8 @@ $customData = array(
['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'];
function races() public function generate(array $ids = []) : bool
{ {
/**********/ /**********/
/* Basics */ /* Basics */
@@ -47,5 +54,6 @@ function races()
return true; return true;
} }
});
?> ?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'scalingstatdistribution';
protected $dbcSourceFiles = ['scalingstatdistribution'];
});
?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'scalingstatvalues';
protected $dbcSourceFiles = ['scalingstatvalues'];
});
?>

View File

@@ -7,22 +7,40 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
$customData = array( SqlGen::register(new class extends SetupScript
{
use TrCustomData;
protected $command = 'shapeshiftforms';
protected $dbcSourceFiles = ['spellshapeshiftform'];
private $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'];
function shapeshiftforms() public function generate(array $ids = []) : bool
{ {
DB::Aowow()->query('REPLACE INTO ?_shapeshiftforms SELECT id, flags, creatureType, displayIdA, displayIdH, spellId1, spellId2, spellId3, spellId4, spellId5, spellId6, spellId7, spellId8, IF(name_loc0 = "", IF(name_loc2 = "", IF(name_loc3 = "", IF(name_loc6 = "", IF(name_loc8 = "", "???", name_loc8), name_loc6), name_loc3), name_loc2), name_loc0) FROM dbc_spellshapeshiftform'); DB::Aowow()->query('
REPLACE INTO
?_shapeshiftforms
SELECT
id, flags, creatureType,
displayIdA, displayIdH,
spellId1, spellId2, spellId3, spellId4, spellId5, spellId6, spellId7, spellId8,
IF(name_loc0 = "", IF(name_loc2 = "", IF(name_loc3 = "", IF(name_loc6 = "", IF(name_loc8 = "", "???", name_loc8), name_loc6), name_loc3), name_loc2), name_loc0)
FROM
dbc_spellshapeshiftform'
);
return true; return true;
} }
});
?> ?>

View File

@@ -6,7 +6,17 @@ if (!defined('AOWOW_REVISION'))
if (!CLI) if (!CLI)
die('not in cli mode'); die('not in cli mode');
$customData = array(
SqlGen::register(new class extends SetupScript
{
use TrCustomData;
protected $command = 'skillline';
protected $tblDependancyAowow = ['icons'];
protected $dbcSourceFiles = ['skillline', 'spell', 'skilllineability'];
private $customData = array(
393 => ['professionMask' => 0x0000], // Skinning 393 => ['professionMask' => 0x0000], // 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
@@ -26,9 +36,8 @@ $customData = array(
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'];
function skillline() public function generate(array $ids = []) : bool
{ {
$baseQuery = ' $baseQuery = '
REPLACE INTO REPLACE INTO
@@ -72,5 +81,6 @@ function skillline()
return true; return true;
} }
});
?> ?>

View File

@@ -7,10 +7,13 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
$customData = array( SqlGen::register(new class extends SetupScript
15407 => ['cat' => 10] // UR_Algalon_Summon03 (this is not an item pickup) {
); use TrCustomData;
$reqDBC = array(
protected $command = 'sounds';
protected $dbcSourceFiles = array(
// base emotes race // base emotes race
'soundentries', 'emotestextsound', 'vocaluisounds', 'soundentries', 'emotestextsound', 'vocaluisounds',
// creatures // creatures
@@ -23,8 +26,11 @@ $reqDBC = array(
'material', 'itemgroupsounds', 'itemdisplayinfo', 'weaponimpactsounds', 'itemsubclass', 'weaponswingsounds2' /*, 'sheathesoundlookups' data is redundant with material..? */ 'material', 'itemgroupsounds', 'itemdisplayinfo', 'weaponimpactsounds', 'itemsubclass', 'weaponswingsounds2' /*, 'sheathesoundlookups' data is redundant with material..? */
); );
private $customData = array(
15407 => ['cat' => 10] // UR_Algalon_Summon03 (this is not an item pickup)
);
function sounds(/*array $ids = [] */) public function generate(array $ids = []) : bool
{ {
/* /*
okay, here's the thing. WMOAreaTable.dbc references WMO-files to get its position in the world (AreTable) and has sparse information on the related AreaTables themself. okay, here's the thing. WMOAreaTable.dbc references WMO-files to get its position in the world (AreTable) and has sparse information on the related AreaTables themself.
@@ -70,7 +76,7 @@ function sounds(/*array $ids = [] */)
$lastMax = 0; $lastMax = 0;
$soundFileIdx = 0; $soundFileIdx = 0;
$soundIndex = []; $soundIndex = [];
while ($sounds = DB::Aowow()->select($query, $lastMax, SqlGen::$stepSize)) while ($sounds = DB::Aowow()->select($query, $lastMax, SqlGen::$sqlBatchSize))
{ {
$newMax = max(array_column($sounds, 'id')); $newMax = max(array_column($sounds, 'id'));
@@ -403,7 +409,6 @@ function sounds(/*array $ids = [] */)
} }
} }
DB::Aowow()->query(' DB::Aowow()->query('
INSERT INTO INSERT INTO
?_items_sounds ?_items_sounds
@@ -423,5 +428,6 @@ function sounds(/*array $ids = [] */)
return true; return true;
} }
});
?> ?>

View File

@@ -7,49 +7,15 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps: SqlGen::register(new class extends SetupScript
* reference_loot_template
* item_loot_template
* creature_loot_template
* gameobject_loot_template
* mail_loot_template
* disenchant_loot_template
* fishing_loot_template
* skinning_loot_template
* milling_loot_template
* prospecting_loot_template
* pickpocketing_loot_template
* item_template
* creature_template
* gameobject_template
* quest_template
* quest_template_addon
* skill_perfect_item_template
* npc_trainer
* npc_vendor
* game_event_npc_vendor
* creature
* playercreateinfo_item
* playercreateinfo_skill
* achievement_reward
* skill_discovery_template
*/
$customData = array(
);
$reqDBC = ['charstartoutfit', 'talent', 'spell', 'skilllineability', 'itemextendedcost', 'lock'];
function source(array $ids = [])
{ {
$insBasic = 'INSERT INTO ?_source (`type`, typeId, src?d) VALUES [V] ON DUPLICATE KEY UPDATE moreType = NULL, moreTypeId = NULL, src?d = VALUES(src?d)'; protected $command = 'source';
$insMore = 'INSERT INTO ?_source (`type`, typeId, src?d, moreType, moreTypeId) VALUES [V] ON DUPLICATE KEY UPDATE moreType = NULL, moreTypeId = NULL, src?d = VALUES(src?d)';
$insSub = 'INSERT INTO ?_source (`type`, typeId, src?d, moreType, moreTypeId) ?s ON DUPLICATE KEY UPDATE moreType = NULL, moreTypeId = NULL, src?d = VALUES(src?d)';
// please note, this workes without checks, because we do not use strings here protected $tblDependancyAowow = ['spell', 'achievement'];
function queryfy($ph, array $data, $query) protected $tblDependancyTC = ['playercreateinfo_skills', 'playercreateinfo_item', 'skill_discovery_template', 'achievement_reward', 'skill_perfect_item_template', 'item_template', 'gameobject_template', 'quest_template', 'quest_template_addon', 'creature_template', 'creature', 'npc_trainer', 'npc_vendor', 'game_event_npc_vendor', 'reference_loot_template', 'item_loot_template', 'creature_loot_template', 'gameobject_loot_template', 'mail_loot_template', 'disenchant_loot_template', 'fishing_loot_template', 'skinning_loot_template', 'milling_loot_template', 'prospecting_loot_template', 'pickpocketing_loot_template'];
protected $dbcSourceFiles = ['charstartoutfit', 'talent', 'spell', 'skilllineability', 'itemextendedcost', 'lock'];
private function queryfy(array $data, string $query) : string
{ {
$buff = []; $buff = [];
@@ -61,10 +27,10 @@ function source(array $ids = [])
foreach ($data as $d) foreach ($data as $d)
$buff[] = '('.implode(', ', $d ?: 'NULL').')'; $buff[] = '('.implode(', ', $d ?: 'NULL').')';
return str_replace($ph, implode(', ', $buff), $query); return str_replace('[V]', implode(', ', $buff), $query);
} }
function pushBuffer(&$buff, $type, $typeId, $mType = 0, $mTypeId = 0, $src = 1) private function pushBuffer(array &$buff, int $type, int $typeId, int $mType = 0, int $mTypeId = 0, int $src = 1) : void
{ {
$b = &$buff[$typeId]; $b = &$buff[$typeId];
@@ -81,7 +47,7 @@ function source(array $ids = [])
$b = [$type, $typeId, $src, null, null]; $b = [$type, $typeId, $src, null, null];
} }
function taughtSpell($item) private function taughtSpell(array $item) : int
{ {
# spelltrigger_X (0: onUse; 6: onLearnSpell) # spelltrigger_X (0: onUse; 6: onLearnSpell)
# spell: 483 & 55884 are learn spells # spell: 483 & 55884 are learn spells
@@ -101,6 +67,12 @@ function source(array $ids = [])
return 0; return 0;
} }
public function generate(array $ids = []) : bool
{
$insBasic = 'INSERT INTO ?_source (`type`, typeId, src?d) VALUES [V] ON DUPLICATE KEY UPDATE moreType = NULL, moreTypeId = NULL, src?d = VALUES(src?d)';
$insMore = 'INSERT INTO ?_source (`type`, typeId, src?d, moreType, moreTypeId) VALUES [V] ON DUPLICATE KEY UPDATE moreType = NULL, moreTypeId = NULL, src?d = VALUES(src?d)';
$insSub = 'INSERT INTO ?_source (`type`, typeId, src?d, moreType, moreTypeId) ?s ON DUPLICATE KEY UPDATE moreType = NULL, moreTypeId = NULL, src?d = VALUES(src?d)';
// cant update existing rows // cant update existing rows
if ($ids) if ($ids)
DB::Aowow()->query('DELETE FROM ?_source WHERE `type` = ?d AND typeId IN (?a)', $well, $wellll); DB::Aowow()->query('DELETE FROM ?_source WHERE `type` = ?d AND typeId IN (?a)', $well, $wellll);
@@ -188,17 +160,17 @@ function source(array $ids = [])
foreach ($spellItems as $iId => $si) foreach ($spellItems as $iId => $si)
{ {
if ($_ = taughtSpell($si)) if ($_ = $this->taughtSpell($si))
$spellBuff[$_] = [TYPE_SPELL, $_, 1, TYPE_SPELL, $itemSpells[$iId]]; $spellBuff[$_] = [TYPE_SPELL, $_, 1, TYPE_SPELL, $itemSpells[$iId]];
$itemBuff[$iId] = [TYPE_ITEM, $iId, 1, TYPE_SPELL, $itemSpells[$iId]]; $itemBuff[$iId] = [TYPE_ITEM, $iId, 1, TYPE_SPELL, $itemSpells[$iId]];
} }
if ($itemBuff) if ($itemBuff)
DB::Aowow()->query(queryfy('[V]', $itemBuff, $insMore), 1, 1, 1); DB::Aowow()->query($this->queryfy($itemBuff, $insMore), 1, 1, 1);
if ($spellBuff) if ($spellBuff)
DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 1, 1, 1); DB::Aowow()->query($this->queryfy($spellBuff, $insMore), 1, 1, 1);
############ ############
@@ -232,19 +204,19 @@ function source(array $ids = [])
{ {
foreach ($refLoot[-$roi] as $iId => $r) foreach ($refLoot[-$roi] as $iId => $r)
{ {
if ($_ = taughtSpell($r)) if ($_ = $this->taughtSpell($r))
pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry'] /*, $lootmode */); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry'] /*, $lootmode */);
pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry'] /*, $lootmode */); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry'] /*, $lootmode */);
} }
continue; continue;
} }
if ($_ = taughtSpell($l)) if ($_ = $this->taughtSpell($l))
pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry'] /*, $lootmode */); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry'] /*, $lootmode */);
pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry'] /*, $lootmode */); $this->pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry'] /*, $lootmode */);
} }
$objectOT = []; $objectOT = [];
@@ -274,21 +246,21 @@ function source(array $ids = [])
{ {
foreach ($refLoot[-$roi] as $iId => $r) foreach ($refLoot[-$roi] as $iId => $r)
{ {
if ($_ = taughtSpell($r)) if ($_ = $this->taughtSpell($r))
pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']);
$objectOT[] = $iId; $objectOT[] = $iId;
pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']);
} }
continue; continue;
} }
if ($_ = taughtSpell($l)) if ($_ = $this->taughtSpell($l))
pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']);
$objectOT[] = $roi; $objectOT[] = $roi;
pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']);
} }
$itemOT = []; $itemOT = [];
@@ -316,28 +288,28 @@ function source(array $ids = [])
{ {
foreach ($refLoot[-$roi] as $iId => $r) foreach ($refLoot[-$roi] as $iId => $r)
{ {
if ($_ = taughtSpell($r)) if ($_ = $this->taughtSpell($r))
pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_ITEM, $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_ITEM, $l['entry']);
$itemOT[] = $iId; $itemOT[] = $iId;
pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_ITEM, $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_ITEM, $l['entry']);
} }
continue; continue;
} }
if ($_ = taughtSpell($l)) if ($_ = $this->taughtSpell($l))
pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_ITEM, $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_ITEM, $l['entry']);
$itemOT[] = $roi; $itemOT[] = $roi;
pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_ITEM, $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_ITEM, $l['entry']);
} }
if ($itemBuff) if ($itemBuff)
DB::Aowow()->query(queryfy('[V]', $itemBuff, $insMore), 2, 2, 2); DB::Aowow()->query($this->queryfy($itemBuff, $insMore), 2, 2, 2);
if ($spellBuff) if ($spellBuff)
DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 2, 2, 2); DB::Aowow()->query($this->queryfy($spellBuff, $insMore), 2, 2, 2);
DB::Aowow()->query('UPDATE ?_items SET cuFLags = cuFlags | ?d WHERE id IN (?a)', ITEM_CU_OT_ITEMLOOT, $itemOT); DB::Aowow()->query('UPDATE ?_items SET cuFLags = cuFlags | ?d WHERE id IN (?a)', ITEM_CU_OT_ITEMLOOT, $itemOT);
DB::Aowow()->query('UPDATE ?_items SET cuFLags = cuFlags | ?d WHERE id IN (?a)', ITEM_CU_OT_OBJECTLOOT, $objectOT); DB::Aowow()->query('UPDATE ?_items SET cuFLags = cuFlags | ?d WHERE id IN (?a)', ITEM_CU_OT_OBJECTLOOT, $objectOT);
@@ -367,7 +339,7 @@ function source(array $ids = [])
foreach (DB::World()->select($vendorQuery, $xCostA, $xCostA) as $iId => $v) foreach (DB::World()->select($vendorQuery, $xCostA, $xCostA) as $iId => $v)
{ {
if ($_ = taughtSpell($v)) if ($_ = $this->taughtSpell($v))
$spellBuff[$_] = [TYPE_SPELL, $_, 1]; $spellBuff[$_] = [TYPE_SPELL, $_, 1];
$itemBuff[$iId] = [TYPE_ITEM, $iId, 1]; $itemBuff[$iId] = [TYPE_ITEM, $iId, 1];
@@ -375,17 +347,17 @@ function source(array $ids = [])
foreach (DB::World()->select($vendorQuery, $xCostH, $xCostH) as $iId => $v) foreach (DB::World()->select($vendorQuery, $xCostH, $xCostH) as $iId => $v)
{ {
if ($_ = taughtSpell($v)) if ($_ = $this->taughtSpell($v))
$spellBuff[$_] = [TYPE_SPELL, $_, 2]; $spellBuff[$_] = [TYPE_SPELL, $_, 2];
$itemBuff[$iId] = [TYPE_ITEM, $iId, 2]; $itemBuff[$iId] = [TYPE_ITEM, $iId, 2];
} }
if ($itemBuff) if ($itemBuff)
DB::Aowow()->query(queryfy('[V]', $itemBuff, $insBasic), 3, 3, 3); DB::Aowow()->query($this->queryfy($itemBuff, $insBasic), 3, 3, 3);
if ($spellBuff) if ($spellBuff)
DB::Aowow()->query(queryfy('[V]', $spellBuff, $insBasic), 3, 3, 3); DB::Aowow()->query($this->queryfy($spellBuff, $insBasic), 3, 3, 3);
############# #############
@@ -413,10 +385,10 @@ function source(array $ids = [])
); );
foreach ($quests as $iId => $q) foreach ($quests as $iId => $q)
{ {
if ($_ = taughtSpell($q)) if ($_ = $this->taughtSpell($q))
pushBuffer($spellBuff, TYPE_SPELL, $_, $q['qty'] > 1 ? 0 : TYPE_QUEST, $q['quest'], $q['side']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $q['qty'] > 1 ? 0 : TYPE_QUEST, $q['quest'], $q['side']);
pushBuffer($itemBuff, TYPE_ITEM, $iId, $q['qty'] > 1 ? 0 : TYPE_QUEST, $q['quest'], $q['side']); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId, $q['qty'] > 1 ? 0 : TYPE_QUEST, $q['quest'], $q['side']);
} }
$mailLoot = DB::World()->select(' $mailLoot = DB::World()->select('
@@ -446,28 +418,28 @@ function source(array $ids = [])
{ {
foreach ($refLoot[-$roi] as $iId => $r) foreach ($refLoot[-$roi] as $iId => $r)
{ {
if ($_ = taughtSpell($r)) if ($_ = $this->taughtSpell($r))
pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_QUEST, $l['entry'], $l['side']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_QUEST, $l['entry'], $l['side']);
$itemOT[] = $iId; $itemOT[] = $iId;
pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_QUEST, $l['entry'], $l['side']); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_QUEST, $l['entry'], $l['side']);
} }
continue; continue;
} }
if ($_ = taughtSpell($l)) if ($_ = $this->taughtSpell($l))
pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_QUEST, $l['entry'], $l['side']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_QUEST, $l['entry'], $l['side']);
$itemOT[] = $roi; $itemOT[] = $roi;
pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_QUEST, $l['entry'], $l['side']); $this->pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_QUEST, $l['entry'], $l['side']);
} }
if ($itemBuff) if ($itemBuff)
DB::Aowow()->query(queryfy('[V]', $itemBuff, $insMore), 4, 4, 4); DB::Aowow()->query($this->queryfy($itemBuff, $insMore), 4, 4, 4);
if ($spellBuff) if ($spellBuff)
DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 4, 4, 4); DB::Aowow()->query($this->queryfy($spellBuff, $insMore), 4, 4, 4);
############## ##############
@@ -491,17 +463,17 @@ function source(array $ids = [])
foreach ($vendors as $iId => $v) foreach ($vendors as $iId => $v)
{ {
if ($_ = taughtSpell($v)) if ($_ = $this->taughtSpell($v))
pushBuffer($spellBuff, TYPE_SPELL, $_, $v['qty'] > 1 ? 0 : TYPE_NPC, $v['npc']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $v['qty'] > 1 ? 0 : TYPE_NPC, $v['npc']);
pushBuffer($itemBuff, TYPE_ITEM, $iId, $v['qty'] > 1 ? 0 : TYPE_NPC, $v['npc']); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId, $v['qty'] > 1 ? 0 : TYPE_NPC, $v['npc']);
} }
if ($itemBuff) if ($itemBuff)
DB::Aowow()->query(queryfy('[V]', $itemBuff, $insMore), 5, 5, 5); DB::Aowow()->query($this->queryfy($itemBuff, $insMore), 5, 5, 5);
if ($spellBuff) if ($spellBuff)
DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 5, 5, 5); DB::Aowow()->query($this->queryfy($spellBuff, $insMore), 5, 5, 5);
############### ###############
@@ -510,7 +482,7 @@ function source(array $ids = [])
CLI::write(' * #10 Starter'); CLI::write(' * #10 Starter');
if ($pcii = DB::World()->select('SELECT ?d, itemid, 1 FROM playercreateinfo_item', TYPE_ITEM)) if ($pcii = DB::World()->select('SELECT ?d, itemid, 1 FROM playercreateinfo_item', TYPE_ITEM))
DB::Aowow()->query(queryfy('[V]', $pcii, $insBasic), 10, 10, 10); DB::Aowow()->query($this->queryfy($pcii, $insBasic), 10, 10, 10);
for ($i = 1; $i < 21; $i++) for ($i = 1; $i < 21; $i++)
DB::Aowow()->query($insSub, 10, DB::Aowow()->subquery('SELECT ?d, item?d, 1, NULL AS m, NULL AS mt FROM dbc_charstartoutfit WHERE item?d > 0', TYPE_ITEM, $i, $i), 10, 10); DB::Aowow()->query($insSub, 10, DB::Aowow()->subquery('SELECT ?d, item?d, 1, NULL AS m, NULL AS mt FROM dbc_charstartoutfit WHERE item?d > 0', TYPE_ITEM, $i, $i), 10, 10);
@@ -544,10 +516,10 @@ function source(array $ids = [])
$extraItems = DB::World()->select('SELECT entry AS ARRAY_KEY, class, subclass, spellid_1, spelltrigger_1, spellid_2, spelltrigger_2 FROM item_template WHERE entry IN (?a)', array_keys($xItems)); $extraItems = DB::World()->select('SELECT entry AS ARRAY_KEY, class, subclass, spellid_1, spelltrigger_1, spellid_2, spelltrigger_2 FROM item_template WHERE entry IN (?a)', array_keys($xItems));
foreach ($extraItems as $iId => $l) foreach ($extraItems as $iId => $l)
{ {
if ($_ = taughtSpell($l)) if ($_ = $this->taughtSpell($l))
pushBuffer($spellBuff, TYPE_SPELL, $_, $xItems[$iId]['qty'] > 1 ? 0 : TYPE_ACHIEVEMENT, $xItems[$iId]['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $xItems[$iId]['qty'] > 1 ? 0 : TYPE_ACHIEVEMENT, $xItems[$iId]['entry']);
pushBuffer($itemBuff, TYPE_ITEM, $iId, $xItems[$iId]['qty'] > 1 ? 0 : TYPE_ACHIEVEMENT, $xItems[$iId]['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId, $xItems[$iId]['qty'] > 1 ? 0 : TYPE_ACHIEVEMENT, $xItems[$iId]['entry']);
} }
foreach ($rewItems as $iId => $l) foreach ($rewItems as $iId => $l)
@@ -556,26 +528,26 @@ function source(array $ids = [])
{ {
foreach ($refLoot[-$roi] as $iId => $r) foreach ($refLoot[-$roi] as $iId => $r)
{ {
if ($_ = taughtSpell($r)) if ($_ = $this->taughtSpell($r))
pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_ACHIEVEMENT, $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_ACHIEVEMENT, $l['entry']);
pushBuffer($itemBuff, TYPE_ITEM, $iId, $l['qty'] > 1 ? 0 : TYPE_ACHIEVEMENT, $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId, $l['qty'] > 1 ? 0 : TYPE_ACHIEVEMENT, $l['entry']);
} }
continue; continue;
} }
if ($_ = taughtSpell($l)) if ($_ = $this->taughtSpell($l))
pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_ACHIEVEMENT, $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_ACHIEVEMENT, $l['entry']);
pushBuffer($itemBuff, TYPE_ITEM, $iId, $l['qty'] > 1 ? 0 : TYPE_ACHIEVEMENT, $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId, $l['qty'] > 1 ? 0 : TYPE_ACHIEVEMENT, $l['entry']);
} }
if ($itemBuff) if ($itemBuff)
DB::Aowow()->query(queryfy('[V]', $itemBuff, $insMore), 12, 12, 12); DB::Aowow()->query($this->queryfy($itemBuff, $insMore), 12, 12, 12);
if ($spellBuff) if ($spellBuff)
DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 12, 12, 12); DB::Aowow()->query($this->queryfy($spellBuff, $insMore), 12, 12, 12);
#################### ####################
@@ -609,26 +581,26 @@ function source(array $ids = [])
{ {
foreach ($refLoot[-$roi] as $iId => $r) foreach ($refLoot[-$roi] as $iId => $r)
{ {
if ($_ = taughtSpell($r)) if ($_ = $this->taughtSpell($r))
pushBuffer($spellBuff, TYPE_SPELL, $_); $this->pushBuffer($spellBuff, TYPE_SPELL, $_);
pushBuffer($itemBuff, TYPE_ITEM, $iId); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId);
} }
continue; continue;
} }
if ($_ = taughtSpell($l)) if ($_ = $this->taughtSpell($l))
pushBuffer($spellBuff, TYPE_SPELL, $_); $this->pushBuffer($spellBuff, TYPE_SPELL, $_);
pushBuffer($itemBuff, TYPE_ITEM, $roi); $this->pushBuffer($itemBuff, TYPE_ITEM, $roi);
} }
if ($itemBuff) if ($itemBuff)
DB::Aowow()->query(queryfy('[V]', $itemBuff, $insMore), 15, 15, 15); DB::Aowow()->query($this->queryfy($itemBuff, $insMore), 15, 15, 15);
if ($spellBuff) if ($spellBuff)
DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 15, 15, 15); DB::Aowow()->query($this->queryfy($spellBuff, $insMore), 15, 15, 15);
############## ##############
@@ -660,26 +632,26 @@ function source(array $ids = [])
{ {
foreach ($refLoot[-$roi] as $iId => $r) foreach ($refLoot[-$roi] as $iId => $r)
{ {
if ($_ = taughtSpell($r)) if ($_ = $this->taughtSpell($r))
pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']);
pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']);
} }
continue; continue;
} }
if ($_ = taughtSpell($l)) if ($_ = $this->taughtSpell($l))
pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']);
pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_OBJECT, $l['entry']);
} }
if ($itemBuff) if ($itemBuff)
DB::Aowow()->query(queryfy('[V]', $itemBuff, $insMore), 16, 16, 16); DB::Aowow()->query($this->queryfy($itemBuff, $insMore), 16, 16, 16);
if ($spellBuff) if ($spellBuff)
DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 16, 16, 16); DB::Aowow()->query($this->queryfy($spellBuff, $insMore), 16, 16, 16);
################ ################
@@ -715,26 +687,26 @@ function source(array $ids = [])
{ {
foreach ($refLoot[-$roi] as $iId => $r) foreach ($refLoot[-$roi] as $iId => $r)
{ {
if ($_ = taughtSpell($r)) if ($_ = $this->taughtSpell($r))
pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : $l['srcType'], $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : $l['srcType'], $l['entry']);
pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : $l['srcType'], $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : $l['srcType'], $l['entry']);
} }
continue; continue;
} }
if ($_ = taughtSpell($l)) if ($_ = $this->taughtSpell($l))
pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : $l['srcType'], $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : $l['srcType'], $l['entry']);
pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : $l['srcType'], $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : $l['srcType'], $l['entry']);
} }
if ($itemBuff) if ($itemBuff)
DB::Aowow()->query(queryfy('[V]', $itemBuff, $insMore), 17, 17, 17); DB::Aowow()->query($this->queryfy($itemBuff, $insMore), 17, 17, 17);
if ($spellBuff) if ($spellBuff)
DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 17, 17, 17); DB::Aowow()->query($this->queryfy($spellBuff, $insMore), 17, 17, 17);
############## ##############
@@ -766,26 +738,26 @@ function source(array $ids = [])
{ {
foreach ($refLoot[-$roi] as $iId => $r) foreach ($refLoot[-$roi] as $iId => $r)
{ {
if ($_ = taughtSpell($r)) if ($_ = $this->taughtSpell($r))
pushBuffer($spellBuff, TYPE_SPELL, $_); $this->pushBuffer($spellBuff, TYPE_SPELL, $_);
pushBuffer($itemBuff, TYPE_ITEM, $iId); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId);
} }
continue; continue;
} }
if ($_ = taughtSpell($l)) if ($_ = $this->taughtSpell($l))
pushBuffer($spellBuff, TYPE_SPELL, $_); $this->pushBuffer($spellBuff, TYPE_SPELL, $_);
pushBuffer($itemBuff, TYPE_ITEM, $roi); $this->pushBuffer($itemBuff, TYPE_ITEM, $roi);
} }
if ($itemBuff) if ($itemBuff)
DB::Aowow()->query(queryfy('[V]', $itemBuff, $insMore), 18, 18, 18); DB::Aowow()->query($this->queryfy($itemBuff, $insMore), 18, 18, 18);
if ($spellBuff) if ($spellBuff)
DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 18, 18, 18); DB::Aowow()->query($this->queryfy($spellBuff, $insMore), 18, 18, 18);
############# #############
@@ -821,26 +793,26 @@ function source(array $ids = [])
{ {
foreach ($refLoot[-$roi] as $iId => $r) foreach ($refLoot[-$roi] as $iId => $r)
{ {
if ($_ = taughtSpell($r)) if ($_ = $this->taughtSpell($r))
pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : $l['srcType'], $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : $l['srcType'], $l['entry']);
pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : $l['srcType'], $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : $l['srcType'], $l['entry']);
} }
continue; continue;
} }
if ($_ = taughtSpell($l)) if ($_ = $this->taughtSpell($l))
pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : $l['srcType'], $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : $l['srcType'], $l['entry']);
pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : $l['srcType'], $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : $l['srcType'], $l['entry']);
} }
if ($itemBuff) if ($itemBuff)
DB::Aowow()->query(queryfy('[V]', $itemBuff, $insMore), 19, 19, 19); DB::Aowow()->query($this->queryfy($itemBuff, $insMore), 19, 19, 19);
if ($spellBuff) if ($spellBuff)
DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 19, 19, 19); DB::Aowow()->query($this->queryfy($spellBuff, $insMore), 19, 19, 19);
################## ##################
@@ -872,26 +844,26 @@ function source(array $ids = [])
{ {
foreach ($refLoot[-$roi] as $iId => $r) foreach ($refLoot[-$roi] as $iId => $r)
{ {
if ($_ = taughtSpell($r)) if ($_ = $this->taughtSpell($r))
pushBuffer($spellBuff, TYPE_SPELL, $_); $this->pushBuffer($spellBuff, TYPE_SPELL, $_);
pushBuffer($itemBuff, TYPE_ITEM, $iId); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId);
} }
continue; continue;
} }
if ($_ = taughtSpell($l)) if ($_ = $this->taughtSpell($l))
pushBuffer($spellBuff, TYPE_SPELL, $_); $this->pushBuffer($spellBuff, TYPE_SPELL, $_);
pushBuffer($itemBuff, TYPE_ITEM, $roi); $this->pushBuffer($itemBuff, TYPE_ITEM, $roi);
} }
if ($itemBuff) if ($itemBuff)
DB::Aowow()->query(queryfy('[V]', $itemBuff, $insMore), 20, 20, 20); DB::Aowow()->query($this->queryfy($itemBuff, $insMore), 20, 20, 20);
if ($spellBuff) if ($spellBuff)
DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 20, 20, 20); DB::Aowow()->query($this->queryfy($spellBuff, $insMore), 20, 20, 20);
################## ##################
@@ -922,26 +894,26 @@ function source(array $ids = [])
{ {
foreach ($refLoot[-$roi] as $iId => $r) foreach ($refLoot[-$roi] as $iId => $r)
{ {
if ($_ = taughtSpell($r)) if ($_ = $this->taughtSpell($r))
pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']);
pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']);
} }
continue; continue;
} }
if ($_ = taughtSpell($l)) if ($_ = $this->taughtSpell($l))
pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']);
pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']);
} }
if ($itemBuff) if ($itemBuff)
DB::Aowow()->query(queryfy('[V]', $itemBuff, $insMore), 21, 21, 21); DB::Aowow()->query($this->queryfy($itemBuff, $insMore), 21, 21, 21);
if ($spellBuff) if ($spellBuff)
DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 21, 21, 21); DB::Aowow()->query($this->queryfy($spellBuff, $insMore), 21, 21, 21);
################ ################
@@ -973,26 +945,26 @@ function source(array $ids = [])
{ {
foreach ($refLoot[-$roi] as $iId => $r) foreach ($refLoot[-$roi] as $iId => $r)
{ {
if ($_ = taughtSpell($r)) if ($_ = $this->taughtSpell($r))
pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']);
pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']);
} }
continue; continue;
} }
if ($_ = taughtSpell($l)) if ($_ = $this->taughtSpell($l))
pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']);
pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']);
} }
if ($itemBuff) if ($itemBuff)
DB::Aowow()->query(queryfy('[V]', $itemBuff, $insMore), 22, 22, 22); DB::Aowow()->query($this->queryfy($itemBuff, $insMore), 22, 22, 22);
if ($spellBuff) if ($spellBuff)
DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 22, 22, 22); DB::Aowow()->query($this->queryfy($spellBuff, $insMore), 22, 22, 22);
############### ###############
@@ -1024,26 +996,26 @@ function source(array $ids = [])
{ {
foreach ($refLoot[-$roi] as $iId => $r) foreach ($refLoot[-$roi] as $iId => $r)
{ {
if ($_ = taughtSpell($r)) if ($_ = $this->taughtSpell($r))
pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']);
pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $iId, $r['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']);
} }
continue; continue;
} }
if ($_ = taughtSpell($l)) if ($_ = $this->taughtSpell($l))
pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']); $this->pushBuffer($spellBuff, TYPE_SPELL, $_, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']);
pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']); $this->pushBuffer($itemBuff, TYPE_ITEM, $roi, $l['qty'] > 1 ? 0 : TYPE_NPC, $l['entry']);
} }
if ($itemBuff) if ($itemBuff)
DB::Aowow()->query(queryfy('[V]', $itemBuff, $insMore), 23, 23, 23); DB::Aowow()->query($this->queryfy($itemBuff, $insMore), 23, 23, 23);
if ($spellBuff) if ($spellBuff)
DB::Aowow()->query(queryfy('[V]', $spellBuff, $insMore), 23, 23, 23); DB::Aowow()->query($this->queryfy($spellBuff, $insMore), 23, 23, 23);
// flagging aowow_items for source (note: this is not exact! creatures dropping items may not be spawnd, quests granting items may be disabled) // flagging aowow_items for source (note: this is not exact! creatures dropping items may not be spawnd, quests granting items may be disabled)
@@ -1077,11 +1049,11 @@ function source(array $ids = [])
if ($spell['effect'.$i.'Id'] != 36) // effect: learnSpell if ($spell['effect'.$i.'Id'] != 36) // effect: learnSpell
continue; continue;
pushBuffer($buff, TYPE_SPELL, $spell['effect'.$i.'TriggerSpell'], $quests[$sId]['qty'] > 1 ? 0 : TYPE_QUEST, $quests[$sId]['qty'] > 1 ? 0 : $quests[$sId]['id'], $quests[$sId]['side']); $this->pushBuffer($buff, TYPE_SPELL, $spell['effect'.$i.'TriggerSpell'], $quests[$sId]['qty'] > 1 ? 0 : TYPE_QUEST, $quests[$sId]['qty'] > 1 ? 0 : $quests[$sId]['id'], $quests[$sId]['side']);
} }
} }
DB::Aowow()->query(queryfy('[V]', $buff, $insMore), 4, 4, 4); DB::Aowow()->query($this->queryfy($buff, $insMore), 4, 4, 4);
} }
# 6: Trainer # 6: Trainer
@@ -1107,21 +1079,21 @@ function source(array $ids = [])
continue; continue;
$triggered = true; $triggered = true;
pushBuffer($buff, TYPE_SPELL, $effects['effect'.$i.'TriggerSpell'], $trainerId ? TYPE_NPC : 0, $trainerId); $this->pushBuffer($buff, TYPE_SPELL, $effects['effect'.$i.'TriggerSpell'], $trainerId ? TYPE_NPC : 0, $trainerId);
} }
if (!$triggered) if (!$triggered)
pushBuffer($buff, TYPE_SPELL, $spellId, $trainerId ? TYPE_NPC : 0, $trainerId); $this->pushBuffer($buff, TYPE_SPELL, $spellId, $trainerId ? TYPE_NPC : 0, $trainerId);
} }
DB::Aowow()->query(queryfy('[V]', $buff, $insMore), 6, 6, 6); DB::Aowow()->query($this->queryfy($buff, $insMore), 6, 6, 6);
} }
# 7: Discovery # 7: Discovery
CLI::write(' * #7 Discovery'); CLI::write(' * #7 Discovery');
// 61756: Northrend Inscription Research (FAST QA VERSION); // 61756: Northrend Inscription Research (FAST QA VERSION);
if ($disco = DB::World()->select('SELECT ?d, spellId, 1 FROM skill_discovery_template WHERE reqSpell <> ?d', TYPE_SPELL, 61756)) if ($disco = DB::World()->select('SELECT ?d, spellId, 1 FROM skill_discovery_template WHERE reqSpell <> ?d', TYPE_SPELL, 61756))
DB::Aowow()->query(queryfy('[V]', $disco, $insBasic), 7, 7, 7); DB::Aowow()->query($this->queryfy($disco, $insBasic), 7, 7, 7);
# 9: Talent # 9: Talent
CLI::write(' * #9 Talent'); CLI::write(' * #9 Talent');
@@ -1158,7 +1130,7 @@ function source(array $ids = [])
$tSpells = DB::Aowow()->select('SELECT id AS ARRAY_KEY, effect1Id, effect2Id, effect3Id, effect1TriggerSpell, effect2TriggerSpell, effect3TriggerSpell FROM dbc_spell WHERE id IN (?a)', array_keys($recurse)); $tSpells = DB::Aowow()->select('SELECT id AS ARRAY_KEY, effect1Id, effect2Id, effect3Id, effect1TriggerSpell, effect2TriggerSpell, effect3TriggerSpell FROM dbc_spell WHERE id IN (?a)', array_keys($recurse));
} }
DB::Aowow()->query(queryfy('[V]', $buff, $insBasic), 9, 9, 9); DB::Aowow()->query($this->queryfy($buff, $insBasic), 9, 9, 9);
# 10: Starter # 10: Starter
CLI::write(' * #10 Starter'); CLI::write(' * #10 Starter');
@@ -1181,7 +1153,7 @@ function source(array $ids = [])
# 4: Quest # 4: Quest
CLI::write(' * #4 Quest'); CLI::write(' * #4 Quest');
if ($quests = DB::World()->select('SELECT ?d, RewardTitle, 1, ?d, ID FROM quest_template WHERE RewardTitle > 0', TYPE_TITLE, TYPE_QUEST)) if ($quests = DB::World()->select('SELECT ?d, RewardTitle, 1, ?d, ID FROM quest_template WHERE RewardTitle > 0', TYPE_TITLE, TYPE_QUEST))
DB::Aowow()->query(queryfy('[V]', $quests, $insMore), 4, 4, 4); DB::Aowow()->query($this->queryfy($quests, $insMore), 4, 4, 4);
# 12: Achievement # 12: Achievement
CLI::write(' * #12 Achievement'); CLI::write(' * #12 Achievement');
@@ -1194,7 +1166,7 @@ function source(array $ids = [])
); );
foreach ($sets as $tId => $set) foreach ($sets as $tId => $set)
{ {
DB::Aowow()->query(queryfy('[V]', [[TYPE_TITLE, $tId, 1, TYPE_ACHIEVEMENT, $set['srcId']]], $insMore), 12, 12, 12); DB::Aowow()->query($this->queryfy([[TYPE_TITLE, $tId, 1, TYPE_ACHIEVEMENT, $set['srcId']]], $insMore), 12, 12, 12);
if ($set['altSrcId']) if ($set['altSrcId'])
DB::Aowow()->query('UPDATE ?_titles SET src12Ext = ?d WHERE id = ?d', $set['altSrcId'], $tId); DB::Aowow()->query('UPDATE ?_titles SET src12Ext = ?d WHERE id = ?d', $set['altSrcId'], $tId);
@@ -1205,9 +1177,10 @@ function source(array $ids = [])
$src13 = [null, 42, 52, 71, 80, 157, 163, 167, 169, 177]; $src13 = [null, 42, 52, 71, 80, 157, 163, 167, 169, 177];
foreach ($src13 as $src => $tId) foreach ($src13 as $src => $tId)
if ($tId) if ($tId)
DB::Aowow()->query(queryfy('[V]', [[TYPE_TITLE, $tId, $src]], $insBasic), 13, 13, 13); DB::Aowow()->query($this->queryfy([[TYPE_TITLE, $tId, $src]], $insBasic), 13, 13, 13);
return true; return true;
} }
});
?> ?>

View File

@@ -7,28 +7,60 @@ 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 to have been used at least once
/* deps: SqlGen::register(new class extends SetupScript
* creature
* creature_addon
* gameobject
* gameobject_template
* vehicle_accessory
* vehicle_accessory_template
* script_waypoint
* waypoints
* waypoint_data
*/
$customData = array(
);
$reqDBC = ['worldmaparea', 'map', 'dungeonmap', 'taxipathnode', 'soundemitters', 'areatrigger'];
function spawns() // and waypoints
{ {
$alphaMapCache = []; protected $command = 'spawns'; // and waypoints
$alphaMapCheck = function ($areaId, array &$set) use (&$alphaMapCache)
protected $tblDependancyTC = ['creature', 'creature_addon', 'gameobject', 'gameobject_template', 'vehicle_accessory', 'vehicle_accessory_template', 'script_waypoint', 'waypoints', 'waypoint_data'];
protected $dbcSourceFiles = ['worldmaparea', 'map', 'dungeonmap', 'taxipathnode', 'soundemitters', 'areatrigger'];
private $querys = array(
1 => ['SELECT c.guid, 1 AS "type", c.id AS typeId, c.spawntimesecs AS respawn, c.phaseMask, c.zoneId AS areaId, c.map, IFNULL(ca.path_id, 0) AS pathId, c.position_y AS `posX`, c.position_x AS `posY` ' .
'FROM creature c LEFT JOIN creature_addon ca ON ca.guid = c.guid',
' - assembling creature spawns'],
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',
' - assembling gameobject spawns'],
3 => ['SELECT id AS "guid", 19 AS "type", soundId AS typeId, 0 AS respawn, 0 AS phaseMask, 0 AS areaId, mapId AS "map", 0 AS pathId, posX, posY ' .
'FROM dbc_soundemitters',
' - assembling sound emitter spawns'],
4 => ['SELECT id AS "guid", 503 AS "type", id AS typeId, 0 AS respawn, 0 AS phaseMask, 0 AS areaId, mapId AS "map", 0 AS pathId, posX, posY ' .
'FROM dbc_areatrigger',
' - assembling areatrigger spawns'],
5 => ['SELECT c.guid, w.entry AS "npcOrPath", w.pointId AS "point", c.zoneId AS areaId, c.map, w.waittime AS "wait", w.location_y AS `posX`, w.location_x AS `posY` ' .
'FROM creature c JOIN script_waypoint w ON c.id = w.entry',
' - assembling waypoints from table script_waypoint'],
6 => ['SELECT c.guid, w.entry AS "npcOrPath", w.pointId AS "point", c.zoneId AS areaId, c.map, 0 AS "wait", w.position_y AS `posX`, w.position_x AS `posY` ' .
'FROM creature c JOIN waypoints w ON c.id = w.entry',
' - assembling waypoints from table waypoints'],
7 => ['SELECT c.guid, -w.id AS "npcOrPath", w.point, c.zoneId AS areaId, c.map, w.delay AS "wait", w.position_y AS `posX`, w.position_x AS `posY` ' .
'FROM creature c JOIN creature_addon ca ON ca.guid = c.guid JOIN waypoint_data w ON w.id = ca.path_id WHERE ca.path_id <> 0',
' - assembling waypoints from table waypoint_data']
);
private $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.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.minX) * 100 / (dm.maxX - dm.minX), (?f - wma.bottom) * 100 / (wma.top - wma.bottom)) - 50) / 50)) AS quality ' .
'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) ' .
'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) ' .
'ORDER BY quality ASC';
private $alphaMapCache = [];
private function alphaMapCheck(int $areaId, array &$set) : bool
{ {
$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)
@@ -41,17 +73,17 @@ function spawns() // and waypoints
return true; return true;
} }
if (empty($alphaMapCache[$areaId])) if (empty($this->alphaMapCache[$areaId]))
$alphaMapCache[$areaId] = imagecreatefrompng($file); $this->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($this->alphaMapCache[$areaId], $set['posX'] * 10, $set['posY'] * 10))
$set = null; $set = null;
return true; return true;
}; }
$checkCoords = function ($points) use($alphaMapCheck) private function checkCoords(array $points) : array
{ {
$result = []; $result = [];
$capitals = array( // capitals take precedence over their surroundings $capitals = array( // capitals take precedence over their surroundings
@@ -62,7 +94,7 @@ function spawns() // and waypoints
foreach ($points as $res) foreach ($points as $res)
{ {
if ($alphaMapCheck($res['areaId'], $res)) if ($this->alphaMapCheck($res['areaId'], $res))
{ {
if (!$res) if (!$res)
continue; continue;
@@ -88,48 +120,10 @@ function spawns() // and waypoints
} }
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` ' .
'FROM creature c LEFT JOIN creature_addon ca ON ca.guid = c.guid',
' - assembling '.CLI::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` ' .
'FROM gameobject c',
' - assembling '.CLI::bold('gameobject').' spawns'];
$query[3] = ['SELECT id AS "guid", 19 AS "type", soundId AS typeId, 0 AS respawn, 0 AS phaseMask, 0 AS areaId, mapId AS "map", 0 AS pathId, posX, posY ' .
'FROM dbc_soundemitters',
' - assembling '.CLI::bold('sound emitter').' spawns'];
$query[4] = ['SELECT id AS "guid", 503 AS "type", id AS typeId, 0 AS respawn, 0 AS phaseMask, 0 AS areaId, mapId AS "map", 0 AS pathId, posX, posY ' .
'FROM dbc_areatrigger',
' - assembling '.CLI::bold('areatrigger').' spawns'];
$query[5] = ['SELECT c.guid, w.entry AS "npcOrPath", w.pointId AS "point", c.zoneId AS areaId, c.map, w.waittime AS "wait", w.location_y AS `posX`, w.location_x AS `posY` ' .
'FROM creature c JOIN script_waypoint w ON c.id = w.entry',
' - assembling waypoints from '.CLI::bold('script_waypoint')];
$query[6] = ['SELECT c.guid, w.entry AS "npcOrPath", w.pointId AS "point", c.zoneId AS areaId, c.map, 0 AS "wait", w.position_y AS `posX`, w.position_x AS `posY` ' .
'FROM creature c JOIN waypoints w ON c.id = w.entry',
' - assembling waypoints from '.CLI::bold('waypoints')];
$query[7] = ['SELECT c.guid, -w.id AS "npcOrPath", w.point, c.zoneId AS areaId, c.map, w.delay AS "wait", w.position_y AS `posX`, w.position_x AS `posY` ' .
'FROM creature c JOIN creature_addon ca ON ca.guid = c.guid JOIN waypoint_data w ON w.id = ca.path_id WHERE ca.path_id <> 0',
' - assembling waypoints from '.CLI::bold('waypoint_data')];
$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.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.minX) * 100 / (dm.maxX - dm.minX), (?f - wma.bottom) * 100 / (wma.top - wma.bottom)) - 50) / 50)) AS quality ' .
'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) ' .
'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) ' .
'ORDER BY quality ASC';
public function generate(array $ids = []) : bool
{
/*********************/ /*********************/
/* truncate old data */ /* truncate old data */
/*********************/ /*********************/
@@ -151,7 +145,7 @@ function spawns() // and waypoints
/* perform... */ /* perform... */
/**************/ /**************/
foreach ($query as $idx => $q) foreach ($this->querys as $idx => $q)
{ {
CLI::write($q[1]); CLI::write($q[1]);
@@ -166,9 +160,9 @@ function spawns() // and waypoints
foreach ($queryResult as $spawn) foreach ($queryResult as $spawn)
{ {
if (!$n) if (!$n)
CLI::write(' * sets '.($sum + 1).' - '.($sum += SqlGen::$stepSize)); CLI::write(' * sets '.($sum + 1).' - '.($sum += SqlGen::$sqlBatchSize));
if ($n++ > SqlGen::$stepSize) if ($n++ > SqlGen::$sqlBatchSize)
$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
@@ -181,9 +175,9 @@ function spawns() // and waypoints
$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($this->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($this->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))
{ {
@@ -281,5 +275,6 @@ function spawns() // and waypoints
return true; return true;
} }
});
?> ?>

View File

@@ -7,36 +7,15 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps: SqlGen::register(new class extends SetupScript
* item_template {
* creature_template protected $command = 'spell';
* creature_template_addon
* smart_scripts
* npc_trainer
* disables
* spell_ranks
* spell_dbc
* skill_discovery_template
*/
$customData = array( protected $tblDependancyAowow = ['icons'];
); protected $tblDependancyTC = ['item_template', 'creature_template', 'creature_template_addon', 'smart_scripts', 'npc_trainer', 'disables', 'spell_ranks', 'spell_dbc', 'skill_discovery_template'];
$reqDBC = [ protected $dbcSourceFiles = ['spell', 'spellradius', 'spellduration', 'spellrunecost', 'spellcasttimes', 'skillline', 'skilllineability', 'skillraceclassinfo', 'talent', 'talenttab', 'glyphproperties', 'spellicon'];
'spell',
'spellradius',
'spellduration',
'spellrunecost',
'spellcasttimes',
'skillline',
'skilllineability',
'skillraceclassinfo',
'talent',
'talenttab',
'glyphproperties',
'spellicon'
];
function spell() public function generate(array $ids = []) : bool
{ {
$ssQuery = ' $ssQuery = '
SELECT SELECT
@@ -225,7 +204,7 @@ function spell()
// merge serverside spells into dbc_spell (should not affect other scripts) // merge serverside spells into dbc_spell (should not affect other scripts)
$lastMax = 0; $lastMax = 0;
CLI::write(' - merging serverside spells into spell.dbc'); CLI::write(' - merging serverside spells into spell.dbc');
while ($spells = DB::World()->select($ssQuery, $lastMax, SqlGen::$stepSize)) while ($spells = DB::World()->select($ssQuery, $lastMax, SqlGen::$sqlBatchSize))
{ {
$newMax = max(array_column($spells, 'id')); $newMax = max(array_column($spells, 'id'));
@@ -243,7 +222,7 @@ function spell()
// merge everything into aowow_spell // merge everything into aowow_spell
$lastMax = 0; $lastMax = 0;
CLI::write(' - filling aowow_spell'); CLI::write(' - filling aowow_spell');
while ($spells = DB::Aowow()->select($baseQuery, $lastMax, SqlGen::$stepSize)) while ($spells = DB::Aowow()->select($baseQuery, $lastMax, SqlGen::$sqlBatchSize))
{ {
$newMax = max(array_column($spells, 'id')); $newMax = max(array_column($spells, 'id'));
@@ -772,5 +751,6 @@ function spell()
return true; return true;
} }
});
?> ?>

View File

@@ -7,15 +7,14 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps: SqlGen::register(new class extends SetupScript
* spelldifficulty_dbc {
*/ protected $command = 'spelldifficulty';
$customData = array( protected $tblDependancyTC = ['spelldifficulty_dbc'];
); protected $dbcSourceFiles = ['spelldifficulty'];
$reqDBC = ['spelldifficulty'];
function spelldifficulty(array $ids = []) public function generate(array $ids = []) : bool
{ {
// has no unique keys.. // has no unique keys..
DB::Aowow()->query('TRUNCATE TABLE ?_spelldifficulty'); DB::Aowow()->query('TRUNCATE TABLE ?_spelldifficulty');
@@ -28,5 +27,6 @@ function spelldifficulty(array $ids = [])
return true; return true;
} }
});
?> ?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'spellfocusobject';
protected $dbcSourceFiles = ['spellfocusobject'];
});
?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'spelloverride';
protected $dbcSourceFiles = ['overridespelldata'];
});
?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'spellrange';
protected $dbcSourceFiles = ['spellrange'];
});
?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'spellvariables';
protected $dbcSourceFiles = ['spelldescriptionvariables'];
});
?>

View File

@@ -7,11 +7,13 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
$customData = array( SqlGen::register(new class extends SetupScript
); {
$reqDBC = ['talent', 'talenttab']; protected $command = 'talents';
function talents() protected $dbcSourceFiles = ['talent', 'talenttab'];
public function generate(array $ids = []) : bool
{ {
// class: 0 => hunter pets // class: 0 => hunter pets
for ($i = 1; $i < 6; $i++) for ($i = 1; $i < 6; $i++)
@@ -37,5 +39,6 @@ function talents()
return true; return true;
} }
});
?> ?>

View File

@@ -7,16 +7,14 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps SqlGen::register(new class extends SetupScript
* creature_template {
* creature protected $command = 'taxi'; // path & nodes
*/
$customData = array( protected $tblDependancyTC = ['creature', 'creature_template'];
); protected $dbcSourceFiles = ['taxipath', 'taxinodes', 'worldmaparea', 'worldmaptransforms', 'factiontemplate'];
$reqDBC = ['taxipath', 'taxinodes', 'worldmaparea', 'worldmaptransforms', 'factiontemplate'];
function taxi() // path & nodes public function generate(array $ids = []) : bool
{ {
/*********/ /*********/
/* paths */ /* paths */
@@ -172,5 +170,6 @@ function taxi() // path & nodes
return true; return true;
} }
});
?> ?>

View File

@@ -6,22 +6,22 @@ if (!defined('AOWOW_REVISION'))
if (!CLI) if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps:
* quest_template
* game_event_seasonal_questrelation
* game_event
* achievement_reward
*/
$customData = array( SqlGen::register(new class extends SetupScript
137 => ['gender' => 2],
138 => ['gender' => 1],
);
$reqDBC = ['chartitles'];
function titles()
{ {
$titleHoliday = array( use TrCustomData;
protected $command = 'titles';
protected $tblDependancyTC = ['quest_template', 'game_event_seasonal_questrelation', 'game_event', 'achievement_reward'];
protected $dbcSourceFiles = ['chartitles'];
private $customData = array(
137 => ['gender' => 2],
138 => ['gender' => 1]
);
private $titleHoliday = array(
137 => 201, 137 => 201,
138 => 201, 138 => 201,
124 => 324, 124 => 324,
@@ -35,6 +35,8 @@ function titles()
168 => 404 168 => 404
); );
public function generate(array $ids = []) : bool
{
$questQuery = ' $questQuery = '
SELECT SELECT
qt.RewardTitle AS ARRAY_KEY, qt.RewardTitle AS ARRAY_KEY,
@@ -67,8 +69,8 @@ function titles()
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($this->titleHoliday)))
foreach ($titleHoliday as $tId => $hId) foreach ($this->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);
@@ -99,5 +101,6 @@ function titles()
return true; return true;
} }
});
?> ?>

View File

@@ -0,0 +1,18 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'totemcategory';
protected $dbcSourceFiles = ['totemcategory'];
});
?>

View File

@@ -7,18 +7,23 @@ if (!CLI)
die('not in cli mode'); die('not in cli mode');
/* deps SqlGen::register(new class extends SetupScript
* access_requirement {
*/ use TrCustomData;
$customData = array( protected $command = 'zones';
protected $tblDependancyTC = ['access_requirement'];
protected $dbcSourceFiles = ['worldmaptransforms', 'worldmaparea', 'map', 'mapdifficulty', 'areatable', 'lfgdungeons', 'battlemasterlist'];
private $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 ... dafuq?
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],
@@ -26,9 +31,8 @@ $customData = array(
3848 => ['parentAreaId' => 3523, 'parentX' => 74.3, 'parentY' => 57.8], 3848 => ['parentAreaId' => 3523, 'parentX' => 74.3, 'parentY' => 57.8],
3845 => ['parentAreaId' => 3523, 'parentX' => 73.5, 'parentY' => 63.7] 3845 => ['parentAreaId' => 3523, 'parentX' => 73.5, 'parentY' => 63.7]
); );
$reqDBC = ['worldmaptransforms', 'worldmaparea', 'map', 'mapdifficulty', 'areatable', 'lfgdungeons', 'battlemasterlist'];
function zones() public function generate(array $ids = []) : bool
{ {
// base query // base query
DB::Aowow()->query(' DB::Aowow()->query('
@@ -229,5 +233,6 @@ function zones()
return true; return true;
} }
});
?> ?>