- removed tooltip buffer from TypeClasses (only used by setup and caused bugs with the localization to boot)

- fixed broken dataset-scripts
- removed base-info.php wich wasn't really a dataset-script
This commit is contained in:
Sarjuuk
2014-09-01 23:51:30 +02:00
parent 0ab0cf133e
commit 96056161bd
21 changed files with 278 additions and 324 deletions

View File

@@ -1,53 +0,0 @@
<?php
/*
$clMasks = [];
$raMasks = [];
$tbl = DB::Aowow()->Select('SELECT * FROM dbc.CharBaseInfo');
foreach ($tbl as $data)
{
$cl = $data['class'];
$ra = $data['race'];
@$clMasks[$ra] |= (1 << ($cl - 1));
@$raMasks[$cl] |= (1 << ($ra - 1));
}
foreach ($clMasks as $ra => $msk)
DB::Aowow()->Query('UPDATE ?_races SET classmask = ?d WHERE Id = ?d', $msk, $ra);
foreach ($raMasks as $cl => $msk)
DB::Aowow()->Query('UPDATE ?_classes SET racemask = ?d WHERE Id = ?d', $msk, $cl);
DB::Aowow()->Query('UPDATE ?_races SET side = side + 1');
DB::Aowow()->Query('UPDATE ?_races SET side = 0 WHERE side = 3');
*/
// manually add infos about races
// leader, faction, startArea
$info = array(
null,
[29611, 72, 12],
[39605, 76, 14],
[2784, 47, 1],
[7999, 96, 141],
[10181, 68, 85],
[36648, 81, 215],
[7937, 54, 1],
[10540, 530, 14],
null,
[16802, 911, 3430],
[17468, 930, 3524]
);
foreach ($info as $id => $data)
if ($data)
DB::Aowow()->query(
'UPDATE ?_races SET leader = ?d, factionId = ?d, startAreaId = ?d WHERE Id = ?d',
$data[0],
$data[1],
$data[2],
$id
)
?>

View File

@@ -63,15 +63,22 @@ if (!defined('AOWOW_REVISION'))
if (!is_dir('datasets\\'.$dir))
mkdir('datasets\\'.$dir, 0755, true);
$enchIds = [];
foreach ($enchantSpells->iterate() as $__)
$enchIds[] = $enchantSpells->getField('effect1MiscValue');
$enchMisc = [];
$enchJSON = Util::parseItemEnchantment($enchIds, false, $enchMisc);
echo "script set up in ".Util::execTime()."<br>\n";
foreach ($locales as $lId)
{
set_time_limit(180);
User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
$enchantsOut = [];
foreach ($enchantSpells->iterate() as $__)
{
// slots have to be recalculated
@@ -101,7 +108,6 @@ if (!defined('AOWOW_REVISION'))
}
$eId = $enchantSpells->getField('effect1MiscValue');
$jsonequip = Util::parseItemEnchantment($eId, false, $misc);
// defaults
$ench = array(
@@ -111,20 +117,20 @@ if (!defined('AOWOW_REVISION'))
'source' => [], // <0: item; >0:spell
'skill' => -1, // modified if skill
'slots' => [], // determined per spell but set per item
'enchantment' => $misc['name'],
'jsonequip' => $jsonequip,
'enchantment' => Util::localizedString($enchMisc[$eId]['text'], 'text'),
'jsonequip' => @$enchJSON[$eId] ?: [],
'temp' => 0, // always 0
'classes' => 0, // modified by item
);
if (isset($misc['reqskill']))
$ench['jsonequip']['reqskill'] = $misc['reqskill'];
if (isset($enchMisc[$eId]['reqskill']))
$ench['jsonequip']['reqskill'] = $enchMisc[$eId]['reqskill'];
if (isset($misc['reqskillrank']))
$ench['jsonequip']['reqskill'] = $misc['reqskillrank'];
if (isset($enchMisc[$eId]['reqskillrank']))
$ench['jsonequip']['reqskill'] = $enchMisc[$eId]['reqskillrank'];
if (isset($misc['requiredLevel']))
$ench['jsonequip']['requiredLevel'] = $misc['requiredLevel'];
if (isset($enchMisc[$eId]['requiredLevel']))
$ench['jsonequip']['requiredLevel'] = $enchMisc[$eId]['requiredLevel'];
// check if the spell has an entry in skill_line_ability -> Source:Profession
if ($skill = DB::Aowow()->SelectCell('SELECT skillLineId FROM dbc.skilllineability WHERE spellId = ?d', $enchantSpells->id))
@@ -196,17 +202,15 @@ if (!defined('AOWOW_REVISION'))
}
// walk over each entry and strip single-item arrays
foreach ($enchantsOut as $eId => $ench)
foreach ($enchantsOut as &$ench)
{
foreach ($ench as $k => $v)
if (is_array($v) && count($v) == 1 && $k != 'jsonequip')
$enchantsOut[$eId][$k] = $v[0];
$ench[$k] = $v[0];
}
ksort($enchantsOut);
$toFile = "var g_enchants = ";
$toFile .= json_encode($enchantsOut, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);
$toFile .= json_encode($enchantsOut, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK);
$toFile .= ";";
$file = 'datasets\\'.User::$localeString.'\\enchants';
@@ -219,9 +223,8 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\nall done";
User::useLocale(LOCALE_EN);
Lang::load(Util::$localeStrings[LOCALE_EN]);
$stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);
?>

