Items/Block

* fixed formating of xml-export
 * fixed handling of block value (can have multiple sources per item (itemMods, spell, set individually) and is then displayed separately in tooltip, but summed for calculations)
This commit is contained in:
Sarjuuk
2016-01-13 21:57:38 +01:00
parent 99eb8f426b
commit 432223264e
4 changed files with 22 additions and 17 deletions

View File

@@ -23,7 +23,7 @@ class ItemList extends BaseType
private $vendors = [];
private $jsGlobals = []; // getExtendedCost creates some and has no access to template
protected $queryBase = 'SELECT i.*, i.id AS ARRAY_KEY, i.id AS id FROM ?_items i';
protected $queryBase = 'SELECT i.*, i.block AS tplBlock, i.id AS ARRAY_KEY, i.id AS id FROM ?_items i';
protected $queryOpts = array( // 3 => TYPE_ITEM
'i' => [['is', 'src', 'ic'], 'o' => 'i.quality DESC, i.itemLevel DESC'],
'ic' => ['j' => ['?_icons `ic` ON `ic`.`id` = -`i`.`displayId`', true], 's' => ', ic.iconString'],
@@ -642,9 +642,9 @@ class ItemList extends BaseType
else if (($this->curTpl['armor'] + $this->curTpl['armorDamageModifier']) > 0)
$x .= '<span><!--amr-->'.sprintf(Lang::item('armor'), intVal($this->curTpl['armor'] + $this->curTpl['armorDamageModifier'])).'</span><br />';
// Block
if ($this->curTpl['block'])
$x .= '<span>'.sprintf(Lang::item('block'), $this->curTpl['block']).'</span><br />';
// Block (note: block value from field block and from field stats or parsed from itemSpells are displayed independently)
if ($this->curTpl['tplBlock'])
$x .= '<span>'.sprintf(Lang::item('block'), $this->curTpl['tplBlock']).'</span><br />';
// Item is a gem (don't mix with sockets)
if ($geId = $this->curTpl['gemEnchantmentId'])

View File

@@ -1054,8 +1054,8 @@ class ItemPage extends genericPage
$this->subject->extendJsonStats();
// json
$fields = ["classs", "displayid", "dps", "id", "level", "name", "reqlevel", "slot", "slotbak", "source", "sourcemore", "speed", "subclass"];
$json = '';
$fields = ['classs', 'displayid', 'dps', 'id', 'level', 'name', 'reqlevel', 'slot', 'slotbak', 'source', 'sourcemore', 'speed', 'subclass'];
$json = [];
foreach ($fields as $f)
{
if (isset($this->subject->json[$this->subject->id][$f]))
@@ -1064,33 +1064,33 @@ class ItemPage extends genericPage
if ($f == 'name')
$_ = (7 - $this->subject->getField('quality')).$_;
$json .= ',"'.$f.'":'.$_;
$json[$f] = $_;
}
}
$xml->addChild('json')->addCData(substr($json, 1));
$xml->addChild('json')->addCData(substr(json_encode($json), 1, -1));
// jsonEquip missing: avgbuyout, cooldown, source, sourcemore
$json = '';
$json = [];
if ($_ = $this->subject->getField('sellPrice')) // sellprice
$json .= ',"sellprice":'.$_;
$json['sellprice'] = $_;
if ($_ = $this->subject->getField('requiredLevel')) // reqlevel
$json .= ',"reqlevel":'.$_;
$json['reqlevel'] = $_;
if ($_ = $this->subject->getField('requiredSkill')) // reqskill
$json .= ',"reqskill":'.$_;
$json['reqskill'] = $_;
if ($_ = $this->subject->getField('requiredSkillRank')) // reqskillrank
$json .= ',"reqskillrank":'.$_;
$json['reqskillrank'] = $_;
foreach ($this->subject->itemMods[$this->subject->id] as $mod => $qty)
$json .= ',"'.$mod.'":'.$qty;
$json[$mod] = $qty;
foreach ($_ = $this->subject->json[$this->subject->id] as $name => $qty)
foreach ($this->subject->json[$this->subject->id] as $name => $qty)
if (in_array($name, Util::$itemFilter))
$json .= ',"'.$name.'":'.$qty;
$json[$name] = $qty;
$xml->addChild('jsonEquip')->addCData(substr($json, 1));
$xml->addChild('jsonEquip')->addCData(substr(json_encode($json), 1, -1));
// jsonUse
if ($onUse = $this->subject->getOnUseStats())

View File

@@ -49,6 +49,10 @@ class ItemStatSetup extends ItemList
{
$this->itemMods[$this->id] = [];
// also occurs as seperate field (gets summed in calculation but not in tooltip)
if ($_ = $this->getField('block'))
$this->itemMods[$this->id][ITEM_MOD_BLOCK_VALUE] = $_;
// convert itemMods to stats
for ($h = 1; $h <= 10; $h++)
{

View File

@@ -0,0 +1 @@
UPDATE `aowow_dbversion` SET `sql` = CONCAT(`sql`, ' item_stats');