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, ?d, ?d) AS expansion, i.quality, ic.name AS icon, i.gemEnchantmentId AS enchId, i.gemColorMask AS colors, i.requiredSkill, i.itemLevel FROM ?_items i JOIN ?_icons ic ON ic.id = i.iconId WHERE i.gemEnchantmentId <> 0 ORDER BY i.id DESC', EXP_BC, EXP_WOTLK ); $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::get('SQL_LIMIT_NONE'))); if ($enchantments->error) { CLI::write('Required table ?_itemenchantment seems to be empty! Leaving gems()...', CLI::LOG_ERROR); CLI::write(); return false; } foreach (CLISetup::$localeIds as $lId) { set_time_limit(5); User::useLocale($lId); Lang::load($lId); $gemsOut = []; foreach ($gems as $pop) { if (!$enchantments->getEntry($pop['enchId'])) { CLI::write(' * could not find enchantment #'.$pop['enchId'].' referenced by item #'.$pop['itemId'], CLI::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->getStatGainForCurrent(), 'colors' => $pop['colors'], 'expansion' => $pop['expansion'], 'gearscore' => Util::getGemScore($pop['itemLevel'], $pop['quality'], $pop['requiredSkill'] == SKILL_JEWELCRAFTING, $pop['itemId']) ); } $toFile = "var g_gems = ".Util::toJSON($gemsOut).";"; $file = 'datasets/'.User::$localeString.'/gems'; if (!CLISetup::writeFile($file, $toFile)) $success = false; } return $success; } ?>