View File

@@ -26,22 +26,20 @@ if (!defined('AOWOW_REVISION'))
$gemQuery = "
SELECT
it.entry as itemId,
it.entry AS itemId,
it.name,
li.*,
IF (it.entry < 36000 OR it.ItemLevel < 70, 1 , 2) AS expansion,
(it.Quality) AS quality,
i.inventoryicon1 as icon,
ie.*,
gp.colorMask as colors
it.Quality AS quality,
i.inventoryicon1 AS icon,
gp.spellItemEnchantmentId AS enchId,
gp.colorMask AS colors
FROM
item_template it
LEFT JOIN
locales_item li ON li.entry = it.entry
JOIN
dbc.gemProperties gp ON gp.Id = it.GemProperties
JOIN
?_itemEnchantment ie ON gp.spellItemEnchantmentId = ie.Id
dbc.gemproperties gp ON gp.Id = it.GemProperties
JOIN
dbc.itemdisplayinfo i ON i.Id = it.displayid
WHERE
@@ -51,41 +49,44 @@ if (!defined('AOWOW_REVISION'))
;
";
$gems = Db::Aowow()->Select($gemQuery);
$locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU];
$jsonGems = [];
$gems = DB::Aowow()->Select($gemQuery);
$locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU];
// check directory-structure
foreach (Util::$localeStrings as $dir)
if (!is_dir('datasets\\'.$dir))
mkdir('datasets\\'.$dir, 0755, true);
$enchIds = [];
foreach ($gems as $pop)
$enchIds[] = $pop['enchId'];
$enchMisc = [];
$enchJSON = Util::parseItemEnchantment($enchIds, false, $enchMisc);
echo "script set up in ".Util::execTime()."<br>\n";
foreach ($locales as $lId)
{
User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
$gemsOut = [];
foreach ($gems as $pop)
{
// costy and locale-independant -> cache
if (!isset($jsonGems[$pop['itemId']]))
$jsonGems[$pop['itemId']] = Util::parseItemEnchantment($pop);
$gemsOut[$pop['itemId']] = array(
'name' => Util::localizedString($pop, 'name'),
'quality' => $pop['quality'],
'icon' => strToLower($pop['icon']),
'enchantment' => Util::localizedString($pop, 'text'),
'jsonequip' => $jsonGems[$pop['itemId']],
'enchantment' => Util::localizedString(@$enchMisc[$pop['enchId']]['text'] ?: [], 'text'),
'jsonequip' => @$enchJSON[$pop['enchId']] ?: [],
'colors' => $pop['colors'],
'expansion' => $pop['expansion']
);
}
$toFile = "var g_gems = ";
$toFile .= json_encode($gemsOut, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);
$toFile .= json_encode($gemsOut, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK);
$toFile .= ";";
$file = 'datasets\\'.User::$localeString.'\\gems';
@@ -98,9 +99,8 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\nall done";
User::useLocale(LOCALE_EN);
Lang::load(Util::$localeStrings[LOCALE_EN]);
$stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);
?>

