mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
implemented grouping by itemlevel and slot for items
group by source won't require much additional work besides adding source to items in the first place search for multiple itemUpgrades are also yet to come
This commit is contained in:
@@ -49,7 +49,7 @@ foreach ($AoWoWconf['characters'] as $realm => $charDBInfo)
|
||||
// load config to constants
|
||||
$sets = DB::Aowow()->select('SELECT `key` AS ARRAY_KEY, intValue as i, strValue as s FROM ?_config');
|
||||
foreach ($sets as $k => $v)
|
||||
define('CFG_'.strtoupper($k), $v['i'] ? intVal($v['i']) : $v['s']);
|
||||
define('CFG_'.strtoupper($k), $v['s'] ? $v['s'] : intVal($v['i']));
|
||||
|
||||
define('STATIC_URL', substr('http://'.$_SERVER['SERVER_NAME'].strtr($_SERVER['SCRIPT_NAME'], ['index.php' => '']), 0, -1).'/static'); // points js to images & scripts (change here if you want to use a separate subdomain)
|
||||
define('HOST_URL', substr('http://'.$_SERVER['SERVER_NAME'].strtr($_SERVER['SCRIPT_NAME'], ['index.php' => '']), 0, -1)); // points js to executable files
|
||||
|
||||
@@ -349,7 +349,6 @@ abstract class BaseType
|
||||
// additional (str)
|
||||
case 'g': // group by
|
||||
case 'h': // having
|
||||
case 'o': // order by
|
||||
if (!empty($this->queryOpts[$tbl][$module]))
|
||||
$this->queryOpts[$tbl][$module] .= $value;
|
||||
else
|
||||
@@ -364,9 +363,10 @@ abstract class BaseType
|
||||
$this->queryOpts[$tbl][$module] = $value;
|
||||
|
||||
break;
|
||||
// replacement
|
||||
// replacement (str)
|
||||
case 'l': // limit
|
||||
case 's': // select
|
||||
case 'o': // order by
|
||||
$this->queryOpts[$tbl][$module] = $value;
|
||||
break;
|
||||
}
|
||||
@@ -543,7 +543,7 @@ abstract class Filter
|
||||
private $cndSet = [];
|
||||
|
||||
protected $fiData = ['c' => [], 'v' =>[]];
|
||||
protected $formData = array( // data to fill form fields
|
||||
protected $formData = array( // data to fill form fields
|
||||
'form' => [], // base form - unsanitized
|
||||
'setCriteria' => [], // dynamic criteria list - index checked
|
||||
'setWeights' => [], // dynamic weights list - index checked
|
||||
@@ -581,20 +581,8 @@ abstract class Filter
|
||||
}
|
||||
}
|
||||
|
||||
// create get-data
|
||||
$tmp = [];
|
||||
foreach (array_merge($this->fiData['c'], $this->fiData['v']) as $k => $v)
|
||||
{
|
||||
if ($v === '')
|
||||
continue;
|
||||
else if (is_array($v))
|
||||
$tmp[$k] = $k."=".implode(':', $v);
|
||||
else
|
||||
$tmp[$k] = $k."=".$v;
|
||||
}
|
||||
|
||||
// do get request
|
||||
header('Location: '.HOST_URL.'?'.$_SERVER['QUERY_STRING'].'='.implode(';', $tmp));
|
||||
header('Location: '.HOST_URL.'?'.$_SERVER['QUERY_STRING'].'='.$this->urlize());
|
||||
}
|
||||
// sanitize input and build sql
|
||||
else if (!empty($_GET['filter']))
|
||||
@@ -674,6 +662,23 @@ abstract class Filter
|
||||
}
|
||||
}
|
||||
|
||||
public function urlize(array $override = [], array $addCr = [])
|
||||
{
|
||||
$_ = [];
|
||||
foreach (array_merge($this->fiData['c'], $this->fiData['v'], $override) as $k => $v)
|
||||
{
|
||||
if (isset($addCr[$k]))
|
||||
$v = $v ? array_merge((array)$v, (array)$addCr[$k]) : $addCr[$k];
|
||||
|
||||
if (is_array($v) && !empty($v))
|
||||
$_[$k] = $k.'='.implode(':', $v);
|
||||
else if ($v === '')
|
||||
$_[$k] = $k.'='.$v;
|
||||
}
|
||||
|
||||
return implode(';', $_);
|
||||
}
|
||||
|
||||
// todo: kill data, that is unexpected or points to wrong indizes
|
||||
private function evaluateFilter()
|
||||
{
|
||||
|
||||
@@ -180,6 +180,10 @@ $lang = array(
|
||||
'modes' => ['Normal / Normal 10', 'Heroisch / Normal 25', 'Heroisch 10', 'Heroisch 25'],
|
||||
'expansions' => array("Classic", "The Burning Crusade", "Wrath of the Lich King"),
|
||||
'stats' => array("Stärke", "Beweglichkeit", "Ausdauer", "Intelligenz", "Willenskraft"),
|
||||
'sources' => array(
|
||||
null, "Hergestellt", "Drop", "PvP", "Quest", "Händler", "Lehrer", "Entdeckung",
|
||||
"Einlösung", "Talent", "Startausrüstung", "Ereignis", "Erfolg"
|
||||
),
|
||||
'languages' => array(
|
||||
1 => "Orcisch", 2 => "Darnassisch", 3 => "Taurisch", 6 => "Zwergisch", 7 => "Gemeinsprache", 8 => "Dämonisch", 9 => "Titanisch", 10 => "Thalassisch",
|
||||
11 => "Drachisch", 12 => "Kalimagisch", 13 => "Gnomisch", 14 => "Trollisch", 33 => "Gossensprache", 35 => "Draeneiisch", 36 => "Zombie", 37 => "Gnomenbinär", 38 => "Goblinbinär"
|
||||
@@ -614,6 +618,7 @@ $lang = array(
|
||||
'usableBy' => "Benutzbar von",
|
||||
'buyout' => "Sofortkaufpreis",
|
||||
'each' => "Stück",
|
||||
'tabOther' => "Anderes",
|
||||
'gems' => "Edelsteine",
|
||||
'socketBonus' => "Sockelbonus",
|
||||
'socket' => array (
|
||||
|
||||
@@ -167,8 +167,12 @@ $lang = array(
|
||||
'modes' => ['Normal / Normal 10', 'Heroic / Normal 25', 'Heroic 10', 'Heroic 25'],
|
||||
'expansions' => array("Classic", "The Burning Crusade", "Wrath of the Lich King"),
|
||||
'stats' => array("Strength", "Agility", "Stamina", "Intellect", "Spirit"),
|
||||
'sources' => array(
|
||||
null, "Crafted", "Drop", "PvP", "Quest", "Vendor", "Trainer", "Discovery",
|
||||
"Redemption", "Talent", "Starter", "Event", "Achievement"
|
||||
),
|
||||
'languages' => array(
|
||||
1 => "Orcish", 2 => "Darnassian", 3 => "Taurahe", 6 => "Dwarvish", 7 => "Common", 8 => "Demonic", 9 => "Titan", 10 => "Thalassian",
|
||||
1 => "Orcish", 2 => "Darnassian", 3 => "Taurahe", 6 => "Dwarvish", 7 => "Common", 8 => "Demonic", 9 => "Titan", 10 => "Thalassian",
|
||||
11 => "Draconic", 12 => "Kalimag", 13 => "Gnomish", 14 => "Troll", 33 => "Gutterspeak", 35 => "Draenei", 36 => "Zombie", 37 => "Gnomish Binary", 38 => "Goblin Binary"
|
||||
),
|
||||
'gl' => array(null, "Major", "Minor"),
|
||||
@@ -199,8 +203,8 @@ $lang = array(
|
||||
"Critter", "Mechanical", "Not specified", "Totem", "Non-combat Pet", "Gas Cloud"
|
||||
),
|
||||
'fa' => array(
|
||||
1 => "Wolf", 2 => "Cat", 3 => "Spider", 4 => "Bear", 5 => "Boar", 6 => "Crocolisk", 7 => "Carrion Bird", 8 => "Crab",
|
||||
9 => "Gorilla", 11 => "Raptor", 12 => "Tallstrider", 20 => "Scorpid", 21 => "Turtle", 24 => "Bat", 25 => "Hyena", 26 => "Bird of Prey",
|
||||
1 => "Wolf", 2 => "Cat", 3 => "Spider", 4 => "Bear", 5 => "Boar", 6 => "Crocolisk", 7 => "Carrion Bird", 8 => "Crab",
|
||||
9 => "Gorilla", 11 => "Raptor", 12 => "Tallstrider", 20 => "Scorpid", 21 => "Turtle", 24 => "Bat", 25 => "Hyena", 26 => "Bird of Prey",
|
||||
27 => "Wind Serpent", 30 => "Dragonhawk", 31 => "Ravager", 32 => "Warp Stalker", 33 => "Sporebat", 34 => "Nether Ray", 35 => "Serpent", 37 => "Moth",
|
||||
38 => "Chimaera", 39 => "Devilsaur", 41 => "Silithid", 42 => "Worm", 43 => "Rhino", 44 => "Wasp", 45 => "Core Hound", 46 => "Spirit Beast"
|
||||
),
|
||||
@@ -604,6 +608,7 @@ $lang = array(
|
||||
'usableBy' => "Usable by",
|
||||
'buyout' => "Buyout price",
|
||||
'each' => "each",
|
||||
'tabOther' => "Other",
|
||||
'gems' => "Gems",
|
||||
'socketBonus' => "Socket Bonus",
|
||||
'socket' => array(
|
||||
|
||||
@@ -172,6 +172,10 @@ $lang = array(
|
||||
'modes' => ['Normal / Normal 10', 'Heroico / Normal 25', 'Heróico 10', 'Heróico 25'],
|
||||
'expansions' => array("World of Warcraft", "The Burning Crusade", "Wrath of the Lich King"),
|
||||
'stats' => array("Fuerza", "Agilidad", "Aguante", "Intelecto", "Espíritu"),
|
||||
'sources' => array(
|
||||
null, "Creado", "Encontrado", "JcJ", "Misión", "Vendedor", "Entrenador", "Descubierto",
|
||||
"Redención", "Talento", "Habilidad Inicial", "Evento", "Logro"
|
||||
),
|
||||
'languages' => array(
|
||||
1 => "Orco", 2 => "Darnassiano", 3 => "Taurahe", 6 => "Enánico", 7 => "Lengua común", 8 => "Demoníaco", 9 => "Titánico", 10 => "Thalassiano",
|
||||
11 => "Dracónico", 12 => "Kalimag", 13 => "Gnomótico", 14 => "Trol", 33 => "Viscerálico", 35 => "Draenei", 36 => "Zombie", 37 => "Binario gnomo", 38 => "Binario goblin"
|
||||
@@ -572,6 +576,7 @@ $lang = array(
|
||||
'usableBy' => "Usable por",
|
||||
'buyout' => "Precio de venta en subasta",
|
||||
'each' => "cada uno",
|
||||
'tabOther' => "Otros",
|
||||
'gems' => "Gemas",
|
||||
'socketBonus' => "Bono de ranura",
|
||||
'socket' => array(
|
||||
|
||||
@@ -172,6 +172,10 @@ $lang = array(
|
||||
'modes' => ['Standard / Normal 10', 'Héroïque / Normal 25', '10 héroïque', '25 héroïque'],
|
||||
'expansions' => array("Classique", "The Burning Crusade", "Wrath of the Lich King"),
|
||||
'stats' => array("Force", "Agilité", "Endurance", "Intelligence", "Esprit"),
|
||||
'sources' => array(
|
||||
null, "Fabriqué", "Butin", "JcJ", "Quête", "Vendeur", "Maître", "Découverte",
|
||||
"Échange d'un code", "Talent", "Débutant", "Événement", "Haut fait"
|
||||
),
|
||||
'languages' => array(
|
||||
1 => "Orc", 2 => "Darnassien", 3 => "Taurahe", 6 => "Nain", 7 => "Commun", 8 => "Démoniaque", 9 => "Titan", 10 => "Thalassien",
|
||||
11 => "Draconique", 12 => "Kalimag", 13 => "Gnome", 14 => "Troll", 33 => "Bas-parler", 35 => "Draeneï", 36 => "Zombie", 37 => "Binaire gnome", 38 => "Binaire gobelin"
|
||||
@@ -572,6 +576,7 @@ $lang = array(
|
||||
'usableBy' => "Utilisable par",
|
||||
'buyout' => "Vente immédiate",
|
||||
'each' => "chacun",
|
||||
'tabOther' => "Autre",
|
||||
'gems' => "Gemmes",
|
||||
'socketBonus' => "Bonus de châsse",
|
||||
'socket' => array(
|
||||
|
||||
@@ -172,6 +172,10 @@ $lang = array(
|
||||
'modes' => ['Обычный / 10-норм.', 'Героический / 25-норм.', '10-героич', '25-героич'],
|
||||
'expansions' => array("World of Warcraft", "The Burning Crusade", "Wrath of the Lich King"),
|
||||
'stats' => array("к силе", "к ловкости", "к выносливости", "к интеллекту", "к духу"),
|
||||
'sources' => array(
|
||||
null, "Ремесло", "Добыча", "PvP", "Задание", "Продавец", "Тренер", "Открытие",
|
||||
"Рекламная акция", "Талант", "Начальное заклинание", "Мероприятие", "Достижение"
|
||||
),
|
||||
'languages' => array(
|
||||
1 => "орочий", 2 => "дарнасский", 3 => "таурахэ", 6 => "дворфийский", 7 => "всеобщий", 8 => "язык демонов", 9 => "язык титанов", 10 => "талассийский",
|
||||
11 => "драконий", 12 => "калимаг", 13 => "гномский", 14 => "язык троллей", 33 => "наречие нежити", 35 => "дренейский", 36 => "наречие зомби", 37 => "машинный гномский", 38 => "машинный гоблинский"
|
||||
@@ -572,6 +576,7 @@ $lang = array(
|
||||
'usableBy' => "Используется (кем)",
|
||||
'buyout' => "Цена выкупа",
|
||||
'each' => "каждый",
|
||||
'tabOther' => "Другое",
|
||||
'gems' => "Самоцветы",
|
||||
'socketBonus' => "При соответствии цвета",
|
||||
'socket' => array(
|
||||
|
||||
318
pages/items.php
318
pages/items.php
@@ -158,39 +158,8 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
|
||||
if (isset($filter['slot'][INVTYPE_SHIELD])) // "Off Hand" => "Shield"
|
||||
$filter['slot'][INVTYPE_SHIELD] = Lang::$item['armorSubClass'][6];
|
||||
|
||||
|
||||
/*
|
||||
set conditions
|
||||
*/
|
||||
|
||||
/*
|
||||
* todo (low): this is a long term issue.
|
||||
* Filter is used as a subSystem to each TypeList
|
||||
* but here we would need to preemptive check for $filter['gb']
|
||||
* .. bummer .. this is to be removed when the issue is _really_ solved
|
||||
*
|
||||
* ALSO upgradeItems .. Profiler can send them as lists, so multiple lv-tabs would occur
|
||||
*
|
||||
*/
|
||||
$itemFilter = new ItemListFilter();
|
||||
|
||||
if (preg_match('/gb\=(1|2|3)/i', $_SERVER['QUERY_STRING'], $match))
|
||||
$filter['gb'] = $match[1];
|
||||
|
||||
if (isset($cats[0]))
|
||||
$conditions[] = ['i.class', $cats[0]];
|
||||
if (isset($cats[1]))
|
||||
$conditions[] = ['i.subClass', $cats[1]];
|
||||
if (isset($cats[2]))
|
||||
$conditions[] = ['i.subSubClass', $cats[2]];
|
||||
|
||||
if ($_ = $itemFilter->getConditions())
|
||||
$conditions[] = $_;
|
||||
|
||||
$items = new ItemList($conditions, ['extraOpts' => $itemFilter->extraOpts]);
|
||||
|
||||
$items->addGlobalsToJscript($smarty);
|
||||
|
||||
// recreate form selection
|
||||
$filter = array_merge($itemFilter->getForm('form'), $filter);
|
||||
$filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL;
|
||||
@@ -206,6 +175,7 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
|
||||
if (array_intersect([63, 64], $xCols)) // 63:buyPrice; 64:sellPrice
|
||||
$infoMask |= ITEMINFO_VENDOR;
|
||||
|
||||
|
||||
// menuId 0: Item g_initPath()
|
||||
// tabId 0: Database g_initHeader()
|
||||
$pageData = array(
|
||||
@@ -220,89 +190,46 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
|
||||
'?data=weight-presets'
|
||||
)
|
||||
),
|
||||
'lv' => array(
|
||||
'data' => $items->getListviewData($infoMask),
|
||||
'params' => []
|
||||
'lv' => array(
|
||||
'tabs' => [],
|
||||
'isGrouped' => false
|
||||
)
|
||||
);
|
||||
|
||||
if ($itemFilter->error)
|
||||
$pageData['lv']['params']['_errors'] = '$1';
|
||||
|
||||
if (!empty($filter['upg']))
|
||||
{
|
||||
// upgrade-item got deleted by filter
|
||||
if (empty($pageData['lv']['data'][$filter['upg']]))
|
||||
{
|
||||
if ($w = $itemFilter->getForm('setWeights', true))
|
||||
{
|
||||
$upgItem = new ItemList(array(['id', $filter['upg']]), false, ['wt' => $w[0], 'wtv' => $w[1]]);
|
||||
/*
|
||||
set conditions
|
||||
*/
|
||||
|
||||
// still it may not be found if you apply really weired filters (e.g. search for a melee item with caster-weights) .. not my fault :[
|
||||
if (!$upgItem->error)
|
||||
{
|
||||
$upgItem->addGlobalsToJScript($smarty);
|
||||
$pageData['lv']['data'][$filter['upg']] = $upgItem->getListviewData($infoMask)[$filter['upg']];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($cats[0]))
|
||||
$conditions[] = ['i.class', $cats[0]];
|
||||
if (isset($cats[1]))
|
||||
$conditions[] = ['i.subClass', $cats[1]];
|
||||
if (isset($cats[2]))
|
||||
$conditions[] = ['i.subSubClass', $cats[2]];
|
||||
|
||||
if (!empty($filter['gb']))
|
||||
$pageData['lv']['params']['customFilter'] = '$fi_filterUpgradeListview';
|
||||
if ($_ = $itemFilter->getConditions())
|
||||
$conditions[] = $_;
|
||||
|
||||
$pageData['lv']['params']['_upgradeIds'] = "$[".$filter['upg']."]";
|
||||
}
|
||||
/*
|
||||
by level: max 10 itemlevel steps (Level X) +1x Other|Autre|Anderes|Otros|Другое levels
|
||||
by slot: all slots available
|
||||
by source: .. well .. no
|
||||
|
||||
template: 'item',
|
||||
id: 'one-hand',
|
||||
name: 'One-Hand',
|
||||
tabs: tabsGroups,
|
||||
parent: 'lkljbjkb574',
|
||||
hideCount: 1,
|
||||
note: $WH.sprintf(LANG.lvnote_viewmoreslot, '=2', 'sl=13;ub=10;cr=161;crs=1;crv=0;gm=3;rf=1;wt=23:123:24:103:96:170;wtv=100:85:75:60:50:40;upg=104585'),
|
||||
customFilter: fi_filterUpgradeListview,
|
||||
_upgradeIds: [104585],
|
||||
extraCols: fi_getExtraCols(fi_extraCols, 3, 1, 0),
|
||||
sort: ['-score', 'name'],
|
||||
computeDataFunc: fi_scoreSockets,
|
||||
onBeforeCreate: fi_initWeightedListview,
|
||||
onAfterCreate: fi_addUpgradeIndicator,
|
||||
hiddenCols: ['type', 'source'],
|
||||
data: []
|
||||
/*
|
||||
shared parameter between all possible lv-tabs
|
||||
*/
|
||||
|
||||
template: 'item',
|
||||
id: 'two-hand',
|
||||
name: 'Two-Hand',
|
||||
tabs: tabsGroups,
|
||||
parent: 'lkljbjkb574',
|
||||
hideCount: 1,
|
||||
note: $WH.sprintf(LANG.lvnote_viewmoreslot, '=2', 'sl=17;ub=10;cr=161;crs=1;crv=0;gm=3;rf=1;wt=23:123:24:103:96:170;wtv=100:85:75:60:50:40;upg=104585'),
|
||||
customFilter: fi_filterUpgradeListview,
|
||||
_upgradeIds: [104585],
|
||||
extraCols: fi_getExtraCols(fi_extraCols, 3, 1, 0),
|
||||
sort: ['-score', 'name'],
|
||||
computeDataFunc: fi_scoreSockets,
|
||||
onBeforeCreate: fi_initWeightedListview,
|
||||
onAfterCreate: fi_addUpgradeIndicator,
|
||||
hiddenCols: ['type', 'source'],
|
||||
data: []
|
||||
*/
|
||||
$sharedLvParams = [];
|
||||
$upgItemData = [];
|
||||
if (!empty($filter['fi']['extraCols']))
|
||||
{
|
||||
$gem = empty($filter['gm']) ? 0 : $filter['gm'];
|
||||
$cost = array_intersect([63], $xCols) ? 1 : 0;
|
||||
$pageData['lv']['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, '.$gem.', '.$cost.')';
|
||||
$sharedLvParams['extraCols'] = '$fi_getExtraCols(fi_extraCols, '.$gem.', '.$cost.')';
|
||||
}
|
||||
|
||||
if (!empty($filter['fi']['setWeights']))
|
||||
{
|
||||
if (!empty($filter['gm']))
|
||||
{
|
||||
$pageData['lv']['params']['computeDataFunc'] = '$fi_scoreSockets';
|
||||
$sharedLvParams['computeDataFunc'] = '$fi_scoreSockets';
|
||||
|
||||
$w = $itemFilter->getForm('setWeights', true);
|
||||
$q = intVal($filter['gm']);
|
||||
@@ -337,28 +264,201 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
|
||||
$pageData['page']['gemScores'] = json_encode($pageData['page']['gemScores'], JSON_NUMERIC_CHECK);
|
||||
}
|
||||
|
||||
$pageData['lv']['params']['onBeforeCreate'] = '$fi_initWeightedListview';
|
||||
$pageData['lv']['params']['onAfterCreate'] = '$fi_addUpgradeIndicator';
|
||||
$pageData['lv']['params']['sort'] = "$['-score', 'name']";
|
||||
|
||||
if ($items->hasSetFields(['armor']))
|
||||
$visibleCols[] = 'armor';
|
||||
$sharedLvParams['onBeforeCreate'] = '$fi_initWeightedListview';
|
||||
$sharedLvParams['onAfterCreate'] = '$fi_addUpgradeIndicator';
|
||||
$sharedLvParams['sort'] = "$['-score', 'name']";
|
||||
|
||||
array_push($hiddenCols, 'type', 'source');
|
||||
}
|
||||
|
||||
// create note if search limit was exceeded; overwriting 'note' is intentional
|
||||
if ($items->getMatches() > CFG_SQL_LIMIT_DEFAULT && empty($filter['upg']))
|
||||
if ($itemFilter->error)
|
||||
$sharedLvParams['_errors'] = '$1';
|
||||
|
||||
if (!empty($filter['upg']))
|
||||
{
|
||||
$pageData['lv']['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsfound', $items->getMatches(), CFG_SQL_LIMIT_DEFAULT);
|
||||
$pageData['lv']['params']['_truncated'] = 1;
|
||||
// v poke it to use item_stats
|
||||
$upgItem = new ItemList(array(['id', $filter['upg']], ['is.id', null, '!']), ['extraOpts' => $itemFilter->extraOpts]);
|
||||
if (!$upgItem->error)
|
||||
{
|
||||
$upgItem->addGlobalsToJScript($smarty);
|
||||
$upgItemData = $upgItem->getListviewData($infoMask)[$filter['upg']];
|
||||
}
|
||||
|
||||
// if (!empty($filter['gb']))
|
||||
$sharedLvParams['customFilter'] = '$fi_filterUpgradeListview';
|
||||
|
||||
$sharedLvParams['_upgradeIds'] = "$[".$filter['upg']."]";
|
||||
}
|
||||
|
||||
if ($hiddenCols)
|
||||
$pageData['lv']['params']['hiddenCols'] = '$'.json_encode($hiddenCols);
|
||||
/*
|
||||
* todo (low): this is a long term issue.
|
||||
* upgradeItems .. Profiler can send them as lists, so multiple lv-tabs would occur
|
||||
*
|
||||
*/
|
||||
|
||||
if ($visibleCols)
|
||||
$pageData['lv']['params']['visibleCols'] = '$'.json_encode($visibleCols);
|
||||
/*
|
||||
group by
|
||||
*/
|
||||
$availableSlots = array(
|
||||
ITEM_CLASS_ARMOR => [INVTYPE_HEAD, INVTYPE_NECK, INVTYPE_SHOULDERS, INVTYPE_CHEST, INVTYPE_WAIST, INVTYPE_LEGS, INVTYPE_FEET, INVTYPE_WRISTS, INVTYPE_HANDS, INVTYPE_FINGER, INVTYPE_TRINKET, INVTYPE_SHIELD, INVTYPE_CLOAK],
|
||||
ITEM_CLASS_WEAPON => [INVTYPE_WEAPON, INVTYPE_RANGED, INVTYPE_2HWEAPON, INVTYPE_WEAPONMAINHAND, INVTYPE_WEAPONOFFHAND, INVTYPE_THROWN, INVTYPE_HOLDABLE]
|
||||
);
|
||||
$sourcesGlobalToItem = [1 => 3, 2 => 4, 3 => 5, 4 => 6, 5 => 7, 6 => 8];
|
||||
$groups = [];
|
||||
$nameSource = [];
|
||||
$field = '';
|
||||
switch (@$filter['gb'])
|
||||
{
|
||||
// slot: (try to limit the lookups by class grouping and intersecting with preselected slots)
|
||||
// if intersect yields an empty array no lookups will occur
|
||||
case 1:
|
||||
if (isset($cats[0]) && $cats[0] == ITEM_CLASS_ARMOR)
|
||||
$groups = isset($filter['sl']) ? array_intersect($availableSlots[ITEM_CLASS_ARMOR], (array)$filter['sl']) : $availableSlots[ITEM_CLASS_ARMOR];
|
||||
else if (isset($cats[0]) && $cats[0] == ITEM_CLASS_WEAPON)
|
||||
$groups = isset($filter['sl']) ? array_intersect($availableSlots[ITEM_CLASS_WEAPON], (array)$filter['sl']) : $availableSlots[ITEM_CLASS_WEAPON];
|
||||
else
|
||||
{
|
||||
$groups = array_merge($availableSlots[ITEM_CLASS_ARMOR], $availableSlots[ITEM_CLASS_WEAPON]);
|
||||
if (isset($filter['sl']))
|
||||
$groups = array_intersect($groups, (array)$filter['sl']);
|
||||
}
|
||||
|
||||
if ($groups)
|
||||
{
|
||||
$nameSource = Lang::$item['inventoryType'];
|
||||
$pageData['lv']['isGrouped'] = true;
|
||||
$field = 'slot';
|
||||
}
|
||||
|
||||
break;
|
||||
// itemlevel: first, try to find 10 level steps within range (if given) as tabs
|
||||
case 2:
|
||||
$levelRef = new ItemList(array_merge($conditions, [10]), ['extraOpts' => ['i' => ['g' => 'itemlevel', 'o' => 'itemlevel DESC']]]);
|
||||
foreach ($levelRef->iterate() as $_)
|
||||
{
|
||||
$l = $levelRef->getField('itemLevel');
|
||||
$groups[] = $l;
|
||||
$nameSource[$l] = Lang::$game['level'].' '.$l;
|
||||
}
|
||||
|
||||
if ($groups)
|
||||
{
|
||||
$l = -end($groups);
|
||||
$groups[] = $l; // push last value as negativ to signal misc group after this level
|
||||
$nameSource[$l] = Lang::$item['tabOther'];
|
||||
$pageData['lv']['isGrouped'] = true;
|
||||
$field = 'itemlevel';
|
||||
}
|
||||
|
||||
break;
|
||||
// todo(med): source
|
||||
// .. well .. no, not at the moment .. the databse doesn't event have a field for that
|
||||
case 3:
|
||||
$groups = array_filter(array_keys(Lang::$game['sources']));
|
||||
|
||||
if ($groups)
|
||||
{
|
||||
$nameSource = Lang::$game['sources'];
|
||||
$pageData['lv']['isGrouped'] = true;
|
||||
$field = 'source';
|
||||
}
|
||||
|
||||
break;
|
||||
// none
|
||||
default:
|
||||
$groups[0] = null;
|
||||
}
|
||||
|
||||
foreach ($groups as $group)
|
||||
{
|
||||
$finalCnd = $field ? array_merge($conditions, [[$field, abs($group), $group > 0 ? null : '<'], 25]) : $conditions;
|
||||
|
||||
$items = new ItemList($finalCnd, ['extraOpts' => $itemFilter->extraOpts]);
|
||||
$items->addGlobalsToJscript($smarty);
|
||||
|
||||
if ($items->error)
|
||||
continue;
|
||||
|
||||
$data = $items->getListviewData($infoMask);
|
||||
|
||||
if ($upgItemData)
|
||||
$data[$filter['upg']] = $upgItemData;
|
||||
|
||||
$tab = array(
|
||||
'data' => $data,
|
||||
'params' => $sharedLvParams
|
||||
);
|
||||
|
||||
if ($field)
|
||||
{
|
||||
$tab['params']['id'] = $group > 0 ? $field.'-'.$group : 'other';
|
||||
$tab['params']['name'] = $nameSource[$group];
|
||||
$tab['params']['tabs'] = '$tabsGroups';
|
||||
}
|
||||
|
||||
if (!empty($filter['fi']['setWeights']))
|
||||
{
|
||||
if ($items->hasSetFields(['armor']))
|
||||
$visibleCols[] = 'armor';
|
||||
}
|
||||
|
||||
// create note if search limit was exceeded; overwriting 'note' is intentional
|
||||
if ($items->getMatches() > CFG_SQL_LIMIT_DEFAULT && empty($filter['upg']) && !$field)
|
||||
{
|
||||
$tab['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsfound', $items->getMatches(), CFG_SQL_LIMIT_DEFAULT);
|
||||
$tab['params']['_truncated'] = 1;
|
||||
}
|
||||
else if ($field && $items->getMatches() > 25)
|
||||
{
|
||||
$tab['params']['_truncated'] = 1;
|
||||
|
||||
$addCr = [];
|
||||
if ($field == 'slot')
|
||||
{
|
||||
$note = 'lvnote_viewmoreslot';
|
||||
$override = ['sl' => $group, 'gb' => ''];
|
||||
}
|
||||
else if ($field == 'itemlevel')
|
||||
{
|
||||
$note = 'lvnote_viewmorelevel';
|
||||
$override = ['minle' => $group, 'maxle' => $group, 'gb' => ''];
|
||||
}
|
||||
else if ($field == 'source')
|
||||
{
|
||||
if ($_ = @$sourcesGlobalToItem[$group])
|
||||
{
|
||||
$note = 'lvnote_viewmoresource';
|
||||
$addCr = ['cr' => 128, 'crs' => $_, 'crv' => 0];
|
||||
}
|
||||
|
||||
$override = ['gb' => ''];
|
||||
}
|
||||
|
||||
$cls = isset($cats[0]) ? '='.$cats[0] : '';
|
||||
$filterUrl = $itemFilter->urlize($override, $addCr);
|
||||
|
||||
if ($note)
|
||||
$tab['params']['note'] = '$$WH.sprintf(LANG.'.$note.', \''.$cls.'\', \''.$filterUrl.'\')';
|
||||
}
|
||||
|
||||
if ($hiddenCols)
|
||||
$tab['params']['hiddenCols'] = '$'.json_encode($hiddenCols);
|
||||
|
||||
if ($visibleCols)
|
||||
$tab['params']['visibleCols'] = '$'.json_encode($visibleCols);
|
||||
|
||||
if ($field)
|
||||
$tab['params']['hideCount'] = '$1';
|
||||
|
||||
$pageData['lv']['tabs'][] = $tab;
|
||||
}
|
||||
|
||||
// whoops, we have no data? create emergency content
|
||||
if (!$pageData['lv']['tabs'])
|
||||
{
|
||||
$pageData['lv']['isGrouped'] = false;
|
||||
$pageData['lv']['tabs'][] = ['data' => [], 'params' => []];
|
||||
}
|
||||
|
||||
$smarty->saveCache($cacheKey, $pageData, $filter);
|
||||
}
|
||||
|
||||
@@ -636,7 +636,7 @@ function Profiler() {
|
||||
_divAuras.id = 'aura-container';
|
||||
_divAuras.style.cssFloat = 'left';
|
||||
_divAuras.style.marginLeft = '390px';
|
||||
_divAuras.style.width = '350px';
|
||||
_divAuras.style.width = '325px';
|
||||
_divAuras.style.display = 'none';
|
||||
|
||||
_ = $WH.ce('h3');
|
||||
|
||||
@@ -171,23 +171,21 @@
|
||||
{/foreach}
|
||||
//]]></script>
|
||||
|
||||
{if isset($lvData.data[0].params)}
|
||||
{if $lvData.isGrouped}
|
||||
<div id="tabs-generic"></div>
|
||||
{/if}
|
||||
<div id="lv-generic" class="listview"></div>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
{if !empty($gemScores)}var fi_gemScores = {$gemScores};{/if}
|
||||
|
||||
{if isset($lvData.data[0].params)}
|
||||
var tabsRelated = new Tabs({ldelim}parent: $WH.ge('tabs-generic'){rdelim});
|
||||
{foreach from=$tabs item="tab"}
|
||||
{if !empty($tab.data)}
|
||||
{include file="listviews/item.tpl" data=$tab.data params=$tab.params}
|
||||
{/if}
|
||||
{if $lvData.isGrouped}
|
||||
var tabsGroups = new Tabs({ldelim}parent: $WH.ge('tabs-generic'){rdelim});
|
||||
{/if}
|
||||
{foreach from=$lvData.tabs item="tab"}
|
||||
{include file="listviews/item.tpl" data=$tab.data params=$tab.params}
|
||||
{/foreach}
|
||||
tabsRelated.flush();
|
||||
{else}
|
||||
{include file='listviews/item.tpl' data=$lvData.data params=$lvData.params}
|
||||
{if $lvData.isGrouped}
|
||||
tabsGroups.flush();
|
||||
{/if}
|
||||
//]]></script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user