Core/Setup

* rewritten to be able to dynamicly load it's components
   - CLISetup -> checks for UtilityScripts (config, setup, dbc reader, etc.) -> checks for SetupScripts (individual sql/file generators)
   - each step may now have a help prompt attached. If none are provided, the containing script may provide it's help.
   - all Scripts are self contained modules. No more editing of 3+ files if some component is added/removed
 * removed intermediaries FileGen & SqlGen
 * functional changes
   - allow providing CLI arguments to siteconfig and account UtilityScript and skip the interactive prompts
   - set slot for consumable enchantment items so they are filtrable
   - zones dataset is now localized and generated from GlobalStrings.lua and DungeonMap.dbc. Related data dumps removed.
   - 'aowow' and 'prQueue' executables now have shebangs

    WARNING - command line options have been renamed!
This commit is contained in:
Sarjuuk
2024-06-20 16:32:20 +02:00
parent ab4cf67e80
commit bf184e7555
149 changed files with 9642 additions and 9191 deletions

View File

@@ -7,59 +7,25 @@ if (!CLI)
die('not in cli mode');
require_once 'setup/tools/CLISetup.class.php';
require_once 'setup/tools/setupScript.class.php';
require_once 'setup/tools/utilityScript.class.php';
require_once 'setup/tools/CLISetup.class.php';
require_once 'setup/tools/dbc.class.php';
require_once 'setup/tools/imagecreatefromblp.func.php';
function finish() : void
{
if (CLISetup::getOpt('delete')) // generated with TEMPORARY keyword. Manual deletion is not needed
CLI::write('generated dbc_* - tables have been deleted.', CLI::LOG_INFO);
die("\n");
}
CLISetup::init();
CLISetup::loadScripts();
if (!CLISetup::getOpt(0x3))
die(CLISetup::optHelp(0x7));
if (CLISetup::getOpt('help'))
die(CLISetup::writeCLIHelp(true));
else if (!CLISetup::getOpt(1 << CLISetup::OPT_GRP_SETUP | 1 << CLISetup::OPT_GRP_UTIL))
die(CLISetup::writeCLIHelp());
$cmd = CLISetup::getOpt(0x3)[0]; // get arguments present in argGroup 1 or 2, if set. Pick first.
$s = [];
$b = [];
switch ($cmd) // we accept only one main parameter
{
case 'setup':
case 'sql':
case 'build':
case 'account':
case 'dbconfig':
case 'siteconfig':
require_once 'setup/tools/clisetup/'.$cmd.'.func.php';
$cmd();
finish();
case 'update':
require_once 'setup/tools/clisetup/update.func.php';
if (CLISetup::getOpt('delete')) // generated with TEMPORARY keyword. Manual deletion is not needed
CLI::write('generated dbc_* - tables have been deleted.', CLI::LOG_INFO);
update($s, $b); // return true if we do not rebuild stuff
if (!$s && !$b)
finish();
case 'sync':
require_once 'setup/tools/clisetup/sync.func.php';
CLISetup::runInitial();
sync($s, $b);
finish();
case 'dbc':
require_once 'setup/tools/clisetup/dbc.func.php';
$args = [];
foreach ($argv as $i => $str)
if ($i && $str[0] != '-')
$args[] = $str;
dbc($args);
break;
}
die("\n");
?>