• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CLISetup类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CLISetup的典型用法代码示例。如果您正苦于以下问题:PHP CLISetup类的具体用法?PHP CLISetup怎么用?PHP CLISetup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CLISetup类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: sql

function sql($syncMe = null)
{
    require_once 'setup/tools/sqlGen.class.php';
    SqlGen::init($syncMe !== null ? SqlGen::MODE_UPDATE : SqlGen::MODE_NORMAL, $syncMe ?: []);
    $done = [];
    if (SqlGen::$subScripts) {
        $allOk = true;
        // start file generation
        CLISetup::log('begin generation of ' . implode(', ', SqlGen::$subScripts));
        CLISetup::log();
        foreach (SqlGen::$subScripts as $tbl) {
            $syncIds = [];
            // todo: fetch what exactly must be regenerated
            $ok = SqlGen::generate($tbl, $syncIds);
            if (!$ok) {
                $allOk = false;
            } else {
                $done[] = $tbl;
            }
            CLISetup::log(' - subscript \'' . $tbl . '\' returned ' . ($ok ? 'sucessfully' : 'with errors'), $ok ? CLISetup::LOG_OK : CLISetup::LOG_ERROR);
            set_time_limit(SqlGen::$defaultExecTime);
            // reset to default for the next script
        }
        // end
        CLISetup::log();
        if ($allOk) {
            CLISetup::log('successfully finished sql generation', CLISetup::LOG_OK);
        } else {
            CLISetup::log('finished sql generation with errors', CLISetup::LOG_ERROR);
        }
    } else {
        CLISetup::log('no valid script names supplied', CLISetup::LOG_ERROR);
    }
    return $done;
}
开发者ID:saqar,项目名称:aowow,代码行数:35,代码来源:sql.func.php


示例2: realmMenu

function realmMenu()
{
    $subEU = [];
    $subUS = [];
    $set = 0x0;
    $menu = [['us', 'US & Oceanic', null, [[Util::urlize(CFG_BATTLEGROUP), CFG_BATTLEGROUP, null, &$subUS]]], ['eu', 'Europe', null, [[Util::urlize(CFG_BATTLEGROUP), CFG_BATTLEGROUP, null, &$subEU]]]];
    foreach (Util::getRealms() as $row) {
        if ($row['region'] == 'eu') {
            $set |= 0x1;
            $subEU[] = [Util::urlize($row['name']), $row['name']];
        } else {
            if ($row['region'] == 'us') {
                $set |= 0x2;
                $subUS[] = [Util::urlize($row['name']), $row['name']];
            }
        }
    }
    if (!$set) {
        CLISetup::log(' - realmMenu: Auth-DB not set up .. menu will be empty', CLISetup::LOG_WARN);
    }
    if (!($set & 0x1)) {
        array_pop($menu);
    }
    if (!($set & 0x2)) {
        array_shift($menu);
    }
    return Util::toJSON($menu);
}
开发者ID:saqar,项目名称:aowow,代码行数:28,代码来源:realmMenu.func.php


示例3: realmMenu

function realmMenu()
{
    $subEU = [];
    $subUS = [];
    $set = 0x0;
    $menu = [['us', 'US & Oceanic', null, [[Util::urlize(CFG_BATTLEGROUP), CFG_BATTLEGROUP, null, &$subEU]]], ['eu', 'Europe', null, [[Util::urlize(CFG_BATTLEGROUP), CFG_BATTLEGROUP, null, &$subUS]]]];
    if (DB::isConnectable(DB_AUTH)) {
        $rows = DB::Auth()->select('SELECT name, IF(timezone IN (8, 9, 10, 11, 12), "eu", "us") AS region FROM realmlist WHERE allowedSecurityLevel = 0 AND gamebuild = ?d', WOW_VERSION);
        foreach ($rows as $row) {
            if ($row['region'] == 'eu') {
                $set |= 0x1;
                $subEU[] = [Util::urlize($row['name']), $row['name']];
            } else {
                if ($row['region'] == 'us') {
                    $set |= 0x2;
                    $subUS[] = [Util::urlize($row['name']), $row['name']];
                }
            }
        }
    } else {
        CLISetup::log(' - realmMenu: Auth-DB not set up .. menu will be empty', CLISetup::LOG_WARN);
    }
    if (!($set & 0x1)) {
        array_shift($menu);
    }
    if (!($set & 0x2)) {
        array_pop($menu);
    }
    return Util::toJSON($menu);
}
开发者ID:Carbenium,项目名称:aowow,代码行数:30,代码来源:realmMenu.func.php


示例4: build

