mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
* added markdown [enchantment=123] and [emote=456] * updated item_stats to accomodate enchantments * updated tables for community content to handle emotes and enchantments Spells: * getStatGain() now reads aura 123 as Spell Penetration * fixed error in tooltips when displaying effect ranges (e.g. 10 - 10 damage) * display the miscValue of aura 50, 102, 131 and 180 human readable Emote: * no longer displays empty quickInfo on detail page * detail page no longer pretends to be a pet Setup: * sync no longer regenerates all tables/files, when the supplied world-table affects nothing * fixed dependancy of ?_source from ?_achievment (damn plural-s) Misc: * FireFox doesn't understand <node>.innerText, use <node>.textContent instead please refresh the affected tables and files php aowow --sql=itemenchantment,item_stats php aowow --build=enchants,gems
101 lines
3.2 KiB
PHP
101 lines
3.2 KiB
PHP
<?php
|
|
|
|
if (!defined('AOWOW_REVISION'))
|
|
die('illegal access');
|
|
|
|
if (!CLI)
|
|
die('not in cli mode');
|
|
|
|
|
|
// Create 'gems'-file for available locales
|
|
// this script requires the following dbc-files to be parsed and available
|
|
// ItemEnchantment, GemProperties, Spells, Icons
|
|
|
|
/* Example
|
|
22460: {
|
|
name:'Prismatic Sphere',
|
|
quality:3,
|
|
icon:'INV_Enchant_PrismaticSphere',
|
|
enchantment:'+3 Resist All',
|
|
jsonequip:{"arcres":3,"avgbuyout":242980,"firres":3,"frores":3,"holres":3,"natres":3,"shares":3},
|
|
colors:14,
|
|
expansion:1
|
|
gearscore:8 // as if.....
|
|
},
|
|
*/
|
|
|
|
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'];
|
|
|
|
$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;
|
|
}
|
|
|
|
?>
|