diff --git a/includes/types/item.class.php b/includes/types/item.class.php
index cf2b97c5..f037810b 100644
--- a/includes/types/item.class.php
+++ b/includes/types/item.class.php
@@ -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 .= ''.sprintf(Lang::item('armor'), intVal($this->curTpl['armor'] + $this->curTpl['armorDamageModifier'])).'
';
- // Block
- if ($this->curTpl['block'])
- $x .= ''.sprintf(Lang::item('block'), $this->curTpl['block']).'
';
+ // Block (note: block value from field block and from field stats or parsed from itemSpells are displayed independently)
+ if ($this->curTpl['tplBlock'])
+ $x .= ''.sprintf(Lang::item('block'), $this->curTpl['tplBlock']).'
';
// Item is a gem (don't mix with sockets)
if ($geId = $this->curTpl['gemEnchantmentId'])
diff --git a/pages/item.php b/pages/item.php
index 9369bb18..b6c5223c 100644
--- a/pages/item.php
+++ b/pages/item.php
@@ -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())
diff --git a/setup/tools/sqlgen/item_stats.func.php b/setup/tools/sqlgen/item_stats.func.php
index 3aebe1ff..31ad557a 100644
--- a/setup/tools/sqlgen/item_stats.func.php
+++ b/setup/tools/sqlgen/item_stats.func.php
@@ -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++)
{
diff --git a/setup/updates/1452718627_01.sql b/setup/updates/1452718627_01.sql
new file mode 100644
index 00000000..547fb1e1
--- /dev/null
+++ b/setup/updates/1452718627_01.sql
@@ -0,0 +1 @@
+UPDATE `aowow_dbversion` SET `sql` = CONCAT(`sql`, ' item_stats');