function build()
{
    require_once 'setup/tools/fileGen.class.php';
    FileGen::init();
    if (FileGen::$subScripts) {
        $allOk = true;
        // start file generation
        CLISetup::log('begin generation of ' . implode(', ', FileGen::$subScripts));
        CLISetup::log();
        // files with template
        foreach (FileGen::$tplFiles as $name => list($file, $destPath, $deps)) {
            $reqDBC = [];
            if (!in_array($name, FileGen::$subScripts)) {
                continue;
            }
            if (!file_exists(FileGen::$tplPath . $file . '.in')) {
                CLISetup::log(sprintf(ERR_MISSING_FILE, FileGen::$tplPath . $file . '.in'), CLISetup::LOG_ERROR);
                $allOk = false;
                continue;
            }
            if (!CLISetup::writeDir($destPath)) {
                continue;
            }
            $syncIds = [];
            // todo: fetch what exactly must be regenerated
            $ok = FileGen::generate($name, $syncIds);
            if (!$ok) {
                $allOk = false;
            }
            CLISetup::log(' - subscript \'' . $file . '\' returned ' . ($ok ? 'sucessfully' : 'with errors'), $ok ? CLISetup::LOG_OK : CLISetup::LOG_ERROR);
            set_time_limit(FileGen::$defaultExecTime);
            // reset to default for the next script
        }
        // files without template
        foreach (FileGen::$datasets as $file => $deps) {
            if (!in_array($file, FileGen::$subScripts)) {
                continue;
            }
            $syncIds = [];
            // todo: fetch what exactly must be regenerated
            $ok = FileGen::generate($file, $syncIds);
            if (!$ok) {
                $allOk = false;
            }
            CLISetup::log(' - subscript \'' . $file . '\' returned ' . ($ok ? 'sucessfully' : 'with errors'), $ok ? CLISetup::LOG_OK : CLISetup::LOG_ERROR);
            set_time_limit(FileGen::$defaultExecTime);
            // reset to default for the next script
        }
        // end
        CLISetup::log();
        if ($allOk) {
            CLISetup::log('successfully finished file generation', CLISetup::LOG_OK);
        } else {
            CLISetup::log('finished file generation with errors', CLISetup::LOG_ERROR);
        }
    } else {
        CLISetup::log('no valid script names supplied', CLISetup::LOG_ERROR);
    }
}
开发者ID:Carbenium,项目名称:aowow,代码行数:59,代码来源:build.func.php


示例5: finish

function finish()
{
    if (!getopt('d', ['delete'])) {
        // generated with TEMPORARY keyword. Manual deletion is not needed
        CLISetup::log('generated dbc_* - tables kept available', CLISetup::LOG_INFO);
    }
    die("\n");
}
开发者ID:saqar,项目名称:aowow,代码行数:8,代码来源:setup.php


示例6: realms

function realms()
{
    $realms = [];
    if (DB::isConnectable(DB_AUTH)) {
        $realms = DB::Auth()->select('SELECT id AS ARRAY_KEY, name, ? AS battlegroup, IF(timezone IN (8, 9, 10, 11, 12), "eu", "us") AS region FROM realmlist WHERE allowedSecurityLevel = 0 AND gamebuild = ?d', CFG_BATTLEGROUP, WOW_VERSION);
    } else {
        CLISetup::log(' - realms: Auth-DB not set up .. static data g_realms will be empty', CLISetup::LOG_WARN);
    }
    $toFile = "var g_realms = " . Util::toJSON($realms) . ";";
    $file = 'datasets/realms';
    return CLISetup::writeFile($file, $toFile);
}
开发者ID:Carbenium,项目名称:aowow,代码行数:12,代码来源:realms.func.php


示例7: gems

