error(); if (!$smarty->loadCache($cacheKey, $pageData, $filter)) { $conditions = []; if ($cats) { $conditions[] = ['type', $cats[0]]; $path[] = $cats[0]; array_unshift($title, Lang::$npc['cat'][$cats[0]]); } $npcs = new CreatureList($conditions, true); // beast subtypes are selected via filter // recreate form selection $filter = array_merge($npcs->filterGetForm('form'), $filter); $filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL; $filter['fi'] = $npcs->filterGetForm(); if (isset($filter['fa'])) $path[] = $filter['fa']; // menuId 4: NPC g_initPath() // tabId 0: Database g_initHeader() $pageData = array( 'page' => array( 'petFamPanel' => ($cats && $cats[0] == 1), 'title' => implode(' - ', $title), 'path' => json_encode($path, JSON_NUMERIC_CHECK), 'tab' => 0, 'subCat' => $pageParam ? '='.$pageParam : '', 'reqJS' => array( 'template/js/filters.js' ) ), 'lv' => [] ); $lv = array( 'data' => $npcs->getListviewData(), // listview content 'params' => [] ); if (!empty($filter['fi']['extraCols'])) $lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; // create note if search limit was exceeded if ($npcs->getMatches() > SQL_LIMIT_DEFAULT) { $lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_npcsfound', $npcs->getMatches(), SQL_LIMIT_DEFAULT); $lv['params']['_truncated'] = 1; } if ($npcs->filterGetError()) $lv['params']['_errors'] = '$1'; $pageData['lv'] = $lv; $smarty->saveCache($cacheKey, $pageData); } // sort for dropdown-menus asort(Lang::$game['fa']); $smarty->updatePageVars($pageData['page']); $smarty->assign('filter', $filter); $smarty->assign('lang', array_merge(Lang::$main, Lang::$npc, Lang::$game, ['colon' => lang::$colon])); $smarty->assign('lvData', $pageData['lv']); // load the page $smarty->display('npcs.tpl'); ?>