mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
ItemFilter/TabLinks
* always display FilterResult prompt on currency-for tabs * fixed display of FilterResult prompt on item currency-for tab
This commit is contained in:
@@ -2052,6 +2052,11 @@ class ItemListFilter extends Filter
|
||||
return $this->wtCnd;
|
||||
}
|
||||
|
||||
public function isCurrencyFor(int $itemId) : bool
|
||||
{
|
||||
return in_array($itemId, self::ENUM_CURRENCY);
|
||||
}
|
||||
|
||||
protected function createSQLForValues()
|
||||
{
|
||||
$parts = [];
|
||||
|
||||
@@ -188,6 +188,7 @@ class CurrencyPage extends GenericPage
|
||||
}
|
||||
|
||||
// tab: currency for
|
||||
$n = $w = null;
|
||||
if ($this->typeId == 103)
|
||||
{
|
||||
$n = '?items&filter=cr=145;crs=1;crv=0';
|
||||
@@ -199,10 +200,10 @@ class CurrencyPage extends GenericPage
|
||||
$w = 'reqHonorPoints > 0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$n = in_array($this->typeId, [42, 61, 81, 241, 121, 122, 123, 125, 126, 161, 201, 101, 102, 221, 301, 341]) ? '?items&filter=cr=158;crs='.$_itemId.';crv=0' : null;
|
||||
$w = 'reqItemId1 = '.$_itemId.' OR reqItemId2 = '.$_itemId.' OR reqItemId3 = '.$_itemId.' OR reqItemId4 = '.$_itemId.' OR reqItemId5 = '.$_itemId;
|
||||
}
|
||||
|
||||
if (!$n && (new ItemListFilter())->isCurrencyFor($_itemId))
|
||||
$n = '?items&filter=cr=158;crs='.$_itemId.';crv=0';
|
||||
|
||||
$xCosts = DB::Aowow()->selectCol('SELECT id FROM ?_itemextendedcost WHERE '.$w);
|
||||
$boughtBy = $xCosts ? DB::World()->selectCol('SELECT item FROM npc_vendor WHERE extendedCost IN (?a) UNION SELECT item FROM game_event_npc_vendor WHERE extendedCost IN (?a)', $xCosts, $xCosts) : [];
|
||||
@@ -215,10 +216,10 @@ class CurrencyPage extends GenericPage
|
||||
'data' => array_values($boughtBy->getListviewData(ITEMINFO_VENDOR, [Type::CURRENCY => $this->typeId])),
|
||||
'name' => '$LANG.tab_currencyfor',
|
||||
'id' => 'currency-for',
|
||||
'extraCols' => ["\$Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", '$Listview.extraCols.cost'],
|
||||
'extraCols' => ["\$Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", '$Listview.extraCols.cost']
|
||||
);
|
||||
|
||||
if ($boughtBy->getMatches() > CFG_SQL_LIMIT_DEFAULT)
|
||||
if ($n)
|
||||
$tabData['note'] = sprintf(Util::$filterResultString, $n);
|
||||
|
||||
$this->lvTabs[] = [ItemList::$brickFile, $tabData];
|
||||
|
||||
@@ -849,6 +849,7 @@ class ItemPage extends genericPage
|
||||
|
||||
// tab: currency for
|
||||
// some minor trickery: get arenaPoints(43307) and honorPoints(43308) directly
|
||||
$n = $w = null;
|
||||
if ($this->typeId == 43307)
|
||||
{
|
||||
$n = '?items&filter=cr=145;crs=1;crv=0';
|
||||
@@ -860,10 +861,10 @@ class ItemPage extends genericPage
|
||||
$w = 'reqHonorPoints > 0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$n = in_array($this->typeId, [42, 61, 81, 241, 121, 122, 123, 125, 126, 161, 201, 101, 102, 221, 301, 341]) ? '?items&filter=cr=158;crs='.$this->typeId.';crv=0' : null;
|
||||
$w = 'reqItemId1 = '.$this->typeId.' OR reqItemId2 = '.$this->typeId.' OR reqItemId3 = '.$this->typeId.' OR reqItemId4 = '.$this->typeId.' OR reqItemId5 = '.$this->typeId;
|
||||
}
|
||||
|
||||
if (!$n && (new ItemListFilter())->isCurrencyFor($this->typeId))
|
||||
$n = '?items&filter=cr=158;crs='.$this->typeId.';crv=0';
|
||||
|
||||
$xCosts = DB::Aowow()->selectCol('SELECT id FROM ?_itemextendedcost WHERE '.$w);
|
||||
$boughtBy = $xCosts ? DB::World()->selectCol('SELECT item FROM npc_vendor WHERE extendedCost IN (?a) UNION SELECT item FROM game_event_npc_vendor WHERE extendedCost IN (?a)', $xCosts, $xCosts) : null;
|
||||
@@ -879,10 +880,10 @@ class ItemPage extends genericPage
|
||||
'data' => array_values($boughtBy->getListviewData(ITEMINFO_VENDOR, $filter)),
|
||||
'name' => '$LANG.tab_currencyfor',
|
||||
'id' => 'currency-for',
|
||||
'extraCols' => ["\$Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", '$Listview.extraCols.cost'],
|
||||
'extraCols' => ["\$Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", '$Listview.extraCols.cost']
|
||||
);
|
||||
|
||||
if ($boughtBy->getMatches() > CFG_SQL_LIMIT_DEFAULT && $n)
|
||||
if ($n)
|
||||
$tabData['note'] = sprintf(Util::$filterResultString, $n);
|
||||
|
||||
$this->lvTabs[] = [ItemList::$brickFile, $tabData];
|
||||
|
||||
Reference in New Issue
Block a user