function gems()
{
    // sketchy, but should work
    // Id < 36'000 || ilevel < 70 ? BC : WOTLK
    $gems = DB::Aowow()->Select('SELECT    i.id AS itemId,
                      i.name_loc0, i.name_loc2, i.name_loc3, i.name_loc4, i.name_loc6, i.name_loc8,
                      IF (i.id < 36000 OR i.itemLevel < 70, 1 , 2) AS expansion,
                      i.quality,
                      ic.iconString AS icon,
                      i.gemEnchantmentId AS enchId,
                      i.gemColorMask AS colors
            FROM      ?_items i
            JOIN      ?_icons ic ON ic.id = -i.displayId
            WHERE     i.gemEnchantmentId <> 0
            ORDER BY  i.id DESC');
    $success = true;
    // check directory-structure
    foreach (Util::$localeStrings as $dir) {
        if (!CLISetup::writeDir('datasets/' . $dir)) {
            $success = false;
        }
    }
    $enchIds = [];
    foreach ($gems as $pop) {
        $enchIds[] = $pop['enchId'];
    }
    $enchantments = new EnchantmentList(array(['id', $enchIds], CFG_SQL_LIMIT_NONE));
    if ($enchantments->error) {
        CLISetup::log('Required table ?_itemenchantment seems to be empty! Leaving gems()...', CLISetup::LOG_ERROR);
        CLISetup::log();
        return false;
    }
    foreach (CLISetup::$localeIds as $lId) {
        set_time_limit(5);
        User::useLocale($lId);
        Lang::load(Util::$localeStrings[$lId]);
        $gemsOut = [];
        foreach ($gems as $pop) {
            if (!$enchantments->getEntry($pop['enchId'])) {
                CLISetup::log(' * could not find enchantment #' . $pop['enchId'] . ' referenced by item #' . $gem['itemId'], CLISetup::LOG_WARN);
                continue;
            }
            $gemsOut[$pop['itemId']] = array('name' => Util::localizedString($pop, 'name'), 'quality' => $pop['quality'], 'icon' => strToLower($pop['icon']), 'enchantment' => $enchantments->getField('name', true), 'jsonequip' => $enchantments->getStatGain(), 'colors' => $pop['colors'], 'expansion' => $pop['expansion']);
        }
        $toFile = "var g_gems = " . Util::toJSON($gemsOut) . ";";
        $file = 'datasets/' . User::$localeString . '/gems';
        if (!CLISetup::writeFile($file, $toFile)) {
            $success = false;
        }
    }
    return $success;
}
开发者ID:qyh214,项目名称:aowow,代码行数:52,代码来源:gems.func.php


示例8: realms

function realms()
{
    $realms = Util::getRealms();
    if (!$realms) {
        CLISetup::log(' - realms: Auth-DB not set up .. static data g_realms will be empty', CLISetup::LOG_WARN);
    } else {
        foreach ($realms as &$r) {
            $r['battlegroup'] = CFG_BATTLEGROUP;
        }
    }
    $toFile = "var g_realms = " . Util::toJSON($realms) . ";";
    $file = 'datasets/realms';
    return CLISetup::writeFile($file, $toFile);
}
开发者ID:saqar,项目名称:aowow,代码行数:14,代码来源:realms.func.php


示例9: finish

function finish()
{
    if (!getopt('d', ['delete'])) {
        // generated with TEMPORARY keyword. Manual deletion is not needed
        CLISetup::log('generated dbc_* - tables kept available', CLISetup::LOG_INFO);
    }
    // send "i'm in use @" - ping
    $u = !empty($_SERVER['USER']) ? $_SERVER['USER'] : 'NULL';
    $s = !empty($_SERVER['SSH_CONNECTION']) ? explode(' ', $_SERVER['SSH_CONNECTION'])[2] : 'NULL';
    if ($h = @fopen('http://aowow.meedns.com/ref?u=' . $u . '&s=' . $s, 'r')) {
        fclose($h);
    }
    die("\n");
}
开发者ID:Niknox,项目名称:aowow,代码行数:14,代码来源:setup.php


示例10: update

function update()
{
    list($date, $part) = array_values(DB::Aowow()->selectRow('SELECT `date`, `part` FROM ?_dbversion'));
    CLISetup::log('checking sql updates');
    $nFiles = 0;
    foreach (glob('setup/updates/*.sql') as $file) {
        $pi = pathinfo($file);
        list($fDate, $fPart) = explode('_', $pi['filename']);
        if ($date && $fDate < $date) {
            continue;
        } else {
            if ($part && $date && $fDate == $date && $fPart <= $part) {
                continue;
            }
        }
        $nFiles++;
        $updQuery = '';
        $nQuerys = 0;
        foreach (file($file) as $line) {
            // skip comments
            if (substr($line, 0, 2) == '--' || $line == '') {
                continue;
            }
            $updQuery .= $line;
            // semicolon at the end -> end of query
            if (substr(trim($line), -1, 1) == ';') {
                if (DB::Aowow()->query($updQuery)) {
                    $nQuerys++;
                }
                $updQuery = '';
            }
        }
        DB::Aowow()->query('UPDATE ?_dbversion SET `date`= ?d, `part` = ?d', $fDate, $fPart);
        CLISetup::log(' -> ' . date('d.m.Y', $fDate) . ' #' . $fPart . ': ' . $nQuerys . ' queries applied', CLISetup::LOG_OK);
    }
    CLISetup::log($nFiles ? 'applied ' . $nFiles . ' update(s)' : 'db is already up to date', CLISetup::LOG_OK);
    // fetch sql/build after applying updates, as they may contain sync-prompts
    list($sql, $build) = array_values(DB::Aowow()->selectRow('SELECT `sql`, `build` FROM ?_dbversion'));
    sleep(1);
    $sql = trim($sql) ? array_unique(explode(' ', trim($sql))) : [];
    $build = trim($build) ? array_unique(explode(' ', trim($build))) : [];
    if ($sql) {
        CLISetup::log('The following table(s) require syncing: ' . implode(', ', $sql));
    }
    if ($build) {
        CLISetup::log('The following file(s) require syncing: ' . implode(', ', $build));
    }
    return [$sql, $build];
}
开发者ID:dobrMAN,项目名称:aowow,代码行数:49,代码来源:update.func.php


示例11: glyphs

function glyphs()
{
    $success = true;
    $glyphList = DB::Aowow()->Select('SELECT i.id AS itemId,
                   i.*,
                   IF (g.typeFlags & 0x1, 2, 1) AS type,
                   i.subclass AS classs,
                   i.requiredLevel AS level,
                   s1.Id AS glyphSpell,
                   ic.iconString AS icon,
                   s1.skillLine1 AS skillId,
                   s2.Id AS glyphEffect,
                   s2.Id AS ARRAY_KEY
            FROM   ?_items i
            JOIN   ?_spell s1 ON s1.Id = i.spellid1
            JOIN   ?_glyphproperties g ON g.Id = s1.effect1MiscValue
            JOIN   ?_spell s2 ON s2.Id = g.spellId
            JOIN   ?_icons ic ON ic.Id = s1.iconIdAlt
            WHERE  i.classBak = 16');
    // check directory-structure
    foreach (Util::$localeStrings as $dir) {
        if (!CLISetup::writeDir('datasets/' . $dir)) {
            $success = false;
        }
    }
    $glyphSpells = new SpellList(array(['s.id', array_keys($glyphList)], CFG_SQL_LIMIT_NONE));
    foreach (CLISetup::$localeIds as $lId) {
        set_time_limit(30);
        User::useLocale($lId);
        Lang::load(Util::$localeStrings[$lId]);
        $glyphsOut = [];
        foreach ($glyphSpells->iterate() as $__) {
            $pop = $glyphList[$glyphSpells->id];
            if (!$pop['glyphEffect']) {
                continue;
            }
            if ($glyphSpells->getField('effect1Id') != 6 && $glyphSpells->getField('effect2Id') != 6 && $glyphSpells->getField('effect3Id') != 6) {
                continue;
            }
            $glyphsOut[$pop['itemId']] = array('name' => Util::localizedString($pop, 'name'), 'description' => $glyphSpells->parseText()[0], 'icon' => $pop['icon'], 'type' => $pop['type'], 'classs' => $pop['classs'], 'skill' => $pop['skillId'], 'level' => $pop['level']);
        }
        $toFile = "var g_glyphs = " . Util::toJSON($glyphsOut) . ";";
        $file = 'datasets/' . User::$localeString . '/glyphs';
        if (!CLISetup::writeFile($file, $toFile)) {
            $success = false;
        }
    }
    return $success;
}
开发者ID:saqar,项目名称:aowow,代码行数:49,代码来源:glyphs.func.php


示例12: pets

function pets()
{
    $success = true;
    $locations = [];
    $petList = DB::Aowow()->Select('SELECT    cr. id,
                      cr.name_loc0, cr.name_loc2, cr.name_loc3, cr.name_loc6, cr.name_loc8,
                      cr.minLevel,
                      cr.maxLevel,
                      ft.A,
                      ft.H,
                      cr.rank AS classification,
                      cr.family,
                      cr.displayId1 AS displayId,
                      cr.textureString AS skin,
                      LOWER(SUBSTRING_INDEX(cf.iconString, "\\\\", -1)) AS icon,
                      cf.petTalentType AS type
            FROM      ?_creature cr
            JOIN      ?_factiontemplate  ft ON ft.Id = cr.faction
            JOIN      dbc_creaturefamily cf ON cf.id = cr.family
            WHERE     cr.typeFlags & 0x1 AND (cr.cuFlags & 0x2) = 0
            ORDER BY  cr.id ASC');
    // check directory-structure
    foreach (Util::$localeStrings as $dir) {
        if (!CLISetup::writeDir('datasets/' . $dir)) {
            $success = false;
        }
    }
    foreach (CLISetup::$localeIds as $lId) {
        User::useLocale($lId);
        Lang::load(Util::$localeStrings[$lId]);
        $petsOut = [];
        foreach ($petList as $pet) {
            // get locations
            // again: caching will save you time and nerves
            if (!isset($locations[$pet['id']])) {
                $locations[$pet['id']] = DB::Aowow()->SelectCol('SELECT DISTINCT areaId FROM ?_spawns WHERE type = ?d AND typeId = ?d', TYPE_NPC, $pet['id']);
            }
            $petsOut[$pet['id']] = array('id' => $pet['id'], 'name' => Util::localizedString($pet, 'name'), 'minlevel' => $pet['minLevel'], 'maxlevel' => $pet['maxLevel'], 'location' => $locations[$pet['id']], 'react' => [$pet['A'], $pet['H']], 'classification' => $pet['classification'], 'family' => $pet['family'], 'displayId' => $pet['displayId'], 'skin' => $pet['skin'], 'icon' => $pet['icon'], 'type' => $pet['type']);
        }
        $toFile = "var g_pets = " . Util::toJSON($petsOut) . ";";
        $file = 'datasets/' . User::$localeString . '/pets';
        if (!CLISetup::writeFile($file, $toFile)) {
            $success = false;
        }
    }
    return $success;
}
开发者ID:Niknox,项目名称:aowow,代码行数:47,代码来源:pets.func.php


示例13: gems

function gems()
{
    // sketchy, but should work
    // Id < 36'000 || ilevel < 70 ? BC : WOTLK
    $gems = DB::Aowow()->Select('SELECT    i.id AS itemId,
                      i.name_loc0, i.name_loc2, i.name_loc3, i.name_loc6, i.name_loc8,
                      IF (i.id < 36000 OR i.itemLevel < 70, 1 , 2) AS expansion,
                      i.quality,
                      ic.iconString AS icon,
                      i.gemEnchantmentId AS enchId,
                      i.gemColorMask AS colors
            FROM      ?_items i
            JOIN      ?_icons ic ON ic.id = -i.displayId
            WHERE     i.gemEnchantmentId <> 0
            ORDER BY  i.id DESC');
    $success = true;
    // check directory-structure
    foreach (Util::$localeStrings as $dir) {
        if (!CLISetup::writeDir('datasets/' . $dir)) {
            $success = false;
        }
    }
    $enchIds = [];
    foreach ($gems as $pop) {
        $enchIds[] = $pop['enchId'];
    }
    $enchMisc = [];
    $enchJSON = Util::parseItemEnchantment($enchIds, false, $enchMisc);
    foreach (CLISetup::$localeIds as $lId) {
        set_time_limit(5);
        User::useLocale($lId);
        Lang::load(Util::$localeStrings[$lId]);
        $gemsOut = [];
        foreach ($gems as $pop) {
            $gemsOut[$pop['itemId']] = array('name' => Util::localizedString($pop, 'name'), 'quality' => $pop['quality'], 'icon' => strToLower($pop['icon']), 'enchantment' => Util::localizedString(@$enchMisc[$pop['enchId']]['text'] ?: [], 'text'), 'jsonequip' => @$enchJSON[$pop['enchId']] ?: [], 'colors' => $pop['colors'], 'expansion' => $pop['expansion']);
        }
        $toFile = "var g_gems = " . Util::toJSON($gemsOut) . ";";
        $file = 'datasets/' . User::$localeString . '/gems';
        if (!CLISetup::writeFile($file, $toFile)) {
            $success = false;
        }
    }
    return $success;
}
开发者ID:Carbenium,项目名称:aowow,代码行数:44,代码来源:gems.func.php


示例14: update

function update()
{
    $createQuery = "\r\n        CREATE TABLE `aowow_dbversion` (\r\n            `date` INT(10) UNSIGNED NOT NULL DEFAULT '0',\r\n            `part` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0'\r\n        ) ENGINE=MyISAM";
    $date = $part = 0;
    if (!DB::Aowow()->selectCell('SHOW TABLES LIKE "%dbversion"')) {
        DB::Aowow()->query($createQuery);
        DB::Aowow()->query('INSERT INTO ?_dbversion VALUES (0, 0)');
    } else {
        list($date, $part) = array_values(DB::Aowow()->selectRow('SELECT `date`, `part` FROM ?_dbversion'));
    }
    CLISetup::log('checking sql updates');
    $nFiles = 0;
    foreach (glob('setup/updates/*.sql') as $file) {
        $pi = pathinfo($file);
        list($fDate, $fPart) = explode('_', $pi['filename']);
        if ($date && $fDate < $date) {
            continue;
        } else {
            if ($part && $date && $fDate == $date && $fPart <= $part) {
                continue;
            }
        }
        $nFiles++;
        $updQuery = '';
        $nQuerys = 0;
        foreach (file($file) as $line) {
            // skip comments
            if (substr($line, 0, 2) == '--' || $line == '') {
                continue;
            }
            $updQuery .= $line;
            // semicolon at the end -> end of query
            if (substr(trim($line), -1, 1) == ';') {
                if (DB::Aowow()->query($updQuery)) {
                    $nQuerys++;
                }
                $updQuery = '';
            }
        }
        DB::Aowow()->query('UPDATE ?_dbversion SET `date`= ?d, `part` = ?d', $fDate, $fPart);
        CLISetup::log(' -> ' . date('d.m.Y', $fDate) . ' #' . $fPart . ': ' . $nQuerys . ' queries applied', CLISetup::LOG_OK);
    }
    CLISetup::log($nFiles ? 'applied ' . $nFiles . ' update(s)' : 'db is already up to date', CLISetup::LOG_OK);
}
开发者ID:Carbenium,项目名称:aowow,代码行数:44,代码来源:update.func.php


示例15: weightPresets

function weightPresets()
{
    // check directory-structure
    if (!CLISetup::writeDir('datasets/')) {
        return false;
    }
    $wtPresets = [];
    $scales = DB::Aowow()->select('SELECT id, name, icon, class FROM ?_account_weightscales WHERE userId = 0 ORDER BY class, id ASC');
    foreach ($scales as $s) {
        $weights = DB::Aowow()->selectCol('SELECT field AS ARRAY_KEY, val FROM ?_account_weightscale_data WHERE id = ?d', $s['id']);
        if (!$weights) {
            CLISetup::log('WeightScale \'' . CLISetup::bold($s['name']) . '\' has no data set. Skipping...', CLISetup::LOG_WARN);
            continue;
        }
        $wtPresets[$s['class']]['pve'][$s['name']] = array_merge(['__icon' => $s['icon']], $weights);
    }
    $toFile = "var wt_presets = " . Util::toJSON($wtPresets) . ";";
    $file = 'datasets/weight-presets';
    if (!CLISetup::writeFile($file, $toFile)) {
        return false;
    }
    return true;
}
开发者ID:TrinityCore,项目名称:aowow,代码行数:23,代码来源:weightPresets.func.php


示例16: account

function account()
{
    $fields = array('name' => ['Username', false], 'pass1' => ['Enter Password', true], 'pass2' => ['Confirm Password', true]);
    if (CLISetup::readInput($fields)) {
        CLISetup::log();
        if (!User::isValidName($fields['name'], $e)) {
            CLISetup::log(Lang::account($e == 1 ? 'errNameLength' : 'errNameChars'), CLISetup::LOG_ERROR);
        } else {
            if (!User::isValidPass($fields['pass1'], $e)) {
                CLISetup::log(Lang::account($e == 1 ? 'errPassLength' : 'errPassChars'), CLISetup::LOG_ERROR);
            } else {
                if ($fields['pass1'] != $fields['pass2']) {
                    CLISetup::log(Lang::account('passMismatch'), CLISetup::LOG_ERROR);
                } else {
                    if ($_ = DB::Aowow()->SelectCell('SELECT 1 FROM ?_account WHERE user = ? AND (status <> ?d OR (status = ?d AND statusTimer > UNIX_TIMESTAMP()))', $fields['name'], ACC_STATUS_NEW, ACC_STATUS_NEW)) {
                        CLISetup::log(Lang::account('nameInUse'), CLISetup::LOG_ERROR);
                    } else {
                        // write to db
                        $ok = DB::Aowow()->query('REPLACE INTO ?_account (user, passHash, displayName, joindate, email, allowExpire, userGroups, userPerms) VALUES (?, ?, ?, UNIX_TIMESTAMP(), ?, 0, ?d, 1)', $fields['name'], User::hashCrypt($fields['pass1']), Util::ucFirst($fields['name']), CFG_CONTACT_EMAIL, U_GROUP_ADMIN);
                        if ($ok) {
                            $newId = DB::Aowow()->selectCell('SELECT id FROM ?_account WHERE user = ?', $fields['name']);
                            Util::gainSiteReputation($newId, SITEREP_ACTION_REGISTER);
                            CLISetup::log("account " . $fields['name'] . " created successfully", CLISetup::LOG_OK);
                        } else {
                            // something went wrong
                            CLISetup::log(Lang::main('intError'), CLISetup::LOG_ERROR);
                        }
                    }
                }
            }
        }
    } else {
        CLISetup::log();
        CLISetup::log("account creation aborted", CLISetup::LOG_WARN);
    }
}
开发者ID:Carbenium,项目名称:aowow,代码行数:36,代码来源:account.func.php


示例17: currencies

function currencies(array $ids = [])
{
    if (!$ids) {
        DB::Aowow()->query('REPLACE INTO ?_currencies (id, category, itemId) SELECT Id, category, itemId FROM dbc_currencytypes');
    }
    $moneyItems = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, itemId FROM dbc_currencytypes{ WHERE id IN (?a)}', $ids ?: DBSIMPLE_SKIP);
    // apply names
    $moneyNames = DB::World()->select('SELECT it.entry AS ARRAY_KEY, name AS name_loc0, name_loc2, name_loc3, name_loc6, name_loc8 FROM item_template it LEFT JOIN locales_item li ON li.entry = it.entry WHERE it.entry IN (?a)', $moneyItems);
    foreach ($moneyItems as $cId => $itemId) {
        if (!empty($moneyNames[$itemId])) {
            $strings = $moneyNames[$itemId];
        } else {
            CLISetup::log('item #' . $itemId . ' required by currency #' . $cId . ' not in item_template', CLISetup::LOG_WARN);
            $strings = ['name_loc0' => 'Item #' . $itemId . ' not in DB', 'iconId' => -1240, 'cuFlags' => CUSTOM_EXCLUDE_FOR_LISTVIEW, 'category' => 3];
        }
        DB::Aowow()->query('UPDATE ?_currencies SET ?a WHERE itemId = ?d', $strings, $itemId);
    }
    // apply icons
    $displayIds = DB::World()->selectCol('SELECT entry AS ARRAY_KEY, displayid FROM item_template WHERE entry IN (?a)', $moneyItems);
    foreach ($displayIds as $itemId => $iconId) {
        DB::Aowow()->query('UPDATE ?_currencies SET iconId = ?d WHERE itemId = ?d', -$iconId, $itemId);
    }
    return true;
}
开发者ID:Carbenium,项目名称:aowow,代码行数:24,代码来源:currencies.func.php


示例18: item_stats

function item_stats(array $ids = [])
{
    $offset = 0;
    CLISetup::log(' - applying stats for enchantments');
    $enchStats = enchantment_stats();
    CLISetup::log('   ' . count($enchStats) . ' enchantments parsed');
    CLISetup::log(' - applying stats for items');
    while (true) {
        $items = new ItemStatSetup($offset, SqlGen::$stepSize, $ids, $enchStats);
        if ($items->error) {
            break;
        }
        $max = max($items->getFoundIDs());
        $num = count($items->getFoundIDs());
        CLISetup::log(' * sets ' . ($offset + 1) . ' - ' . $max);
        $offset = $max;
        $items->writeStatsTable();
    }
    return true;
}
开发者ID:dobrMAN,项目名称:aowow,代码行数:20,代码来源:item_stats.func.php


示例19: simpleImg

function simpleImg()
{
    // prefer manually converted PNG files (as the imagecreatefromblp-script has issues with some formats)
    // see: https://github.com/Kanma/BLPConverter
    $loadImageFile = function ($path) {
        $result = null;
        if (in_array(mb_substr($path, -4, 4), ['.png', '.blp', '.BLP', '.PNG'])) {
            $path = mb_substr($path, 0, mb_strlen($path) - 4);
        }
        $file = $path . '.png';
        if (CLISetup::fileExists($file)) {
            CLISetup::log('manually converted png file present for ' . $path . '.', CLISetup::LOG_INFO);
            $result = imagecreatefrompng($file);
        }
        if (!$result) {
            $file = $path . '.blp';
            if (CLISetup::fileExists($file)) {
                $result = imagecreatefromblp($file);
            }
        }
        return $result;
    };
    if (isset(FileGen::$cliOpts['help'])) {
        echo "\n";
        echo "available options for subScript 'simpleImg':\n";
        echo " --icons          (generates square icons that are used for basicly everything)\n";
        echo " --glyphs         (decorative tidbit displayed on Infobox for Glyph Spells)\n";
        echo " --pagetexts      (imagery contained in PageTexts on readable GameObjects or Items)\n";
        echo " --loadingscreens (loading screens (not used, skipped by default))\n";
        return true;
    }
    $locStr = null;
    $groups = [];
    $dbcPath = CLISetup::$srcDir . '%sDBFilesClient/';
    $imgPath = CLISetup::$srcDir . '%sInterface/';
    $destDir = 'static/images/wow/';
    $success = true;
    $iconDirs = array(['icons/large/', 'jpg', 0, 56, 4], ['icons/medium/', 'jpg', 0, 36, 4], ['icons/small/', 'jpg', 0, 18, 4], ['icons/tiny/', 'gif', 0, 15, 4]);
    $calendarDirs = array(['icons/large/', 'jpg', 90, 56, 4], ['icons/medium/', 'jpg', 90, 36, 4], ['icons/small/', 'jpg', 90, 18, 4], ['icons/tiny/', 'gif', 90, 15, 4]);
    $loadScreenDirs = array(['loadingscreens/large/', 'jpg', 0, 1024, 0], ['loadingscreens/medium/', 'jpg', 0, 488, 0], ['loadingscreens/original/', 'png', 0, 0, 0], ['loadingscreens/small/', 'jpg', 0, 244, 0]);
    $paths = array(0 => ['Icons/', $iconDirs, '/*.[bB][lL][pP]', true, 0], 1 => ['Spellbook/', [['Interface/Spellbook/', 'png', 0, 0, 0]], '/UI-Glyph-Rune*.blp', true, 0], 2 => ['PaperDoll/', array_slice($iconDirs, 0, 3), '/UI-{Backpack,PaperDoll}-*.blp', true, 0], 3 => ['GLUES/CHARACTERCREATE/UI-CharacterCreate-Races.blp', $iconDirs, '', true, 64], 4 => ['GLUES/CHARACTERCREATE/UI-CharacterCreate-CLASSES.blp', $iconDirs, '', true, 64], 5 => ['GLUES/CHARACTERCREATE/UI-CharacterCreate-Factions.blp', $iconDirs, '', true, 64], 7 => ['FlavorImages/', [['Interface/FlavorImages/', 'png', 0, 0, 0]], '/*.[bB][lL][pP]', false, 0], 8 => ['Pictures/', [['Interface/Pictures/', 'png', 0, 0, 0]], '/*.[bB][lL][pP]', false, 0], 9 => ['PvPRankBadges/', [['Interface/PvPRankBadges/', 'png', 0, 0, 0]], '/*.[bB][lL][pP]', false, 0], 10 => ['Calendar/Holidays/', $calendarDirs, '/*{rt,a,y,h,s}.[bB][lL][pP]', true, 0], 11 => ['GLUES/LOADINGSCREENS/', $loadScreenDirs, '/[lL][oO]*.[bB][lL][pP]', false, 0]);
    // textures are composed of 64x64 icons
    // numeric indexed arrays mimick the position on the texture
    $cuNames = array(2 => array('ui-paperdoll-slot-chest' => 'inventoryslot_chest', 'ui-backpack-emptyslot' => 'inventoryslot_empty', 'ui-paperdoll-slot-feet' => 'inventoryslot_feet', 'ui-paperdoll-slot-finger' => 'inventoryslot_finger', 'ui-paperdoll-slot-hands' => 'inventoryslot_hands', 'ui-paperdoll-slot-head' => 'inventoryslot_head', 'ui-paperdoll-slot-legs' => 'inventoryslot_legs', 'ui-paperdoll-slot-mainhand' => 'inventoryslot_mainhand', 'ui-paperdoll-slot-neck' => 'inventoryslot_neck', 'ui-paperdoll-slot-secondaryhand' => 'inventoryslot_offhand', 'ui-paperdoll-slot-ranged' => 'inventoryslot_ranged', 'ui-paperdoll-slot-relic' => 'inventoryslot_relic', 'ui-paperdoll-slot-shirt' => 'inventoryslot_shirt', 'ui-paperdoll-slot-shoulder' => 'inventoryslot_shoulder', 'ui-paperdoll-slot-tabard' => 'inventoryslot_tabard', 'ui-paperdoll-slot-trinket' => 'inventoryslot_trinket', 'ui-paperdoll-slot-waist' => 'inventoryslot_waist', 'ui-paperdoll-slot-wrists' => 'inventoryslot_wrists'), 3 => array(['race_human_male', 'race_dwarf_male', 'race_gnome_male', 'race_nightelf_male', 'race_draenei_male'], ['race_tauren_male', 'race_scourge_male', 'race_troll_male', 'race_orc_male', 'race_bloodelf_male'], ['race_human_female', 'race_dwarf_female', 'race_gnome_female', 'race_nightelf_female', 'race_draenei_female'], ['race_tauren_female', 'race_scourge_female', 'race_troll_female', 'race_orc_female', 'race_bloodelf_female']), 4 => array(['class_warrior', 'class_mage', 'class_rogue', 'class_druid'], ['class_hunter', 'class_shaman', 'class_priest', 'class_warlock'], ['class_paladin', 'class_deathknight']), 5 => array(['faction_alliance', 'faction_horde']), 6 => array([], [null, 'quest_start', 'quest_end', 'quest_start_daily', 'quest_end_daily']), 10 => array('calendar_winterveilstart' => 'calendar_winterveilstart', 'calendar_noblegardenstart' => 'calendar_noblegardenstart', 'calendar_childrensweekstart' => 'calendar_childrensweekstart', 'calendar_fishingextravaganza' => 'calendar_fishingextravaganzastart', 'calendar_harvestfestivalstart' => 'calendar_harvestfestivalstart', 'calendar_hallowsendstart' => 'calendar_hallowsendstart', 'calendar_lunarfestivalstart' => 'calendar_lunarfestivalstart', 'calendar_loveintheairstart' => 'calendar_loveintheairstart', 'calendar_midsummerstart' => 'calendar_midsummerstart', 'calendar_brewfeststart' => 'calendar_brewfeststart', 'calendar_darkmoonfaireelwynnstart' => 'calendar_darkmoonfaireelwynnstart', 'calendar_darkmoonfairemulgorestart' => 'calendar_darkmoonfairemulgorestart', 'calendar_darkmoonfaireterokkarstart' => 'calendar_darkmoonfaireterokkarstart', 'calendar_piratesday' => 'calendar_piratesdaystart', 'calendar_wotlklaunch' => 'calendar_wotlklaunchstart', 'calendar_dayofthedeadstart' => 'calendar_dayofthedeadstart', 'calendar_fireworks' => 'calendar_fireworksstart'));
    $writeImage = function ($name, $ext, $src, $srcDims, $destDims, $done) {
        $ok = false;
        $dest = imagecreatetruecolor($destDims['w'], $destDims['h']);
        imagesavealpha($dest, true);
        if ($ext == 'png') {
            imagealphablending($dest, false);
        }
        imagecopyresampled($dest, $src, $destDims['x'], $destDims['x'], $srcDims['x'], $srcDims['y'], $destDims['w'], $destDims['h'], $srcDims['w'], $srcDims['h']);
        switch ($ext) {
            case 'jpg':
                $ok = imagejpeg($dest, $name . '.' . $ext, 85);
                break;
            case 'gif':
                $ok = imagegif($dest, $name . '.' . $ext);
                break;
            case 'png':
                $ok = imagepng($dest, $name . '.' . $ext);
                break;
            default:
                CLISetup::log($done . ' - unsupported file fromat: ' . $ext, CLISetup::LOG_WARN);
        }
        imagedestroy($dest);
        if ($ok) {
            chmod($name . '.' . $ext, Util::FILE_ACCESS);
            CLISetup::log($done . ' - image ' . $name . '.' . $ext . ' written', CLISetup::LOG_OK);
        } else {
            CLISetup::log($done . ' - could not create image ' . $name . '.' . $ext, CLISetup::LOG_ERROR);
        }
        return $ok;
    };
    $checkSourceDirs = function ($sub, &$missing = []) use($imgPath, $dbcPath, $paths) {
        $hasMissing = false;
        foreach (array_column($paths, 0) as $subDir) {
            $p = sprintf($imgPath, $sub) . $subDir;
            if (!CLISetup::fileExists($p)) {
                $hasMissing = true;
                $missing[] = $p;
            }
        }
        $p = sprintf($dbcPath, $sub);
        if (!CLISetup::fileExists($p)) {
            $hasMissing = true;
            $missing[] = $p;
        }
        return !$hasMissing;
    };
    if (isset(FileGen::$cliOpts['icons'])) {
        array_push($groups, 0, 2, 3, 4, 5, 10);
    }
    if (isset(FileGen::$cliOpts['glyphs'])) {
        $groups[] = 1;
    }
    if (isset(FileGen::$cliOpts['pagetexts'])) {
        array_push($groups, 7, 8, 9);
    }
    if (isset(FileGen::$cliOpts['loadingscreens'])) {
//.........这里部分代码省略.........
开发者ID:saqar,项目名称:aowow,代码行数:101,代码来源:simpleImg.func.php


示例20: objects

function objects(array $ids = [])
{
    $baseQuery = '
        SELECT
            go.entry,
            `type`,
            IF(`type` = 2, -2,                                                                  -- quests 1
                IF(`type` = 8 AND Data0 IN (1, 2, 3, 4, 1552), -6,                              -- tools
                IF(`type` = 3 AND IFNULL(gqi.ItemId, 0) <> 0, -2,                               -- quests 2
                IF(`type` IN (3, 9, 25), `type`, 0)))),                                         -- regular chests, books, pools
            0 AS event,                                                                         -- linked worldevent
            displayId,
            go.name,
            gtl2.`name` AS name_loc2,
            gtl3.`name` AS name_loc3,
            gtl6.`name` AS name_loc6,
            gtl8.`name` AS name_loc8,
            faction,
            flags,
            0 AS cuFlags,                                                                       -- custom Flags
            IF(`type` IN (3, 25), Data1, 0),                                                    -- lootId
            IF(`type` IN (2, 3, 6, 10, 13, 24, 26), Data0, IF(`type` IN (0, 1), Data1, 0)),     -- lockId
            0 AS reqSkill,                                                                      -- reqSkill
            IF(`type` = 9, Data0, IF(`type` = 10, Data7, 0)),                                   -- pageTextId
            IF(`type` = 1, Data3,                                                               -- linkedTrapIds
                IF(`type` = 3, Data7,
                    IF(`type` = 10, Data12,
                        IF(`type` = 8, Data2, 0)))),
            IF(`type` = 5, Data5,                                                               -- reqQuest
                IF(`type` = 3, Data8,
                    IF(`type` = 10, Data1,
                        IF(`type` = 8, Data4, 0)))),
            IF(`type` = 8, Data0, 0),                                                           -- spellFocusId
            IF(`type` = 10, Data10,                                                             -- onUseSpell
                IF(`type` IN (18, 24), Data1,
                    IF(`type` = 26, Data2,
                        IF(`type` = 22, Data0, 0)))),
            IF(`type` = 18, Data4, 0),                                                          -- onSuccessSpell
            IF(`type` = 18, Data2, IF(`type` = 24, Data3, 0)),                                  -- auraSpell
            IF(`type` = 3 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CLMText类代码示例发布时间:2022-05-23
下一篇:
PHP CLI类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap