aowow/setup/tools/filegen/realms.ss.php
Sarjuuk bf184e7555 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!
2024-06-20 18:10:12 +02:00

56 lines
1.4 KiB
PHP

<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
/* seems to be unused, was located in the same file as g_realms
var g_regions = {
us => 'www.wowarmory.com',
eu => 'eu.wowarmory.com'
};
*/
/* Examples
1 => {
name:'Eldre\'Thalas',
battlegroup:'Reckoning',
region:'us'
},
*/
CLISetup::registerSetup("build", new class extends SetupScript
{
protected $info = array(
'realms' => [[], CLISetup::ARGV_PARAM, 'Generates \'realms\'-file to be referenced by the profiler tool.']
);
protected $worldDependency = ['realmlist'];
protected $requiredDirs = ['datasets/'];
public function generate() : bool
{
$realms = [];
if (!DB::isConnectable(DB_AUTH))
CLI::write('[realms] Auth DB not set up .. static data g_realms will be empty', CLI::LOG_WARN);
else if (!($realms = Profiler::getRealms()))
CLI::write('[realms] no viable realms found .. static data g_realms will be empty', CLI::LOG_WARN);
// else
// foreach ($realms as &$r)
// $r['battlegroup'] = Cfg::get('BATTLEGROUP');
// remove access column
array_walk($realms, function (&$x) { unset($x['access']); });
$toFile = "var g_realms = ".Util::toJSON($realms).";";
$file = 'datasets/realms';
return CLISetup::writeFile($file, $toFile);
}
});
?>