View File

@@ -22,38 +22,31 @@ if (!defined('AOWOW_REVISION'))
$queryGlyphs = '
SELECT
i.entry as itemId,
i.name,
li.*,
IF (g.typeFlags & 0x1, 2, 1) as type,
i.subclass as classs,
i.requiredLevel as level,
s1.Id as glyphSpell,
s1.iconStringAlt as icon,
s1.skillLine1 as skillId,
s2.Id as glyphEffect,
s2.Id as ARRAY_KEY
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,
s1.iconStringAlt AS icon,
s1.skillLine1 AS skillId,
s2.Id AS glyphEffect,
s2.Id AS ARRAY_KEY
FROM
item_template i
LEFT JOIN
locales_item li ON
i.entry = li.entry
LEFT JOIN
?_spell s1 ON
s1.Id = i.spellid_1
LEFT JOIN
?_glyphproperties g ON
g.Id = s1.effect1MiscValue
LEFT JOIN
?_spell s2 ON
s2.Id = g.spellId
?_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
WHERE
i.class = 16
i.classBak = 16
;
';
$glyphList = DB::Aowow()->Select($queryGlyphs);
$locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU];
$glyphList = DB::Aowow()->Select($queryGlyphs);
$locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU];
// check directory-structure
foreach (Util::$localeStrings as $dir)
@@ -62,11 +55,12 @@ if (!defined('AOWOW_REVISION'))
echo "script set up in ".Util::execTime()."<br>\n";
$glyphSpells = new SpellList(array(['s.id', array_keys($glyphList)], 0));
$glyphSpells = new SpellList(array(['s.id', array_keys($glyphList)], CFG_SQL_LIMIT_NONE));
foreach ($locales as $lId)
{
User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
$glyphsOut = [];
foreach ($glyphSpells->iterate() as $__)
@@ -104,9 +98,8 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\nall done";
User::useLocale(LOCALE_EN);
Lang::load(Util::$localeStrings[LOCALE_EN]);
$stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);
?>

View File

