NPCs/Detail Page

* fixed vendors displaying the same sell price for every item
This commit is contained in:
Sarjuuk
2018-04-28 13:32:16 +02:00
parent 808bbcc2fd
commit 35dc835c62

View File

@@ -147,8 +147,11 @@ class ItemList extends BaseType
// no extended cost or additional gold required // no extended cost or additional gold required
if (!$costs || $this->getField('flagsExtra') & 0x04) if (!$costs || $this->getField('flagsExtra') & 0x04)
{
$this->getEntry($k);
if ($_ = $this->getField('buyPrice')) if ($_ = $this->getField('buyPrice'))
$data[0] = $_; $data[0] = $_;
}
$vendors[$l] = $data; $vendors[$l] = $data;
} }
@@ -259,6 +262,10 @@ class ItemList extends BaseType
if ($addInfoMask & ITEMINFO_JSON) if ($addInfoMask & ITEMINFO_JSON)
$this->extendJsonStats(); $this->extendJsonStats();
$extCosts = [];
if ($addInfoMask & ITEMINFO_VENDOR)
$extCosts = $this->getExtendedCost($miscData);
foreach ($this->iterate() as $__) foreach ($this->iterate() as $__)
{ {
foreach ($this->json[$this->id] as $k => $v) foreach ($this->json[$this->id] as $k => $v)
@@ -294,9 +301,9 @@ class ItemList extends BaseType
{ {
// just use the first results // just use the first results
// todo (med): dont use first result; search for the right one // todo (med): dont use first result; search for the right one
if (!empty($this->getExtendedCost($miscData)[$this->id])) if (!empty($extCosts[$this->id]))
{ {
$cost = reset($this->getExtendedCost($miscData)[$this->id]); $cost = reset($extCosts[$this->id]);
$currency = []; $currency = [];
$tokens = []; $tokens = [];