mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
* unify stat handling. If there are discrepancies left at least they are now centralized. - health should no longer pretend to be mana - stats are no longer capped to 32.7k points as items can have multiple of the same stat and handily exceed smallints * weight scale fixes: - "repair cost" is no longer a weight scale option. Why was it one in the first place? Also it wasn't even accessible before. (that was a bug) - "bonus armor" is now searchable and only applied to armor pieces * removed unused parsed stats from itemsets
130 lines
4.2 KiB
PHP
130 lines
4.2 KiB
PHP
<?php
|
|
|
|
if (!defined('AOWOW_REVISION'))
|
|
die('illegal access');
|
|
|
|
if (!CLI)
|
|
die('not in cli mode');
|
|
|
|
|
|
/* Example
|
|
"-447": { // internal id, freely chosen
|
|
"classes":["6"], // array
|
|
"elite":true,
|
|
"heroic":false,
|
|
"id":"-447",
|
|
"idbak":"924", // actual setId
|
|
"maxlevel":"390",
|
|
"minlevel":"390",
|
|
"name":"3Cataclysmic Gladiator's Desecration",
|
|
"note":"37", // contentGroup
|
|
"pieces":["73742","73741","73740","73739","73738"],
|
|
"reqclass":"32", // mask
|
|
"type":"4",
|
|
"setbonus":{
|
|
"2":{"resirtng":"400","str":"70"},
|
|
"4":{"str":"90"}
|
|
}
|
|
},
|
|
*/
|
|
|
|
// Create 'itemsets'-file for available locales
|
|
// this script requires the following dbc-files to be parsed and available
|
|
|
|
function itemsets()
|
|
{
|
|
$success = true;
|
|
$setList = DB::Aowow()->Select('SELECT * FROM ?_itemset ORDER BY refSetId DESC');
|
|
$jsonBonus = [];
|
|
|
|
// 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($lId);
|
|
|
|
$itemsetOut = [];
|
|
foreach ($setList as $set)
|
|
{
|
|
set_time_limit(15);
|
|
|
|
$setOut = array(
|
|
'id' => $set['id'],
|
|
'idbak' => $set['refSetId'],
|
|
'name' => (7 - $set['quality']).Util::jsEscape(Util::localizedString($set, 'name')),
|
|
'pieces' => [],
|
|
'heroic' => !!$set['heroic'], // should be bool
|
|
'maxlevel' => $set['maxLevel'],
|
|
'minlevel' => $set['minLevel'],
|
|
'type' => $set['type'],
|
|
'setbonus' => []
|
|
);
|
|
|
|
if ($set['classMask'])
|
|
{
|
|
$setOut['reqclass'] = $set['classMask'];
|
|
$setOut['classes'] = [];
|
|
|
|
for ($i = 0; $i < 12; $i++)
|
|
if ($set['classMask'] & (1 << $i))
|
|
$setOut['classes'][] = $i + 1;
|
|
}
|
|
|
|
if ($set['contentGroup'])
|
|
$setOut['note'] = $set['contentGroup'];
|
|
|
|
for ($i = 1; $i < 11; $i++)
|
|
if ($set['item'.$i])
|
|
$setOut['pieces'][] = $set['item'.$i];
|
|
|
|
$_spells = [];
|
|
for ($i = 1; $i < 9; $i++)
|
|
{
|
|
if (!$set['spell'.$i] || isset($jsonBonus[$set['spell'.$i]]))
|
|
continue;
|
|
|
|
$_spells[] = $set['spell'.$i];
|
|
}
|
|
|
|
// costy and locale-independant -> cache
|
|
if ($_spells)
|
|
$jsonBonus += (new SpellList(array(['s.id', $_spells])))->getStatGain();
|
|
|
|
$setbonus = [];
|
|
for ($i = 1; $i < 9; $i++)
|
|
{
|
|
$itemQty = $set['bonus'.$i];
|
|
$itemSpl = $set['spell'.$i];
|
|
if (!$itemQty || !$itemSpl || !isset($jsonBonus[$itemSpl]))
|
|
continue;
|
|
|
|
if ($x = $jsonBonus[$itemSpl]->toJson(Stat::FLAG_ITEM))
|
|
{
|
|
if (!isset($setbonus[$itemQty]))
|
|
$setbonus[$itemQty] = [];
|
|
|
|
Util::arraySumByKey($setbonus[$itemQty], $x);
|
|
}
|
|
}
|
|
|
|
if ($setbonus)
|
|
$setOut['setbonus'] = $setbonus;
|
|
|
|
$itemsetOut[$setOut['id']] = $setOut;
|
|
}
|
|
|
|
$toFile = "var g_itemsets = ".Util::toJSON($itemsetOut).";";
|
|
$file = 'datasets/'.User::$localeString.'/itemsets';
|
|
|
|
if (!CLISetup::writeFile($file, $toFile))
|
|
$success = false;
|
|
}
|
|
|
|
return $success;
|
|
}
|
|
?>
|