@@ -4,7 +4,7 @@ if (!defined('AOWOW_REVISION'))
die('illegal access');
// Create 'itemsets'-file for available locales (and should probably order the itemests_dbc-table too (see below))
// Create 'itemsets'-file for available locales
// this script requires the following dbc-files to be parsed and available
// GlyphProperties, Spells, SkillLineAbility
@@ -29,32 +29,6 @@ if (!defined('AOWOW_REVISION'))
},
*/
/* Todo:
well .. strictly spoken this script is bogus. All data has to be assembled beforehand either by hand or by querying wowhead
we would need this script to prevent this type-fest and do it propperly ourselves.. *dang*
probably like this:
virtualId = 0
get itemsetIds ordered ascending
foreach itemsetId
lookup pieces
sort pieces by slot
if slots conflict
group items by ItemLevel ordered ascending
assign: first group => regularId
assign: other groups => --virtualId
end if
end foreach
this will probably screw the order of your set-pieces and will not result in the same virtualIds like wowhead, but
they are years beyond our content anyway, so what gives...
lets assume, you've done something like that, so ...
... onwards!
*/
$setList = DB::Aowow()->Select('SELECT * FROM ?_itemset ORDER BY refSetId DESC');
$locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU];
$jsonBonus = [];
@@ -69,11 +43,13 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $lId)
{
User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
$itemsetOut = [];
foreach ($setList as $set)
{
set_time_limit(15);
$setOut = array(
'id' => $set['id'],
'name' => (7 - $set['quality']).Util::jsEscape(Util::localizedString($set, 'name')),
@@ -112,18 +88,13 @@ if (!defined('AOWOW_REVISION'))
// costy and locale-independant -> cache
if (!isset($jsonBonus[$set['spell'.$i]]))
{
$bSpell = new SpellList(array(['s.id', $set['spell'.$i]]));
$jsonBonus[$set['spell'.$i]] = $bSpell->getStatGain()[$set['spell'.$i]];
}
$jsonBonus[$set['spell'.$i]] = (new SpellList(array(['s.id', (int)$set['spell'.$i]])))->getStatGain()[$set['spell'.$i]];
if (isset($setOut['setbonus'][$set['bonus'.$i]]))
{
if (!isset($setOut['setbonus'][$set['bonus'.$i]]))
$setOut['setbonus'][$set['bonus'.$i]] = $jsonBonus[$set['spell'.$i]];
else
foreach ($jsonBonus[$set['spell'.$i]] as $k => $v)
@$setOut['setbonus'][$set['bonus'.$i]][$k] += $v;
}
else
$setOut['setbonus'][$set['bonus'.$i]] = $jsonBonus[$set['spell'.$i]];
}
foreach ($setOut['setbonus'] as $k => $v)
@@ -150,7 +121,7 @@ if (!defined('AOWOW_REVISION'))
}
$toFile = "var g_itemsets = ";
$toFile .= json_encode($itemsetOut, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);
$toFile .= json_encode($itemsetOut, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK);
$toFile .= ";";
$file = 'datasets\\'.User::$localeString.'\\itemsets';
@@ -163,9 +134,8 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\nall done";
User::useLocale(LOCALE_EN);
Lang::load(Util::$localeStrings[LOCALE_EN]);
$stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);
?>

View File

@@ -33,28 +33,28 @@ if (!defined('AOWOW_REVISION'))
$petQuery = '
SELECT
ct.entry as id,
ct.entry AS id,
ct.name,
lc.*,
ct.minlevel,
ct.maxlevel,
CONCAT("[", ft.A, ", ", ft.H, "]") as react,
ct.rank as classification,
CONCAT("[", ft.A, ", ", ft.H, "]") AS react,
ct.rank AS classification,
ct.family,
ct.modelId1 as displayId,
cdi.skin1 as skin,
SUBSTRING_INDEX(cf.iconFile, "\\\\", -1) as icon,
cf.petTalentType as type
ct.modelId1 AS displayId,
cdi.skin1 AS skin,
SUBSTRING_INDEX(cf.iconFile, "\\\\", -1) AS icon,
cf.petTalentType AS type
FROM
world.creature_template ct
creature_template ct
JOIN
?_factiontemplate ft ON
ft.Id = ct.faction -- no beast has different faction set for Horde
ft.Id = ct.faction
JOIN
dbc.creaturefamily cf ON
cf.Id = ct.family
LEFT JOIN
world.locales_creature lc ON
locales_creature lc ON
lc.entry = ct.entry
JOIN
dbc.creaturedisplayinfo cdi ON
@@ -68,9 +68,9 @@ if (!defined('AOWOW_REVISION'))
$queryZones = '
SELECT DISTINCT
z.id AS location
z.id
FROM
world.creature c
creature c
JOIN
?_zones z ON
z.xMin < c.position_x AND
@@ -84,9 +84,9 @@ if (!defined('AOWOW_REVISION'))
$queryInstanceZone = '
SELECT DISTINCT
z.id AS location
z.id
FROM
world.creature c,
creature c,
?_zones z
WHERE
z.mapId = c.map AND
@@ -107,9 +107,9 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $lId)
{
User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
$petsOut = [];
foreach ($petList as $pet)
{
// get locations
@@ -124,7 +124,7 @@ if (!defined('AOWOW_REVISION'))
$locations[$pet['id']][] = $z;
}
$pet = array(
$petsOut[$pet['id']] = array(
'id' => $pet['id'],
'name' => Util::localizedString($pet, 'name'),
'minlevel' => $pet['minlevel'],
@@ -138,12 +138,10 @@ if (!defined('AOWOW_REVISION'))
'icon' => $pet['icon'],
'type' => $pet['type']
);
$petsOut[$pet['id']] = $pet;
}
$toFile = "var g_pets = ";
$toFile .= json_encode($petsOut, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);
$toFile .= json_encode($petsOut, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK);
$toFile .= ";";
$file = 'datasets\\'.User::$localeString.'\\pets';
@@ -156,9 +154,8 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\nall done";
User::useLocale(LOCALE_EN);
Lang::load(Util::$localeStrings[LOCALE_EN]);
$stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);
?>

