Files
aowow/setup/tools/sql/_item.php
Sarjuuk 5436ead926 - implemented item-lookup per weightscale (used in profiler, comparison tool and item upgrade search)
- some minor nonfunctional changes to support 'known' spells
- enabled dynamic update of Spelltooltips changing with pointsPerLevel
2013-08-06 16:50:31 +02:00

65 lines
1.7 KiB
PHP

<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
class ItemSetup extends ItemList
{
private $cols = [];
public function __construct($start, $end) // i suggest steps of 5k at max (12 steps (0 - 60k)); otherwise eats your ram for breakfast
{
$this->cols = DB::Aowow()->selectCol('SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`="world" AND `TABLE_NAME`="aowow_item_stats"');
set_time_limit(300);
$conditions = array(
['i.entry', $start, '>'],
['i.entry', $end, '<='],
[
'OR',
['class', 4],
['class', 2]
],
0
);
parent::__construct($conditions);
}
public function writeStatsTable()
{
while ($this->iterate())
{
$this->extendJsonStats();
$updateFields = [];
foreach (@$this->json[$this->id] as $k => $v)
{
if (!in_array($k, $this->cols) || !$v)
continue;
$updateFields[$k] = number_format($v, 2, ',', '');
}
if (isset($this->itemMods[$this->id]))
{
foreach ($this->itemMods[$this->id] as $k => $v)
{
if (!$v)
continue;
if ($str = Util::$itemMods[$k])
$updateFields[$str] = number_format($v, 2, ',', '');
}
}
if ($updateFields)
DB::Aowow()->query('REPLACE INTO ?_item_stats (`itemid`, `'.implode('`, `', array_keys($updateFields)).'`) VALUES (?d, "'.implode('", "', $updateFields).'")', $this->id);
}
}
}
?>