View File

@@ -40,18 +40,21 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $l)
{
set_time_limit(20);
User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$handle = fOpen('datasets\\'.User::$localeString.'\\p-quests', "w");
if (!$handle)
die('could not create quests file '.$l);
$buff = "var _ = g_gatheredcurrencies;\n";
foreach($relCurr->getListviewData() as $id => $data)
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n";
$buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
$buff .= "\n\nvar _ = g_quests;\n";
foreach($questz->getListviewData() as $id => $data)
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n";
$buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
$buff .= "\ng_quest_catorder = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n";
@@ -68,6 +71,8 @@ if (!defined('AOWOW_REVISION'))
/* Achievements */
/****************/
{
set_time_limit(10);
$cnd = array(
CFG_SQL_LIMIT_NONE,
[['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0],
@@ -77,6 +82,7 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $l)
{
User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$handle = fOpen('datasets\\'.User::$localeString.'\\p-achievements', "w");
if (!$handle)
die('could not create achievements file '.$l);
@@ -86,7 +92,7 @@ if (!defined('AOWOW_REVISION'))
foreach ($achievez->getListviewData(ACHIEVEMENTINFO_PROFILE) as $id => $data)
{
$sumPoints += $data['points'];
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n";
$buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
}
// categories to sort by
@@ -107,6 +113,8 @@ if (!defined('AOWOW_REVISION'))
/* Titles */
/**********/
{
set_time_limit(10);
$cnd = array(
CFG_SQL_LIMIT_NONE,
[['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0],
@@ -117,6 +125,7 @@ if (!defined('AOWOW_REVISION'))
foreach ([0, 1] as $g) // gender
{
User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$handle = fOpen('datasets\\'.User::$localeString.'\\p-titles-'.$g, "w");
if (!$handle)
die('could not create titles file '.$l.' '.$g);
@@ -126,7 +135,7 @@ if (!defined('AOWOW_REVISION'))
{
$data['name'] = Util::localizedString($titlez->getEntry($id), $g ? 'female' : 'male');
unset($data['namefemale']);
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n";
$buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
}
fWrite($handle, $buff);
fClose($handle);
@@ -142,6 +151,8 @@ if (!defined('AOWOW_REVISION'))
/* Mounts */
/**********/
{
set_time_limit(10);
$cnd = array(
CFG_SQL_LIMIT_NONE,
[['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0],
@@ -151,13 +162,18 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $l)
{
User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$handle = fOpen('datasets\\'.User::$localeString.'\\p-mounts', "w");
if (!$handle)
die('could not create mounts file '.$l);
$buff = "var _ = g_spells;\n";
foreach ($mountz->getListviewData(ITEMINFO_MODEL) as $id => $data)
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n";
{
$data['quality'] = $data['name'][0];
$data['name'] = substr($data['name'], 1);
$buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
}
fWrite($handle, $buff);
fClose($handle);
@@ -172,6 +188,8 @@ if (!defined('AOWOW_REVISION'))
/* Companions */
/**************/
{
set_time_limit(10);
$cnd = array(
CFG_SQL_LIMIT_NONE,
[['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0],
@@ -181,13 +199,18 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $l)
{
User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$handle = fOpen('datasets\\'.User::$localeString.'\\p-companions', "w");
if (!$handle)
die('could not create companions file '.$l);
$buff = "var _ = g_spells;\n";
foreach ($companionz->getListviewData(ITEMINFO_MODEL) as $id => $data)
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n";
{
$data['quality'] = $data['name'][0];
$data['name'] = substr($data['name'], 1);
$buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
}
fWrite($handle, $buff);
fClose($handle);
@@ -202,6 +225,8 @@ if (!defined('AOWOW_REVISION'))
/* Factions */
/************/
{
set_time_limit(10);
// todo (med): exclude non-gaining reputation-header
$cnd = array(
CFG_SQL_LIMIT_NONE,
@@ -211,13 +236,14 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $l)
{
User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$handle = fOpen('datasets\\'.User::$localeString.'\\p-factions', "w");
if (!$handle)
die('could not create factions file '.$l);
$buff = "var _ = g_factions;\n";
foreach ($factionz->getListviewData() as $id => $data)
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n";
$buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
$buff .= "\ng_faction_order = [0, 469, 891, 1037, 1118, 67, 1052, 892, 936, 1117, 169, 980, 1097];\n";
@@ -245,6 +271,8 @@ if (!defined('AOWOW_REVISION'))
);
foreach ($skills as $s)
{
set_time_limit(20);
$file = is_array($s) ? 'sec' : (string)$s;
$cnd = array_merge($baseCnd, [['skillLine1', $s]]);
$recipez = new SpellList($cnd);
@@ -261,13 +289,11 @@ if (!defined('AOWOW_REVISION'))
foreach ($locales as $l)
{
User::useLocale($l);
Lang::load(Util::$localeStrings[$l]);
$buff = '';
foreach ($recipez->getListviewData() as $id => $data)
{
$data['name'] = $data['quality'].$data['name'];
unset($data['quality']);
$buff .= '_['.$id.'] = '.json_encode($data, JSON_NUMERIC_CHECK).";\n";
}
$buff .= '_['.$id.'] = '.json_encode($data, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).";\n";
if (!$buff)
{
echo " - file: ".$file." has no content => skipping<br>\n";
@@ -293,8 +319,10 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\n";
}
User::useLocale(LOCALE_EN);
echo "<br>\nall done";
Lang::load(Util::$localeStrings[LOCALE_EN]);
$stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);
?>

View File

@@ -86,7 +86,7 @@ if (!defined('AOWOW_REVISION'))
$offset = [20, 20, 20, 20, 20];
$rows = DB::Aowow()->select('SELECT pls.level AS ARRAY_KEY, str-?d, agi-?d, sta-?d, inte-?d, spi-?d, basehp, IF(basemana <> 0, basemana, 100), mlecrt.chance*100, splcrt.chance*100, mlecrt.chance*100 * ?f, baseHP5.ratio*1, extraHP5.ratio*1 ' .
'FROM world.player_levelstats pls JOIN world.player_classlevelstats pcls ON pls.level = pcls.level AND pls.class = pcls.class JOIN' .
'FROM player_levelstats pls JOIN player_classlevelstats pcls ON pls.level = pcls.level AND pls.class = pcls.class JOIN' .
' dbc.gtchancetomeleecrit mlecrt ON mlecrt.idx = ((pls.class - 1) * 100) + (pls.level - 1) JOIN' .
' dbc.gtchancetospellcrit splcrt ON splcrt.idx = ((pls.class - 1) * 100) + (pls.level - 1) JOIN' .
' dbc.gtoctregenhp baseHP5 ON baseHP5.idx = ((pls.class - 1) * 100) + (pls.level - 1) JOIN' .

View File

@@ -9,30 +9,16 @@ if (!defined('AOWOW_REVISION'))
// this script requires the following dbc-files to be parsed and available
// Talent, TalentTab, Spell
$query = '
SELECT
s.iconString
FROM
?_spell s
JOIN
dbc.talent t On
t.rank1 = s.Id
JOIN
dbc.talenttab tt ON
tt.Id = t.tabId
WHERE
tt.?# = ?d AND
tt.tabNumber = ?d
ORDER BY
t.row, t.column, t.petCategory1 ASC ;
';
$query = 'SELECT s.iconString FROM ?_spell s JOIN dbc.talent t ON t.rank1 = s.Id JOIN dbc.talenttab tt ON tt.Id = t.tabId WHERE tt.?# = ?d AND tt.tabNumber = ?d ORDER BY t.row, t.column, t.petCategory1 ASC;';
$dims = 36; //v-pets
$filenames = ['icons', 'warrior', 'paladin', 'hunter', 'rogue', 'priest', 'deathknight', 'shaman', 'mage', 'warlock', null, 'druid'];
// create directory if missing
if (!is_dir('images\\talent\\classes\\icons'))
mkdir('images\\talent\\classes\\icons', 0755, true);
if (!is_dir('static\\images\\wow\\talents\\icons'))
mkdir('static\\images\\wow\\talents\\icons', 0755, true);
if (!is_dir('static\\images\\wow\\hunterpettalents'))
mkdir('static\\images\\wow\\hunterpettalents', 0755, true);
echo "script set up in ".Util::execTime()."<br>\n";
@@ -41,12 +27,14 @@ if (!defined('AOWOW_REVISION'))
if (!$v)
continue;
set_time_limit(10);
for ($tree = 0; $tree < 3; $tree++)
{
$what = $k ? 'classMask' : 'creatureFamilyMask';
$set = $k ? 1 << ($k - 1) : 1 << $tree;
$subset = $k ? $tree : 0;
$path = $k ? 'classes\\icons' : 'pets';
$path = $k ? 'talents\\icons' : 'hunterpettalents';
$icons = DB::Aowow()->SelectCol($query, $what, $set, $subset);
@@ -57,7 +45,7 @@ if (!defined('AOWOW_REVISION'))
for($i = 0; $i < count($icons); $i++)
{
$im = @imagecreatefromjpeg('images\\icons\\medium\\'.$icons[$i].'.jpg');
$im = @imagecreatefromjpeg('static\\images\\wow\\icons\\medium\\'.$icons[$i].'.jpg');
if(!$im)
die('error: raw image '.$icons[$i]. ' not found');
@@ -71,12 +59,12 @@ if (!defined('AOWOW_REVISION'))
for ($j = 0; $j < imagecolorstotal($im); $j++)
{
$color = imagecolorsforindex($im, $j);
$gray = round(0.299 * $color['red'] + 0.587 * $color['green'] + 0.114 * $color['blue']);
$gray = round(0.299 * $color['red'] + 0.587 * $color['green'] + 0.114 * $color['blue']);
imagecolorset($im, $j, $gray, $gray, $gray);
}
imagecopymerge($res, $im, $i * $dims, $dims, 0, 0, imageSX($im), imageSY($im), 100);
if (!@imagejpeg($res, 'images\\talent\\'.$path.'\\'.$v.'_'.($tree + 1).'.jpg'))
if (@!imagejpeg($res, 'static\\images\\wow\\'.$path.'\\'.$v.'_'.($tree + 1).'.jpg'))
die('error: '.$v.'_'.($tree + 1).'.jpg could not be written!');
}
}
@@ -86,8 +74,6 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\nall done";
User::useLocale(LOCALE_EN);
$stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);

View File

@@ -25,9 +25,8 @@ if (!defined('AOWOW_REVISION'))
// t - array of talent-objects
// f - array:int [pets only] creatureFamilies in that category
function buildTree($class)
$buildTree = function ($class) use (&$petFamIcons, &$tSpells)
{
global $petFamIcons; // h8!
$petCategories = [];
$mask = $class ? 1 << ($class - 1) : 0;
@@ -116,12 +115,14 @@ if (!defined('AOWOW_REVISION'))
for ($k = 0; $k <= ($m - 1); $k++)
{
$tSpell = new SpellList(array(['s.id', (int)$talents[$j]['rank'.($k + 1)]]));
$d[] = $tSpell->parseText()[0];
if (!$tSpells->getEntry($talents[$j]['rank'.($k + 1)]))
continue;
$d[] = $tSpells->parseText()[0];
$s[] = $talents[$j]['rank'.($k + 1)];
if ($talents[$j]['talentSpell'])
$t[] = $tSpell->getTalentHeadForCurrent();
$t[] = $tSpells->getTalentHeadForCurrent();
}
if ($talents[$j]['reqTalent'])
@@ -130,7 +131,7 @@ if (!defined('AOWOW_REVISION'))
if (!isset($tNums[$talents[$j]['reqTalent']]))
$depLinks[$talents[$j]['reqTalent']] = $j;
$r = [$tNums[$talents[$j]['reqTalent']], $talents[$j]['reqRank'] + 1];
$r = @[$tNums[$talents[$j]['reqTalent']], $talents[$j]['reqRank'] + 1];
}
$result[$l]['t'][$j] = array(
@@ -169,7 +170,7 @@ if (!defined('AOWOW_REVISION'))
}
return $result;
}
};
$classes = [CLASS_WARRIOR, CLASS_PALADIN, CLASS_HUNTER, CLASS_ROGUE, CLASS_PRIEST, CLASS_DEATHKNIGHT, CLASS_SHAMAN, CLASS_MAGE, CLASS_WARLOCK, CLASS_DRUID];
$locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU];
@@ -182,11 +183,15 @@ if (!defined('AOWOW_REVISION'))
if (!is_dir('datasets\\'.$dir))
mkdir('datasets\\'.$dir, 0755, true);
$tSpellIds = DB::Aowow()->selectCol('SELECT rank1 FROM dbc.talent UNION SELECT rank2 FROM dbc.talent UNION SELECT rank3 FROM dbc.talent UNION SELECT rank4 FROM dbc.talent UNION SELECT rank5 FROM dbc.talent');
$tSpells = new SpellList(array(['s.id', $tSpellIds], CFG_SQL_LIMIT_NONE));
echo "script set up in ".Util::execTime()."<br>\n";
foreach ($locales as $lId)
{
User::useLocale($lId);
Lang::load(Util::$localeStrings[$lId]);
// TalentCalc
foreach ($classes as $cMask)
@@ -195,7 +200,7 @@ if (!defined('AOWOW_REVISION'))
$cId = log($cMask, 2) + 1;
$file = 'datasets\\'.User::$localeString.'\\talents-'.$cId;
$toFile = '$WowheadTalentCalculator.registerClass('.$cId.', '.json_encode(buildTree($cId), JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK).')';
$toFile = '$WowheadTalentCalculator.registerClass('.$cId.', '.json_encode($buildTree($cId), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK).')';
$handle = fOpen($file, "w");
fWrite($handle, $toFile);
@@ -208,11 +213,11 @@ if (!defined('AOWOW_REVISION'))
if (empty($petIcons))
{
$pets = DB::Aowow()->SelectCol('SELECT Id AS ARRAY_KEY, iconString FROM ?_pet');
$petIcons = json_encode($pets, JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);
$petIcons = json_encode($pets, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK);
}
$toFile = "var g_pet_icons = ".$petIcons."\n\n";
$toFile .= 'var g_pet_talents = '.json_encode(buildTree(0), JSON_PRETTY_PRINT | JSON_NUMERIC_CHECK);
$toFile .= 'var g_pet_talents = '.json_encode($buildTree(0), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK);
$file = 'datasets\\'.User::$localeString.'\\pet-talents';
$handle = fOpen($file, "w");
@@ -224,9 +229,8 @@ if (!defined('AOWOW_REVISION'))
echo "<br>\nall done";
User::useLocale(LOCALE_EN);
Lang::load(Util::$localeStrings[LOCALE_EN]);
$stats = DB::Aowow()->getStatistics();
echo "<br>\n".$stats['count']." queries in: ".Util::formatTime($stats['time'] * 1000);
?>

File diff suppressed because one or more lines are too long