search: initial implementation
currently searchable are: - classes - races - titles - currencies - items - itemsets - achievements directly or as &opensearch &json is yet to come, yes that means ?compare cant find any items
This commit is contained in:
parent
9019c3b811
commit
edd0ff5209
18 changed files with 985 additions and 492 deletions
50
includes/class.charclass.php
Normal file
50
includes/class.charclass.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
class CharClassList extends BaseType
|
||||
{
|
||||
protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_classes WHERE [cond] ORDER BY Id ASC';
|
||||
protected $matchQuery = 'SELECT COUNT(1) FROM ?_classes WHERE [cond]';
|
||||
|
||||
public function getListviewData()
|
||||
{
|
||||
$data = [];
|
||||
|
||||
while ($this->iterate())
|
||||
{
|
||||
$data[$this->Id] = array(
|
||||
'Id' => $this->Id,
|
||||
'name' => $this->names[$this->Id],
|
||||
'races' => $this->curTpl['raceMask'],
|
||||
'roles' => $this->curTpl['roles'],
|
||||
'weapon' => $this->curTpl['weaponTypeMask'],
|
||||
'armor' => $this->curTpl['armorTypeMask'],
|
||||
'power' => $this->curTpl['powerType'],
|
||||
);
|
||||
|
||||
if ($this->curTpl['expansion'] == 2) // todo: grr, move to db
|
||||
$data[$this->Id]['hero'] = 1;
|
||||
|
||||
if ($this->curTpl['expansion'])
|
||||
$data[$this->Id]['expansion'] = $this->curTpl['expansion'];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addGlobalsToJscript(&$refs)
|
||||
{
|
||||
if (!isset($refs['gClasses']))
|
||||
$refs['gClasses'] = [];
|
||||
|
||||
while ($this->iterate())
|
||||
$refs['gClasses'][$this->Id] = Util::jsEscape($this->names[$this->Id]);
|
||||
}
|
||||
|
||||
public function addRewardsToJScript(&$ref) { }
|
||||
public function renderTooltip() { }
|
||||
}
|
||||
|
||||
?>
|
||||
46
includes/class.charrace.php
Normal file
46
includes/class.charrace.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
class CharRaceList extends BaseType
|
||||
{
|
||||
protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_races WHERE [cond] ORDER BY Id ASC';
|
||||
protected $matchQuery = 'SELECT COUNT(1) FROM ?_races WHERE [cond]';
|
||||
|
||||
public function getListviewData()
|
||||
{
|
||||
$data = [];
|
||||
|
||||
while ($this->iterate())
|
||||
{
|
||||
$data[$this->Id] = array(
|
||||
'Id' => $this->Id,
|
||||
'name' => $this->names[$this->Id],
|
||||
'classes' => $this->curTpl['classMask'],
|
||||
'faction' => $this->curTpl['factionId'],
|
||||
'leader' => $this->curTpl['leader'],
|
||||
'zone' => $this->curTpl['startAreaId'],
|
||||
'side' => $this->curTpl['side']
|
||||
);
|
||||
|
||||
if ($this->curTpl['expansion'])
|
||||
$data[$this->Id]['expansion'] = $this->curTpl['expansion'];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addGlobalsToJscript(&$refs)
|
||||
{
|
||||
if (!isset($refs['gRaces']))
|
||||
$refs['gRaces'] = [];
|
||||
|
||||
$refs['gRaces'][$this->Id] = Util::jsEscape($this->names[$this->Id]);
|
||||
}
|
||||
|
||||
public function addRewardsToJScript(&$ref) { }
|
||||
public function renderTooltip() { }
|
||||
}
|
||||
|
||||
?>
|
||||
50
includes/class.currency.php
Normal file
50
includes/class.currency.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
class CurrencyList extends BaseType
|
||||
{
|
||||
protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_currencies WHERE [cond] ORDER BY Id ASC';
|
||||
protected $matchQuery = 'SELECT COUNT(1) FROM ?_currencies WHERE [cond]';
|
||||
|
||||
public function getListviewData()
|
||||
{
|
||||
$data = [];
|
||||
|
||||
while ($this->iterate())
|
||||
{
|
||||
$data[$this->Id] = array(
|
||||
'Id' => $this->Id,
|
||||
'category' => $this->curTpl['category'],
|
||||
'name' => $this->names[$this->Id],
|
||||
'icon' => $this->curTpl['iconString']
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addGlobalsToJscript(&$refs)
|
||||
{
|
||||
if (!isset($refs['gCurrencies']))
|
||||
$refs['gCurrencies'] = [];
|
||||
|
||||
$data = [];
|
||||
|
||||
while ($this->iterate())
|
||||
{
|
||||
$refs['gCurrencies'][$this->Id] = array(
|
||||
'name_'.User::$localeString => Util::jsEscape($this->names[$this->Id]),
|
||||
'icon' => $this->curTpl['iconString']
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addRewardsToJScript(&$ref) { }
|
||||
public function renderTooltip() { }
|
||||
}
|
||||
|
||||
?>
|
||||
94
includes/class.itemset.php
Normal file
94
includes/class.itemset.php
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
class ItemsetList extends BaseType
|
||||
{
|
||||
private $classes = []; // used to build g_classes
|
||||
public $pieces = []; // used to build g_items and search
|
||||
public $pieceToSet = [];
|
||||
|
||||
protected $setupQuery = 'SELECT *, Id AS ARRAY_KEY FROM ?_itemset WHERE [filter] [cond] ORDER BY maxlevel ASC';
|
||||
protected $matchQuery = 'SELECT COUNT(1) FROM ?_itemset WHERE [filter] [cond]';
|
||||
|
||||
public function __construct($data)
|
||||
{
|
||||
parent::__construct($data);
|
||||
|
||||
// post processing
|
||||
foreach ($this->templates as $this->curTpl)
|
||||
{
|
||||
$Id = $this->curTpl['Id'];
|
||||
|
||||
$this->templates[$Id]['classes'] = [];
|
||||
$this->templates[$Id]['pieces'] = [];
|
||||
|
||||
for ($i = 1; $i < 12; $i++)
|
||||
{
|
||||
if ($this->curTpl['classMask'] & (1 << $i))
|
||||
{
|
||||
$this->classes[] = $i + 1;
|
||||
$this->templates[$Id]['classes'][] = $i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 1; $i < 10; $i++)
|
||||
{
|
||||
if ($piece = $this->curTpl['item'.$i])
|
||||
{
|
||||
$this->pieces[] = $piece;
|
||||
$this->templates[$Id]['pieces'][] = $piece;
|
||||
$this->pieceToSet[$piece] = $this->Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->classes = array_unique($this->classes);
|
||||
$this->pieces = array_unique($this->pieces);
|
||||
$this->pieceToSet = array_unique($this->pieceToSet);
|
||||
|
||||
|
||||
// AAARG TODO!
|
||||
$this->curTpl = reset($this->templates); // restore 'iterator'
|
||||
}
|
||||
|
||||
public function getListviewData()
|
||||
{
|
||||
$data = [];
|
||||
|
||||
while ($this->iterate())
|
||||
{
|
||||
$data[$this->Id] = array(
|
||||
'Id' => $this->Id,
|
||||
'idbak' => $this->curTpl['refSetId'],
|
||||
'name' => $this->names[$this->Id],
|
||||
'quality' => 7 - $this->curTpl['quality'],
|
||||
'minlevel' => $this->curTpl['minLevel'],
|
||||
'maxlevel' => $this->curTpl['maxLevel'],
|
||||
'note' => $this->curTpl['contentGroup'],
|
||||
'type' => $this->curTpl['type'],
|
||||
'heroic' => $this->curTpl['heroic'] == 1, // we want to be bool
|
||||
'reqclass' => $this->curTpl['classMask'],
|
||||
'classes' => $this->curTpl['classes'],
|
||||
'pieces' => $this->curTpl['pieces']
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addGlobalsToJscript(&$refs)
|
||||
{
|
||||
if ($this->classes)
|
||||
(new CharClassList(array(['Id', $this->classes])))->addGlobalsToJscript($refs);
|
||||
|
||||
if ($this->pieces)
|
||||
(new ItemList(array(['i.entry', $this->pieces])))->addGlobalsToJscript($refs);
|
||||
}
|
||||
|
||||
public function addRewardsToJScript(&$ref) { }
|
||||
public function renderTooltip() { }
|
||||
}
|
||||
|
||||
?>
|
||||
18
index.php
18
index.php
|
|
@ -89,9 +89,9 @@ switch ($pageCall)
|
|||
User::writeCookie();
|
||||
header('Location: '.(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '.'));
|
||||
break;
|
||||
case 'search': // tool: quick search
|
||||
case 'data': // dataset-loader
|
||||
require $pageCall.'.php';
|
||||
case 'data': // tool: dataset-loader
|
||||
case 'search': // tool: searches
|
||||
include $pageCall.'.php';
|
||||
break;
|
||||
/* other */
|
||||
case '': // no parameter given -> MainPage
|
||||
|
|
@ -107,18 +107,18 @@ switch ($pageCall)
|
|||
case 'random':
|
||||
require 'pages/miscTools.php';
|
||||
break;
|
||||
case 'build':
|
||||
if (User::isInGroup(U_GROUP_EMPLOYEE))
|
||||
{
|
||||
require 'setup/tools/dataset-assembler/'.$pageParam.'.php';
|
||||
break;
|
||||
}
|
||||
case 'setup':
|
||||
if (User::isInGroup(U_GROUP_EMPLOYEE))
|
||||
{
|
||||
require 'setup/syncronize.php';
|
||||
break;
|
||||
}
|
||||
case 'build':
|
||||
if (User::isInGroup(U_GROUP_EMPLOYEE) && !empty($pageParam))
|
||||
{
|
||||
require 'setup/tools/dataset-assembler/'.$pageParam.'.php';
|
||||
break;
|
||||
}
|
||||
default: // unk parameter given -> ErrorPage
|
||||
if (isset($_GET['power']))
|
||||
die('$WowheadPower.register(0, '.User::$localeId.', {})');
|
||||
|
|
|
|||
273
opensearch.php
273
opensearch.php
|
|
@ -1,273 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('invalid access');
|
||||
|
||||
/* Types
|
||||
Type 1 => NPC
|
||||
Type 2 => GameObject
|
||||
Type 3 => Items
|
||||
Type 4 => Item Sets
|
||||
Type 5 => Quests
|
||||
Type 6 => Spells
|
||||
Type 7 => Zones
|
||||
Type 8 => Factions
|
||||
Type 9 => Pets
|
||||
Type 10 => Achievement
|
||||
Type 11 => Title
|
||||
Type 12 => Event
|
||||
Type 13 => Class
|
||||
Type 14 => Race
|
||||
Type 15 => Skill
|
||||
Type 17 => Currency
|
||||
*/
|
||||
|
||||
// Ajax can't handle debug, force to false
|
||||
$AoWoWconf['debug'] = false;
|
||||
|
||||
header("Content-type: text/javascript");
|
||||
|
||||
// Receives requests from at least 3 characters (although vovhede and 1 character)
|
||||
$_query = Util::sqlEscape($_GET['search']);
|
||||
$_type = isset($_GET['type']) ? (1 << intVal($_GET['type'])) : 0xFFFF;
|
||||
|
||||
if (strlen($_query) < 3)
|
||||
exit('["", []]');
|
||||
|
||||
echo "[\"".str_replace('"', '\"', $_query)."\", [\n";
|
||||
|
||||
// Item Comparison search
|
||||
$foundItems = [];
|
||||
$foundSets = [];
|
||||
$pieceAssoc = [];
|
||||
if ($_type & 0x10) {
|
||||
|
||||
$rows = DB::Aowow()->Select('
|
||||
SELECT
|
||||
id,
|
||||
refSetId as idbak,
|
||||
CONCAT(7 - quality, ?#) as name,
|
||||
minlevel,
|
||||
maxlevel,
|
||||
contentGroup as note,
|
||||
type,
|
||||
IF(heroic=1, "true", "false") as heroic,
|
||||
classMask as reqclass,
|
||||
item1, item2, item3, item4, item5,
|
||||
item6, item7, item8, item9, item10
|
||||
FROM
|
||||
?_itemset
|
||||
WHERE
|
||||
?# LIKE ?s;',
|
||||
'name_loc'.User::$localeId,
|
||||
'name_loc'.User::$localeId,
|
||||
'%'.$_query.'%'
|
||||
);
|
||||
|
||||
// parse items, create class-array
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$row['pieces'] = [];
|
||||
for ($i=1; $i<=10; $i++)
|
||||
{
|
||||
if ($row['item'.$i])
|
||||
{
|
||||
$foundItems[] = $row['item'.$i];
|
||||
$row['pieces'][] = $row['item'.$i];
|
||||
$pieceAssoc[$row['item'.$i]] = $row['id'];
|
||||
unset($row['item'.$i]);
|
||||
}
|
||||
}
|
||||
$row['classes'] = [];
|
||||
for ($i = 1; $i < 12; $i++)
|
||||
if ($row['reqclass'] & (1 << $i))
|
||||
$row['classes'][] = $i + 1;
|
||||
|
||||
unset($row['classMask']);
|
||||
$foundSets[] = $row;
|
||||
}
|
||||
}
|
||||
if ($_type & 0x18) { // 3 | 4
|
||||
$conditions = array(
|
||||
array('i.class', [2, 4]),
|
||||
empty($foundItems) ? array(User::$localeId ? 'name_loc'.User::$localeId : 'name', $_query) : array('i.entry', $foundItems)
|
||||
);
|
||||
$iList = new ItemList($conditions);
|
||||
|
||||
$items = [];
|
||||
while ($iList->iterate())
|
||||
{
|
||||
$iList->extendJsonStats($pieceAssoc);
|
||||
|
||||
$stats = [];
|
||||
foreach ($iList->json[$iList->Id] as $k => $v)
|
||||
{
|
||||
if (!$v && $k != 'classs' && $k != 'subclass')
|
||||
continue;
|
||||
|
||||
$stats[] = is_numeric($v) || $v[0] == "{" ? '"'.$k.'":'.$v.'' : '"'.$k.'":"'.$v.'"';
|
||||
}
|
||||
|
||||
foreach ($iList->itemMods[$iList->Id] as $k => $v)
|
||||
$stats[] = '"'.Util::$itemMods[$k].'":'.$v.'';
|
||||
|
||||
$items[$iList->Id] = "\t{".implode(',', $stats)."}";
|
||||
}
|
||||
echo implode(",\n", $items)."\n],[\n";
|
||||
|
||||
$i = 0;
|
||||
foreach ($foundSets as $single)
|
||||
{
|
||||
$set = [];
|
||||
foreach ($single as $key => $value)
|
||||
{
|
||||
if ((is_numeric($value) && $value == 0) || $value === "false")
|
||||
continue;
|
||||
|
||||
if (is_array($value))
|
||||
$value = "[".implode(',',$value)."]";
|
||||
|
||||
$set[] = is_numeric($value) || $value[0] == "[" ? '"'.$key.'":'.str_replace('"', '\"', $value).'' : '"'.$key.'":"'.str_replace('"', '\"', $value).'"';
|
||||
}
|
||||
echo "\t{".implode(',', $set)."}";
|
||||
echo ($i < count($foundSets) - 1) ? ",\n" : "\n";
|
||||
$i++;
|
||||
}
|
||||
echo "]]";
|
||||
exit();
|
||||
}
|
||||
/*
|
||||
// Ищем вещи:
|
||||
|
||||
$rows = $DB->select('
|
||||
SELECT i.entry, ?# as name, a.iconname, i.quality
|
||||
FROM ?_icons a, item_template i{, ?# l}
|
||||
WHERE
|
||||
?# LIKE ?
|
||||
AND a.id = i.displayid
|
||||
{ AND i.entry = l.?# }
|
||||
ORDER BY i.quality DESC, ?#
|
||||
LIMIT 3
|
||||
',
|
||||
User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId, // SELECT
|
||||
User::$localeId == 0 ? DBSIMPLE_SKIP : 'locales_item', // FROM
|
||||
User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId, // WHERE1
|
||||
$_query,
|
||||
User::$localeId == 0 ? DBSIMPLE_SKIP : 'entry', // WHERE2
|
||||
User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId // ORDER
|
||||
);
|
||||
|
||||
foreach($rows as $i => $row)
|
||||
$found[$row['name'].' (Item)'] = array(
|
||||
'type' => 3,
|
||||
'entry' => $row['entry'],
|
||||
'iconname' => $row['iconname'],
|
||||
'quality' => $row['quality']
|
||||
);
|
||||
|
||||
// Ищем объекты:
|
||||
$rows = $DB->select('
|
||||
SELECT entry, ?# as name
|
||||
FROM ?#
|
||||
WHERE ?# LIKE ?
|
||||
ORDER BY ?#
|
||||
LIMIT 3
|
||||
',
|
||||
User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId, // SELECT
|
||||
User::$localeId == 0 ? 'gameobject_template' : 'locales_gameobject', // FROM
|
||||
User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId, // WHERE1
|
||||
$_query,
|
||||
User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId // ORDER
|
||||
);
|
||||
|
||||
foreach($rows as $i => $row)
|
||||
$found[$row['name'].' (Object)'] = array(
|
||||
'type' => 2,
|
||||
'entry'=>$row['entry'],
|
||||
);
|
||||
|
||||
// Ищем квесты:
|
||||
$rows = $DB->select('
|
||||
SELECT q.entry, ?# as Title, q.RequiredRaces
|
||||
FROM quest_template q {, ?# l}
|
||||
WHERE
|
||||
(?# LIKE ?)
|
||||
{AND (q.entry=l.?#)}
|
||||
ORDER BY ?#
|
||||
LIMIT 3
|
||||
',
|
||||
User::$localeId == 0 ? 'Title' : 'Title_loc'.User::$localeId, // SELECT
|
||||
User::$localeId == 0 ? DBSIMPLE_SKIP : 'locales_quest', // FROM
|
||||
User::$localeId == 0 ? 'Title' : 'Title_loc'.User::$localeId, // WHERE1
|
||||
$_query,
|
||||
User::$localeId == 0 ? DBSIMPLE_SKIP : 'entry', // WHERE2
|
||||
User::$localeId == 0 ? 'Title' : 'Title_loc'.User::$localeId // ORDER
|
||||
);
|
||||
|
||||
foreach($rows as $i => $row)
|
||||
$found[$row['Title'].' (Quest)'] = array(
|
||||
'type' => 5,
|
||||
'entry'=> $row['entry'],
|
||||
'side' => factionByRaceMask($row['RequiredRaces'])
|
||||
);
|
||||
|
||||
// Ищем creature:
|
||||
$rows = $DB->select('
|
||||
SELECT entry, ?# as name
|
||||
FROM ?#
|
||||
WHERE ?# LIKE ?
|
||||
ORDER BY ?#
|
||||
LIMIT 3
|
||||
',
|
||||
User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId, // SELECT
|
||||
User::$localeId == 0 ? 'creature_template' : 'locales_creature', // FROM
|
||||
User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId, // WHERE1
|
||||
$_query,
|
||||
User::$localeId == 0 ? 'name' : 'name_loc'.User::$localeId // ORDER
|
||||
);
|
||||
|
||||
foreach($rows as $i => $row)
|
||||
$found[$row['name'].' (NPC)'] = array(
|
||||
'type' => 1,
|
||||
'entry' => $row['entry']
|
||||
);
|
||||
|
||||
// Если ничего не найдено...
|
||||
if(!isset($found))
|
||||
{
|
||||
echo ']]';
|
||||
exit;
|
||||
}
|
||||
|
||||
//ksort($found);
|
||||
|
||||
$found = array_slice($found, 0, 10);
|
||||
|
||||
$i=0;
|
||||
foreach($found as $name => $fitem)
|
||||
{
|
||||
echo '"'.str_replace('"', '\"', $name).'"';
|
||||
if($i<count($found)-1)
|
||||
echo ', ';
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo '], [], [], [], [], [], [';
|
||||
|
||||
$i=0;
|
||||
foreach($found as $name => $fitem)
|
||||
{
|
||||
echo '['.$fitem['type'].', '.$fitem['entry'];
|
||||
if(isset($fitem['iconname'])) echo ', "'.$fitem['iconname'].'"';
|
||||
if(isset($fitem['quality'])) echo ", ".$fitem['quality'];
|
||||
if(isset($fitem['side'])) echo ", ".$fitem['side'];
|
||||
echo ']';
|
||||
if($i<count($found)-1)
|
||||
echo ', ';
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo ']]';
|
||||
*/
|
||||
?>
|
||||
610
search.php
610
search.php
|
|
@ -1,9 +1,13 @@
|
|||
<?php
|
||||
/*
|
||||
FETTES ToDo: suchen vereinen und aufräumen!
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('invalid access');
|
||||
|
||||
Util::execTime(true);
|
||||
|
||||
/*
|
||||
if &json
|
||||
=> suche ausm compare heraus (profiler evtl auch noch)
|
||||
=> search by compare or profiler
|
||||
else if &opensearch
|
||||
=> suche aus der suchbox oben rechts, bzw Startseite
|
||||
array:[
|
||||
|
|
@ -14,219 +18,411 @@
|
|||
[], // unused
|
||||
[], // unused
|
||||
[], // unused
|
||||
str[10][4] // type, typeId, param1 (4:quality, 3,6,9,10:icon, 5:faction), param2 (3:quality, 6:rank)
|
||||
str[10][4] // type, typeId, param1 (4:quality, 3,6,9,10,17:icon, 5:faction), param2 (3:quality, 6:rank)
|
||||
]
|
||||
else
|
||||
=> Sucheseite über Template
|
||||
|
||||
1: Listview - template: 'classs', id: 'classes', name: LANG.tab_classes,
|
||||
2: Listview - template: 'race', id: 'races', name: LANG.tab_races,
|
||||
3: Listview - template: 'title', id: 'titles', name: LANG.tab_titles,
|
||||
4: Listview - template: 'holiday', id: 'holidays', name: LANG.tab_holidays,
|
||||
5: Listview - template: 'currency', id: 'currencies', name: LANG.tab_currencies,
|
||||
6: Listview - template: 'itemset', id: 'itemsets', name: LANG.tab_itemsets,
|
||||
7: Listview - template: 'item', id: 'items', name: LANG.tab_items,
|
||||
8: Listview - template: 'spell', id: 'abilities', name: LANG.tab_abilities, visibleCols: ['level', 'schools'],
|
||||
9: Listview - template: 'spell', id: 'talents', name: LANG.tab_talents, visibleCols: ['level', 'schools'], hiddenCols: ['reagents'],
|
||||
10: Listview - template: 'spell', id: 'glyphs', name: LANG.tab_glyphs, visibleCols: ['singleclass', 'glyphtype'], hiddenCols: ['reagents', 'skill', 'level'],
|
||||
11: Listview - template: 'spell', id: 'proficiencies', name: LANG.tab_proficiencies, visibleCols: ['classes'], hiddenCols: ['reagents', 'skill'],
|
||||
12: Listview - template: 'spell', id: 'professions', name: LANG.tab_professions, visibleCols: ['source'],
|
||||
13: Listview - template: 'spell', id: 'companions', name: LANG.tab_companions, visibleCols: ['reagents'], hiddenCols: ['level', 'skill'],
|
||||
14: Listview - template: 'spell', id: 'mounts', name: LANG.tab_mounts, visibleCols: ['reagents'], hiddenCols: ['level', 'skill'],
|
||||
15: Listview - template: 'npc', id: 'npcs', name: LANG.tab_npcs,
|
||||
16: Listview - template: 'quest', id: 'quests', name: LANG.tab_quests,
|
||||
17: Listview - template: 'achievement', id: 'achievements', name: LANG.tab_achievements, visibleCols: ['category'],
|
||||
18: Listview - template: 'zone', id: 'zones', name: LANG.tab_zones,
|
||||
19: Listview - template: 'object', id: 'objects', name: LANG.tab_objects,
|
||||
20: Listview - template: 'faction', id: 'factions', name: LANG.tab_factions,
|
||||
21: Listview - template: 'skill', id: 'skills', name: LANG.tab_skills, hiddenCols: ['reagents', 'skill'],
|
||||
22: Listview - template: 'pet', id: 'pets', name: LANG.tab_pets,
|
||||
23: Listview - template: 'spell', id: 'npc-abilities', name: LANG.tab_npcabilities, visibleCols: ['level'], hiddenCols: ['reagents', 'skill'],
|
||||
24: Listview - template: 'spell', id: 'spells', name: LANG.tab_uncategorizedspells, visibleCols: ['level'], hiddenCols: ['reagents', 'skill'],
|
||||
25: Listview - template: 'profile', id: 'characters', name: LANG.tab_characters, visibleCols: ['race','classs','level','talents','gearscore','achievementpoints'],
|
||||
26: Guilds..?
|
||||
*/
|
||||
|
||||
if (isset($_GET['opensearch']) || isset($_GET['json']))
|
||||
$search = urlDecode(trim($pageParam));
|
||||
$query = Util::sqlEscape(str_replace('?', '_', str_replace('*', '%', ($search))));
|
||||
$type = @intVal($_GET['type']);
|
||||
$searchMask = 0x0;
|
||||
$found = [];
|
||||
$jsGlobals = [];
|
||||
|
||||
if (isset($_GET['json']))
|
||||
{
|
||||
require 'opensearch.php';
|
||||
die();
|
||||
}
|
||||
|
||||
// Необходима функция iteminfo
|
||||
require 'includes/game.php';
|
||||
require 'includes/allspells.php';
|
||||
require 'includes/allquests.php';
|
||||
require 'includes/allitems.php';
|
||||
require 'includes/allnpcs.php';
|
||||
require 'includes/allobjects.php';
|
||||
|
||||
// Настраиваем Smarty ;)
|
||||
$smarty->config_load($conf_file, 'search');
|
||||
|
||||
// Строка поиска:
|
||||
$search = urldecode($pageParam);
|
||||
$nsearch = '%'.$search.'%';
|
||||
$smarty->assign('search', $search);
|
||||
|
||||
// Подключаемся к ДБ
|
||||
global $DB;
|
||||
global $allitems;
|
||||
global $allspells;
|
||||
|
||||
global $npc_cols;
|
||||
global $spell_cols;
|
||||
|
||||
// Массив всего найденного
|
||||
$found = [];
|
||||
|
||||
// Ищем вещи:
|
||||
if($_SESSION['locale']>0)
|
||||
{
|
||||
$m = $DB->selectCol('
|
||||
SELECT entry
|
||||
FROM locales_item
|
||||
WHERE name_loc?d LIKE ?
|
||||
',
|
||||
$_SESSION['locale'],
|
||||
$nsearch
|
||||
);
|
||||
}
|
||||
|
||||
$rows = $DB->select('
|
||||
SELECT i.?#
|
||||
{, l.name_loc?d AS `name_loc`}
|
||||
FROM ?_icons a, item_template i
|
||||
{LEFT JOIN (locales_item l) ON l.entry=i.entry AND ?d}
|
||||
WHERE
|
||||
(i.name LIKE ? {OR i.entry IN (?a)})
|
||||
AND a.id = i.displayid;
|
||||
',
|
||||
$item_cols[3],
|
||||
($m)? $_SESSION['locale']: DBSIMPLE_SKIP,
|
||||
($m)? 1: DBSIMPLE_SKIP,
|
||||
$nsearch,
|
||||
($m)? $m: DBSIMPLE_SKIP
|
||||
);
|
||||
unset($m);
|
||||
foreach($rows as $row)
|
||||
$found['item'][] = iteminfo2($row);
|
||||
|
||||
// Ищем NPC:
|
||||
if($_SESSION['locale']>0)
|
||||
{
|
||||
$m = $DB->selectCol('
|
||||
SELECT entry
|
||||
FROM locales_creature
|
||||
WHERE
|
||||
name_loc?d LIKE ?
|
||||
OR subname_loc?d LIKE ?
|
||||
',
|
||||
$_SESSION['locale'], $nsearch,
|
||||
$_SESSION['locale'], $nsearch
|
||||
);
|
||||
}
|
||||
$rows = $DB->select('
|
||||
SELECT ?#, c.entry
|
||||
{, l.name_loc?d AS `name_loc`,
|
||||
l.subname_loc'.$_SESSION['locale'].' AS `subname_loc`}
|
||||
FROM ?_factiontemplate, creature_template c
|
||||
{LEFT JOIN (locales_creature l) ON l.entry=c.entry AND ?d}
|
||||
WHERE
|
||||
(name LIKE ?
|
||||
OR subname LIKE ?
|
||||
{OR c.entry IN (?a)})
|
||||
AND factiontemplateID=faction_A
|
||||
',
|
||||
$npc_cols[0],
|
||||
($m)? $_SESSION['locale']: DBSIMPLE_SKIP,
|
||||
($m)? 1: DBSIMPLE_SKIP,
|
||||
$nsearch, $nsearch,
|
||||
($m)? $m: DBSIMPLE_SKIP
|
||||
);
|
||||
unset($m);
|
||||
foreach($rows as $row)
|
||||
$found['npc'][] = creatureinfo2($row);
|
||||
|
||||
// Ищем объекты
|
||||
if($_SESSION['locale']>0)
|
||||
{
|
||||
$m = $DB->selectCol('
|
||||
SELECT entry
|
||||
FROM locales_gameobject
|
||||
WHERE
|
||||
name_loc?d LIKE ?
|
||||
',
|
||||
$_SESSION['locale'], $nsearch
|
||||
);
|
||||
}
|
||||
$rows = $DB->select('
|
||||
SELECT g.?#
|
||||
{, l.name_loc?d AS `name_loc`}
|
||||
FROM gameobject_template g
|
||||
{LEFT JOIN (locales_gameobject l) ON l.entry=g.entry AND ?d}
|
||||
WHERE name LIKE ? {OR g.entry IN (?a)}
|
||||
',
|
||||
$object_cols[0],
|
||||
($m)? $_SESSION['locale']: DBSIMPLE_SKIP,
|
||||
($m)? 1: DBSIMPLE_SKIP,
|
||||
$nsearch,
|
||||
($m)? $m: DBSIMPLE_SKIP
|
||||
);
|
||||
unset($m);
|
||||
foreach($rows as $row)
|
||||
$found['object'][] = objectinfo2($row);
|
||||
|
||||
// Ищем квесты
|
||||
if($_SESSION['locale']>0)
|
||||
{
|
||||
$m = $DB->selectCol('
|
||||
SELECT entry
|
||||
FROM locales_quest
|
||||
WHERE
|
||||
Title_loc?d LIKE ?
|
||||
',
|
||||
$_SESSION['locale'], $nsearch
|
||||
);
|
||||
}
|
||||
$rows = $DB->select('
|
||||
SELECT *
|
||||
{, l.Title_loc?d AS `Title_loc`}
|
||||
FROM quest_template q
|
||||
{LEFT JOIN (locales_quest l) ON l.entry=q.entry AND ?d}
|
||||
WHERE Title LIKE ? {OR q.entry IN (?a)}
|
||||
',
|
||||
($m)? $_SESSION['locale']: DBSIMPLE_SKIP,
|
||||
($m)? 1: DBSIMPLE_SKIP,
|
||||
$nsearch,
|
||||
($m)? $m: DBSIMPLE_SKIP
|
||||
);
|
||||
unset($m);
|
||||
foreach($rows as $row)
|
||||
$found['quest'][] = GetQuestInfo($row, 0xFFFFFF);
|
||||
|
||||
// Ищем наборы вещей
|
||||
$rows = $DB->select('
|
||||
SELECT *
|
||||
FROM ?_itemset
|
||||
WHERE name_loc'.$_SESSION['locale'].' LIKE ?
|
||||
',
|
||||
$nsearch
|
||||
);
|
||||
foreach($rows as $row)
|
||||
$found['itemset'][] = itemsetinfo2($row);
|
||||
|
||||
// Ищем спеллы
|
||||
$rows = $DB->select('
|
||||
SELECT ?#, spellID
|
||||
FROM ?_spell s, ?_spellicons i
|
||||
WHERE
|
||||
s.spellname_loc'.$_SESSION['locale'].' like ?
|
||||
AND i.id = s.spellicon
|
||||
',
|
||||
$spell_cols[2],
|
||||
$nsearch
|
||||
);
|
||||
foreach($rows as $row)
|
||||
$found['spell'][] = spellinfo2($row);
|
||||
|
||||
$keys = array_keys($found);
|
||||
|
||||
// Если найден один элемент - перенаправляем на него
|
||||
if(count($found) == 1 && count($found[$keys[0]]) == 1)
|
||||
{
|
||||
header("Location: ?".$keys[0].'='.$found[$keys[0]][0]['entry']);
|
||||
if ($type == TYPE_ITEMSET)
|
||||
$searchMask |= SEARCH_TYPE_JSON | 0x60;
|
||||
else if ($type == TYPE_ITEM)
|
||||
$searchMask |= SEARCH_TYPE_JSON | 0x40;
|
||||
}
|
||||
else if (isset($_GET['opensearch']))
|
||||
$searchMask |= SEARCH_TYPE_OPEN | SEARCH_MASK_OPEN;
|
||||
else
|
||||
$searchMask |= SEARCH_TYPE_REGULAR | SEARCH_MASK_ALL;
|
||||
|
||||
$cacheKey = implode('_', [CACHETYPE_SEARCH, $searchMask, sha1($query), User::$localeId]);
|
||||
|
||||
// invalid conditions: not enough characters to search OR no types to search
|
||||
if (strlen($query) < 3 || !($searchMask & SEARCH_MASK_ALL))
|
||||
{
|
||||
$smarty->assign('found', $found);
|
||||
if ($searchMask & SEARCH_TYPE_REGULAR)
|
||||
{
|
||||
// empty queries go home
|
||||
if (!$query)
|
||||
header("Location:?");
|
||||
|
||||
// Параметры страницы
|
||||
$page = [];
|
||||
// Номер вкладки меню
|
||||
$page['tab'] = 0;
|
||||
// Заголовок страницы
|
||||
$page['Title'] = $search.' - '.$smarty->get_config_vars('Search');
|
||||
$smarty->assign('page', $page);
|
||||
// insufficient queries throw an error
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$search));
|
||||
$smarty->assign('found', []);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->assign('search', $query);
|
||||
|
||||
$smarty->assign('mysql', $DB->getStatistics());
|
||||
$smarty->assign('search', $search);
|
||||
|
||||
$smarty->display('search.tpl');
|
||||
$smarty->display('search.tpl');
|
||||
die();
|
||||
}
|
||||
else if ($searchMask & SEARCH_TYPE_OPEN)
|
||||
{
|
||||
header("Content-type: text/javascript");
|
||||
exit('["'.Util::jsEscape($query).'", []]');
|
||||
}
|
||||
else /* if ($searchMask & SEARCH_TYPE_JSON) */
|
||||
{
|
||||
header("Content-type: text/javascript");
|
||||
exit ("[\"".Util::jsEscape($query)."\", [\n],[\n]]\n");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
// 1 Classes:
|
||||
if ($searchMask & 0x1)
|
||||
{
|
||||
/* custom data :(
|
||||
armor: build manually - ItemSubClassMask (+Shield +Relics)
|
||||
weapon: build manually - ItemSubClassMask
|
||||
roles: build manually - 1:heal; 2:mleDPS; 4:rngDPS; 8:tank
|
||||
*/
|
||||
$classes = new CharClassList(array(['name_loc'.User::$localeId, $query]));
|
||||
|
||||
if ($data = $classes->getListviewData())
|
||||
{
|
||||
while ($classes->iterate())
|
||||
$data[$classes->Id]['param1'] = '"class_'.strToLower($classes->getField('fileString')).'"';
|
||||
|
||||
$found['class'] = array(
|
||||
'type' => TYPE_CLASS,
|
||||
'appendix' => ' (Class)',
|
||||
'data' => $data,
|
||||
'params' => ['tabs' => '$myTabs']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 2 Races:
|
||||
if ($searchMask & 0x2)
|
||||
{
|
||||
/* custom data :(
|
||||
faction: dbc-data is internal -> doesn't work how to link to displayable faction..?
|
||||
leader: 29611 for human .. DAFUQ?!
|
||||
zone: starting zone...
|
||||
*/
|
||||
|
||||
$races = new CharRaceList(array(['name_loc'.User::$localeId, $query]));
|
||||
|
||||
if ($data = $races->getListviewData())
|
||||
{
|
||||
while ($races->iterate())
|
||||
$data[$races->Id]['param1'] = '"race_'.strToLower($races->getField('fileString')).'_male"';
|
||||
|
||||
$found['race'] = array(
|
||||
'type' => TYPE_RACE,
|
||||
'appendix' => ' (Race)',
|
||||
'data' => $data,
|
||||
'params' => ['tabs' => '$myTabs']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 3 Titles:
|
||||
if ($searchMask & 0x4)
|
||||
{
|
||||
/* custom data :(
|
||||
category:1, // custom data .. FU!
|
||||
expansion:0, // custom data .. FU FU!
|
||||
gender:3, // again.. luckiely 136; 137 only
|
||||
side:2, // hmm, derive from source..?
|
||||
source: {} // g_sources .. holy cow.. that will cost some nerves
|
||||
*/
|
||||
|
||||
$sources = array(
|
||||
4 => [], // Quest
|
||||
12 => [], // Achievement
|
||||
13 => [] // DB-Text
|
||||
);
|
||||
|
||||
$conditions = array(
|
||||
'OR',
|
||||
['male_loc'.User::$localeId, $query],
|
||||
['female_loc'.User::$localeId, $query]
|
||||
);
|
||||
|
||||
$titles = new TitleList($conditions);
|
||||
$data = $titles->getListviewData();
|
||||
|
||||
if (!empty($data))
|
||||
{
|
||||
$found['title'] = array(
|
||||
'type' => TYPE_TITLE,
|
||||
'appendix' => ' (Title)',
|
||||
'data' => $data,
|
||||
'params' => ['tabs' => '$myTabs']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 4 World Events:
|
||||
// if ($searchMask & 0x8)
|
||||
{
|
||||
// /* custom data :(
|
||||
// */
|
||||
|
||||
// $wEvents = new WorldEventList(array(['name_loc'.User::$localeId, $query]));
|
||||
|
||||
// if (!empty($data))
|
||||
// {
|
||||
// $found[] = array(
|
||||
// 'type' => TYPE_WORLDEVENT,
|
||||
// 'appendix' => ' (World Event)',
|
||||
// 'data' => $data
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
// 5 Currencies
|
||||
if ($searchMask & 0x10)
|
||||
{
|
||||
$money = new CurrencyList(array(['name_loc'.User::$localeId, $query]));
|
||||
|
||||
if ($data = $money->getListviewData())
|
||||
{
|
||||
while ($money->iterate())
|
||||
$data[$money->Id]['param1'] = strToLower($money->getField('iconString'));
|
||||
|
||||
$found['currency'] = array(
|
||||
'type' => TYPE_CURRENCY,
|
||||
'appendix' => ' (Currency)',
|
||||
'data' => $data,
|
||||
'params' => ['tabs' => '$myTabs']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 6 Itemsets
|
||||
if ($searchMask & 0x20)
|
||||
{
|
||||
$sets = new ItemsetList(array(['name_loc'.User::$localeId, $query]));
|
||||
$sets->addGlobalsToJscript($jsGlobals);
|
||||
|
||||
if ($data = $sets->getListviewData())
|
||||
{
|
||||
while ($sets->iterate())
|
||||
$data[$sets->Id]['param1'] = $sets->getField('quality');
|
||||
|
||||
$found['itemset'] = array(
|
||||
'type' => TYPE_ITEMSET,
|
||||
'appendix' => ' (Item Set)',
|
||||
'data' => $data,
|
||||
'params' => ['tabs' => '$myTabs'],
|
||||
'pieces' => $sets->pieces
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 7 Items
|
||||
if ($searchMask & 0x40)
|
||||
{
|
||||
if (($searchMask & SEARCH_TYPE_JSON) && $type == TYPE_ITEMSET && $found['itemset']['pieces'])
|
||||
$conditions = [['i.class', [2, 4]], ['i.entry', $foundItems]];
|
||||
else
|
||||
$conditions = [[User::$localeId ? 'name_loc'.User::$localeId : 'name', $query], 0];
|
||||
$items = new ItemList($conditions);
|
||||
$items->addGlobalsToJscript($jsGlobals);
|
||||
|
||||
if ($data = $items->getListviewData($searchMask & SEARCH_TYPE_JSON ? ITEMINFO_SUBITEMS : 0))
|
||||
{
|
||||
while ($items->iterate())
|
||||
{
|
||||
$data[$items->Id]['param1'] = '"'.$items->getField('icon').'"';
|
||||
$data[$items->Id]['param2'] = $items->getField('Quality');
|
||||
}
|
||||
|
||||
$found['item'] = array(
|
||||
'type' => TYPE_ITEM,
|
||||
'appendix' => ' (Item)',
|
||||
'params' => ['tabs' => '$myTabs'],
|
||||
'data' => $data,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 8 Abilities
|
||||
// if ($searchMask & 0x80)
|
||||
|
||||
// 9 Talents
|
||||
// if ($searchMask & 0x100)
|
||||
|
||||
// 10 Glyphs
|
||||
// if ($searchMask & 0x200)
|
||||
|
||||
// 11 Proficiencies
|
||||
// if ($searchMask & 0x400)
|
||||
|
||||
// 12 Professions
|
||||
// if ($searchMask & 0x800)
|
||||
|
||||
// 13 Companions
|
||||
// if ($searchMask & 0x1000)
|
||||
|
||||
// 14 Mounts
|
||||
// if ($searchMask & 0x2000)
|
||||
|
||||
// 15 NPCs
|
||||
// if ($searchMask & 0x4000)
|
||||
|
||||
// 16 Quests
|
||||
// if ($searchMask & 0x8000)
|
||||
|
||||
// 17 Achievements
|
||||
if ($searchMask & 0x10000)
|
||||
{
|
||||
$acvs = new AchievementList(array(['name_loc'.User::$localeId, $query]));
|
||||
|
||||
if ($data = $acvs->getListviewData())
|
||||
{
|
||||
$acvs->addGlobalsToJScript($jsGlobals);
|
||||
$acvs->addRewardsToJScript($jsGlobals);
|
||||
|
||||
$found['achievement'] = array(
|
||||
'type' => TYPE_ACHIEVEMENT,
|
||||
'appendix' => ' (Achievement)',
|
||||
'data' => $data,
|
||||
'params' => [
|
||||
'tabs' => '$myTabs',
|
||||
'visibleCols' => '$[\'category\']'
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 18 Zones
|
||||
// if ($searchMask & 0x20000)
|
||||
|
||||
// 19 Objects
|
||||
// if ($searchMask & 0x40000)
|
||||
|
||||
// 20 Factions
|
||||
// if ($searchMask & 0x80000)
|
||||
|
||||
// 21 Skills
|
||||
// if ($searchMask & 0x100000)
|
||||
|
||||
// 22 Pets
|
||||
// if ($searchMask & 0x200000)
|
||||
|
||||
// 23 NPCAbilities
|
||||
// if ($searchMask & 0x400000)
|
||||
|
||||
// 24 Spells (Misc)
|
||||
// if ($searchMask & 0x800000)
|
||||
|
||||
// 25 Characters
|
||||
// if ($searchMask & 0x1000000)
|
||||
|
||||
// 26 Guilds
|
||||
// if ($searchMask & 0x2000000)
|
||||
|
||||
|
||||
if ($searchMask & SEARCH_TYPE_JSON)
|
||||
{
|
||||
header("Content-type: text/javascript");
|
||||
echo "/* not yet supported */\n";
|
||||
exit ("[\"".Util::jsEscape($query)."\", [\n],[\n]]\n");
|
||||
}
|
||||
else if ($searchMask & SEARCH_TYPE_OPEN)
|
||||
{
|
||||
// this one is funny: we want 10 results, ideally equally destributed over each type
|
||||
$foundTotal = 0;
|
||||
$maxResults = 10;
|
||||
$names = [];
|
||||
$info = [];
|
||||
|
||||
foreach ($found as $tmp)
|
||||
$foundTotal += count($tmp['data']);
|
||||
|
||||
if (!$foundTotal)
|
||||
exit('["'.Util::jsEscape($query).'", []]');
|
||||
|
||||
foreach ($found as $id => $set)
|
||||
{
|
||||
$max = max(1, round($maxResults * count($set['data']) / $foundTotal));
|
||||
$maxResults -= $max;
|
||||
|
||||
for ($i = 0; $i < $max; $i++)
|
||||
{
|
||||
$data = array_pop($set['data']);
|
||||
if (!$data)
|
||||
break;
|
||||
|
||||
$names[] = '"'.$data['name'].$set['appendix'].'"';
|
||||
$extra = [$set['type'], $data['Id']];
|
||||
|
||||
if (isset($data['param1']))
|
||||
$extra[] = $data['param1'];
|
||||
|
||||
if (isset($data['param2']))
|
||||
$extra[] = $data['param2'];
|
||||
|
||||
$info[] = '['.implode(', ', $extra).']';
|
||||
}
|
||||
}
|
||||
|
||||
header("Content-type: text/javascript");
|
||||
die('["'.Util::jsEscape($search).'", ['.implode(', ', $names).'], [], [], [], [], [], ['.implode(', ', $info).']]');
|
||||
}
|
||||
else /* if ($searchMask & SEARCH_TYPE_REGULAR) */
|
||||
{
|
||||
$foundTotal = 0;
|
||||
|
||||
foreach ($found as $tmp)
|
||||
$foundTotal += count($tmp['data']);
|
||||
|
||||
// // only one match -> redirect to find
|
||||
// if ($foundTotal == 1)
|
||||
// {
|
||||
// header("Location: ?".Util::$typeStrings[$found[0]['type']].'='.$found[0]['data'][0]['Id']);
|
||||
// die();
|
||||
// }
|
||||
|
||||
$vars = array(
|
||||
'title' => $search.' - '.Lang::$search['search'],
|
||||
'tab' => 0 // tabId 0: Database for g_initHeader($tab)
|
||||
);
|
||||
|
||||
$smarty->updatePageVars($vars);
|
||||
$smarty->assign('lang', array_merge(Lang::$main, Lang::$search));
|
||||
$smarty->assign('found', $found);
|
||||
$smarty->assign('data', $jsGlobals);
|
||||
$smarty->assign('search', $search);
|
||||
$smarty->assign('mysql', DB::Aowow()->getStatistics());
|
||||
$smarty->assign('util', new Util); // just for debugging / optimizing
|
||||
|
||||
$smarty->display('search.tpl');
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
6
template/bricks/allclasses_table.tpl
Normal file
6
template/bricks/allclasses_table.tpl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
var _ = g_classes;
|
||||
{strip}
|
||||
{foreach from=$data key=id item=item}
|
||||
_[{$id}]={ldelim}name_{$user.language}:'{$item|escape:"javascript"}'{rdelim};
|
||||
{/foreach}
|
||||
{/strip}
|
||||
8
template/bricks/allcurrencies_table.tpl
Normal file
8
template/bricks/allcurrencies_table.tpl
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{strip}
|
||||
|
||||
var _ = g_gatheredcurrencies;
|
||||
{foreach from=$data key=id item=item}
|
||||
_[{$id}]={ldelim}icon:'{$item.icon|escape:"javascript"}',name_{$user.language}:'{$item.name|escape:"javascript"}'{rdelim};
|
||||
{/foreach}
|
||||
|
||||
{/strip}
|
||||
10
template/bricks/allitems_table.tpl
Normal file
10
template/bricks/allitems_table.tpl
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
var _ = g_items;
|
||||
{strip}
|
||||
{foreach from=$data key=id item=item}
|
||||
_[{$id}]={ldelim}
|
||||
icon:'{$item.icon|escape:"javascript"}',
|
||||
name_{$user.language}:'{$item.name|escape:"javascript"}'
|
||||
{if isset($item.quality)}, quality:'{$item.quality}'{/if}
|
||||
{rdelim};
|
||||
{/foreach}
|
||||
{/strip}
|
||||
6
template/bricks/allraces_table.tpl
Normal file
6
template/bricks/allraces_table.tpl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
var _ = g_races;
|
||||
{strip}
|
||||
{foreach from=$data key=id item=item}
|
||||
_[{$id}]={ldelim}name_{$user.language}:'{$item.name|escape:"javascript"}'{rdelim};
|
||||
{/foreach}
|
||||
{/strip}
|
||||
37
template/bricks/class_table.tpl
Normal file
37
template/bricks/class_table.tpl
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{strip}
|
||||
new Listview({ldelim}
|
||||
template:'classs',
|
||||
{if !isset($params.id)}id:'classes',{/if}
|
||||
{if !isset($params.tabs)}tabs:'listview-generic',{/if}
|
||||
{if !isset($params.name)}name:LANG.tab_classes,{/if}
|
||||
{if !isset($params.parent)}parent:'listview-generic',{/if}
|
||||
{if isset($params.note)}_truncated: 1,{/if}
|
||||
{foreach from=$params key=k item=v}
|
||||
{if $v[0] == '$'}
|
||||
{$k}:{$v|substr:1},
|
||||
{else if $v}
|
||||
{$k}:'{$v}',
|
||||
{/if}
|
||||
{/foreach}
|
||||
data:[
|
||||
{foreach name=i from=$data item=curr}
|
||||
{ldelim}
|
||||
id:{$curr.Id},
|
||||
name:'{$curr.name|escape:"javascript"}',
|
||||
races:{$curr.races},
|
||||
roles:{$curr.roles},
|
||||
power:{$curr.power},
|
||||
weapon:{$curr.weapon},
|
||||
armor:{$curr.armor}
|
||||
{if isset($curr.hero)}
|
||||
,hero:1
|
||||
{/if}
|
||||
{if isset($curr.expansion)}
|
||||
,expansion:{$curr.expansion}
|
||||
{/if}
|
||||
{rdelim}
|
||||
{if $smarty.foreach.i.last}{else},{/if}
|
||||
{/foreach}
|
||||
]
|
||||
{rdelim});
|
||||
{/strip}
|
||||
28
template/bricks/currency_table.tpl
Normal file
28
template/bricks/currency_table.tpl
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{strip}
|
||||
new Listview({ldelim}
|
||||
template:'currency',
|
||||
{if !isset($params.id)}id:'currencies',{/if}
|
||||
{if !isset($params.tabs)}tabs:'listview-generic',{/if}
|
||||
{if !isset($params.name)}name:LANG.tab_currencies,{/if}
|
||||
{if !isset($params.parent)}parent:'listview-generic',{/if}
|
||||
{if isset($params.note)}_truncated: 1,{/if}
|
||||
{foreach from=$params key=k item=v}
|
||||
{if $v[0] == '$'}
|
||||
{$k}:{$v|substr:1},
|
||||
{else if $v}
|
||||
{$k}:'{$v}',
|
||||
{/if}
|
||||
{/foreach}
|
||||
data:[
|
||||
{foreach name=i from=$data item=curr}
|
||||
{ldelim}
|
||||
id:{$curr.Id},
|
||||
category:{$curr.category},
|
||||
name:'{$curr.name|escape:"javascript"}',
|
||||
icon:'{$curr.icon}',
|
||||
{rdelim}
|
||||
{if $smarty.foreach.i.last}{else},{/if}
|
||||
{/foreach}
|
||||
]
|
||||
{rdelim});
|
||||
{/strip}
|
||||
114
template/bricks/item_table.tpl
Normal file
114
template/bricks/item_table.tpl
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
{strip}
|
||||
new Listview({ldelim}
|
||||
template:'item',
|
||||
{if !isset($params.id)}id:'items',{/if}
|
||||
{if !isset($params.tabs)}tabs:'listview-generic',{/if}
|
||||
{if !isset($params.name)}name:LANG.tab_items,{/if}
|
||||
{if !isset($params.parent)}parent:'listview-generic',{/if}
|
||||
{if isset($params.note)}_truncated: 1,{/if}
|
||||
{foreach from=$params key=k item=v}
|
||||
{if $v[0] == '$'}
|
||||
{$k}:{$v|substr:1},
|
||||
{else if $v}
|
||||
{$k}:'{$v}',
|
||||
{/if}
|
||||
{/foreach}
|
||||
data:[
|
||||
{foreach name=i from=$data item=curr}
|
||||
{ldelim}
|
||||
name:'{$curr.quality}{$curr.name|escape:"quotes"}',
|
||||
{if isset($curr.level)}
|
||||
level:{$curr.level},
|
||||
{/if}
|
||||
{if isset($curr.reqlevel)}
|
||||
reqlevel:{$curr.reqlevel},
|
||||
{/if}
|
||||
classs:{$curr.classs},
|
||||
subclass:{$curr.subclass},
|
||||
{if isset($curr.maxcount)}
|
||||
{if $curr.maxcount>1}
|
||||
stack:[{$curr.mincount},{$curr.maxcount}],
|
||||
{/if}
|
||||
{/if}
|
||||
{if isset($curr.percent)}
|
||||
percent:{$curr.percent},
|
||||
{/if}
|
||||
{if isset($curr.group) and isset($curr.groupcount)}
|
||||
group:'({$curr.group}){if $curr.groupcount!=1} x{$curr.groupcount}{/if}',
|
||||
{/if}
|
||||
{if isset($curr.cost.money) || isset($curr.cost.honor) ||isset($curr.cost.arena) || isset($curr.cost.items)}
|
||||
stock:-1,
|
||||
cost:[
|
||||
{if isset($curr.cost.money)}{$curr.cost.money}{/if}
|
||||
{if isset($curr.cost.honor) or isset($curr.cost.arena) or isset($curr.cost.items)}
|
||||
,{if isset($curr.cost.honor)}{$curr.cost.honor}{/if}
|
||||
{if isset($curr.cost.arena) or isset($curr.cost.items)}
|
||||
,{if isset($curr.cost.arena)}{$curr.cost.arena}{/if}
|
||||
{if isset($curr.cost.items)}
|
||||
,[
|
||||
{foreach from=$curr.cost.items item=curitem name=c}
|
||||
[{$curitem.item},{$curitem.count}]
|
||||
{if $smarty.foreach.c.last}{else},{/if}
|
||||
{/foreach}
|
||||
]
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
],
|
||||
{/if}
|
||||
{if $curr.classs == 1}
|
||||
nslots:{$curr.nslots},
|
||||
{/if}
|
||||
{if $curr.classs == 2}
|
||||
dps:{$curr.dps},
|
||||
speed:{$curr.speed},
|
||||
{/if}
|
||||
{if $curr.classs == 4}
|
||||
armor:{$curr.armor},
|
||||
{/if}
|
||||
{if isset($curr.slot)}
|
||||
slot:{$curr.slot},
|
||||
slotbak:{$curr.slotbak},
|
||||
{/if}
|
||||
id:{$curr.id}
|
||||
{rdelim}
|
||||
{if $smarty.foreach.i.last}{else},{/if}
|
||||
{/foreach}
|
||||
]
|
||||
{rdelim});
|
||||
{/strip}
|
||||
|
||||
{* 4.3 loot-example
|
||||
|
||||
template: 'item',
|
||||
id: 'drops',
|
||||
name: LANG.tab_drops,
|
||||
tabs: tabsRelated,
|
||||
parent: 'lkljbjkb574',
|
||||
extraCols: [Listview.extraCols.count, Listview.extraCols.percent],
|
||||
sort:['-percent', 'name'],
|
||||
_totalCount: 448092, /* total # creature killed/looted */
|
||||
computeDataFunc: Listview.funcBox.initLootTable,
|
||||
onAfterCreate: Listview.funcBox.addModeIndicator,
|
||||
data: [
|
||||
{
|
||||
"classs":15, /* Tab Type */
|
||||
"commondrop":true, /* loot filtered as "not noteworthy" */
|
||||
"id":25445,
|
||||
"level":1,
|
||||
"name":"7Wretched Ichor",
|
||||
"slot":0,
|
||||
"source":[2], /* 1: crafted; 2:zonedrop; 3:pvp; 4:quest; 5: Vendors; 6:Trainer; 7:Discovery; 8:Redemption; 9: Talent; 10:Starter; 11: Event; 12:Achievement; */
|
||||
"sourcemore":[{"z":3520}], /* z: zone... */
|
||||
"subclass":0, /* Tab:Type */
|
||||
modes:{
|
||||
"mode":4, /* &1: heroic; &4: noteworthy(?); &8: reg10; &16: reg25; &32: hc10; &64: hc25; &128: RaidFinder */
|
||||
"4":{"count":363318,"outof":448092} /* calculate pct chance */
|
||||
},
|
||||
count:363318,
|
||||
stack:[1,1], /* [min, max] */
|
||||
pctstack:'{1: 50.0123,2: 49.9877}' /* {dropCount: relChanceForThisStack} */
|
||||
}
|
||||
]
|
||||
});
|
||||
*}
|
||||
33
template/bricks/itemset_table.tpl
Normal file
33
template/bricks/itemset_table.tpl
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{strip}
|
||||
new Listview({ldelim}
|
||||
template:'itemset',
|
||||
{if !isset($params.id)}id:'itemsets',{/if}
|
||||
{if !isset($params.tabs)}tabs:'listview-generic',{/if}
|
||||
{if !isset($params.name)}name:LANG.tab_itemsets,{/if}
|
||||
{if !isset($params.parent)}parent:'listview-generic',{/if}
|
||||
{if isset($params.note)}_truncated: 1,{/if}
|
||||
{foreach from=$params key=k item=v}
|
||||
{if $v[0] == '$'}
|
||||
{$k}:{$v|substr:1},
|
||||
{else if $v}
|
||||
{$k}:'{$v}',
|
||||
{/if}
|
||||
{/foreach}
|
||||
data:[
|
||||
{foreach name=i from=$data item=curr}
|
||||
{ldelim}
|
||||
name:'{$curr.quality}{$curr.name|escape:"quotes"}',
|
||||
{if $curr.minlevel}minlevel:{$curr.minlevel},{/if}
|
||||
{if $curr.maxlevel}maxlevel:{$curr.maxlevel},{/if}
|
||||
{if $curr.classes}classes:[{section name=j loop=$curr.classes}{$curr.classes[j]}{if $smarty.section.j.last}{else},{/if}{/section}],{/if}
|
||||
{if $curr.reqclass}reqclass:{$curr.reqclass},{/if}
|
||||
{if $curr.note}note:{$curr.note},{/if}
|
||||
{if $curr.pieces}pieces:[{section name=j loop=$curr.pieces}{$curr.pieces[j]}{if $smarty.section.j.last}{else},{/if}{/section}],{/if}
|
||||
{if isset($curr.type)}type:{$curr.type},{/if}
|
||||
id:{$curr.Id}
|
||||
{rdelim}
|
||||
{if $smarty.foreach.i.last}{else},{/if}
|
||||
{/foreach}
|
||||
]
|
||||
{rdelim});
|
||||
{/strip}
|
||||
34
template/bricks/race_table.tpl
Normal file
34
template/bricks/race_table.tpl
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{strip}
|
||||
new Listview({ldelim}
|
||||
template:'race',
|
||||
{if !isset($params.id)}id:'races',{/if}
|
||||
{if !isset($params.tabs)}tabs:'listview-generic',{/if}
|
||||
{if !isset($params.name)}name:LANG.tab_races,{/if}
|
||||
{if !isset($params.parent)}parent:'listview-generic',{/if}
|
||||
{if isset($params.note)}_truncated: 1,{/if}
|
||||
{foreach from=$params key=k item=v}
|
||||
{if $v[0] == '$'}
|
||||
{$k}:{$v|substr:1},
|
||||
{else if $v}
|
||||
{$k}:'{$v}',
|
||||
{/if}
|
||||
{/foreach}
|
||||
data:[
|
||||
{foreach name=i from=$data item=curr}
|
||||
{ldelim}
|
||||
id:{$curr.Id},
|
||||
name:'{$curr.name|escape:"javascript"}',
|
||||
classes:{$curr.classes},
|
||||
faction:{$curr.faction},
|
||||
leader:{$curr.leader},
|
||||
zone:{$curr.zone},
|
||||
side:{$curr.side}
|
||||
{if isset($curr.expansion)}
|
||||
,expansion:{$curr.expansion}
|
||||
{/if}
|
||||
{rdelim}
|
||||
{if $smarty.foreach.i.last}{else},{/if}
|
||||
{/foreach}
|
||||
]
|
||||
{rdelim});
|
||||
{/strip}
|
||||
|
|
@ -2,6 +2,9 @@
|
|||
new Listview({ldelim}
|
||||
template:'title',
|
||||
{if !isset($params.id)}id:'titles',{/if}
|
||||
{if !isset($params.tabs)}tabs:'listview-generic',{/if}
|
||||
{if !isset($params.name)}name:LANG.tab_titles,{/if}
|
||||
{if !isset($params.parent)}parent:'listview-generic',{/if}
|
||||
{if isset($params.note)}_truncated: 1,{/if}
|
||||
{foreach from=$params key=k item=v}
|
||||
{if $v[0] == '$'}
|
||||
|
|
@ -13,12 +16,12 @@
|
|||
data:[
|
||||
{foreach name=i from=$data item=curr}
|
||||
{ldelim}
|
||||
id:{$curr.Id},
|
||||
name:'{$curr.name|escape:"javascript"}',
|
||||
category:{$curr.category},
|
||||
expansion:{$curr.expansion},
|
||||
gender:{$curr.gender},
|
||||
id:{$curr.id},
|
||||
side:{$curr.side},
|
||||
name:'{$curr.name|escape:"javascript"}'
|
||||
side:{$curr.side}
|
||||
{if isset($curr.namefemale)}
|
||||
, namefemale:'{$curr.namefemale|escape:"javascript"}'
|
||||
{/if}
|
||||
|
|
|
|||
51
template/search.tpl
Normal file
51
template/search.tpl
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{include file='header.tpl'}
|
||||
|
||||
<div id="main">
|
||||
|
||||
<div id="main-precontents"></div>
|
||||
|
||||
<div class="main-contents" id="main-contents">
|
||||
<div class="text">
|
||||
<a href="http://www.wowhead.com/?{$query}" class="button-red"><em><b><i>Wowhead</i></b><span>Wowhead</span></em></a>
|
||||
{if !empty($found)}
|
||||
<h1>{$lang.foundResult} <i>{$search|escape:"html"}</i></h1>
|
||||
</div>
|
||||
<div id="tabs-generic"></div>
|
||||
<div id="listview-generic" class="listview"></div>
|
||||
<script type="text/javascript">
|
||||
var myTabs = new Tabs({ldelim}parent: ge('tabs-generic'){rdelim});
|
||||
{if isset($found.class)} {include file='bricks/class_table.tpl' data=$found.class.data params=$found.class.params } {/if}
|
||||
{if isset($found.race)} {include file='bricks/race_table.tpl' data=$found.race.data params=$found.race.params } {/if}
|
||||
{if isset($found.title)} {include file='bricks/title_table.tpl' data=$found.title.data params=$found.title.params } {/if}
|
||||
{if isset($found.npc)} {include file='bricks/creature_table.tpl' data=$found.npc.data params=$found.npc.params } {/if}
|
||||
{if isset($found.object)} {include file='bricks/object_table.tpl' data=$found.object.data params=$found.object.params } {/if}
|
||||
{if isset($found.itemset)} {include file='bricks/itemset_table.tpl' data=$found.itemset.data params=$found.itemset.params } {/if}
|
||||
{if isset($found.item)} {include file='bricks/item_table.tpl' data=$found.item.data params=$found.item.params } {/if}
|
||||
{if isset($found.quest)} {include file='bricks/quest_table.tpl' data=$found.quest.data params=$found.quest.params } {/if}
|
||||
{if isset($found.ability)} {include file='bricks/spell_table.tpl' data=$found.ability.data params=$found.ability.params } {/if}
|
||||
{if isset($found.talent)} {include file='bricks/spell_table.tpl' data=$found.talent.data params=$found.talent.params } {/if}
|
||||
{if isset($found.npcSpell)} {include file='bricks/spell_table.tpl' data=$found.npcSpell.data params=$found.npcSpell.params } {/if}
|
||||
{if isset($found.petSpell)} {include file='bricks/spell_table.tpl' data=$found.petSpell.data params=$found.petSpell.params } {/if}
|
||||
{if isset($found.spell)} {include file='bricks/spell_table.tpl' data=$found.spell.data params=$found.spell.params } {/if}
|
||||
{if isset($found.unkSpell)} {include file='bricks/spell_table.tpl' data=$found.unkSpell.data params=$found.unkSpell.params } {/if}
|
||||
{if isset($found.zone)} {include file='bricks/zone_table.tpl' data=$found.zone.data params=$found.zone.params } {/if}
|
||||
{if isset($found.faction)} {include file='bricks/faction_table.tpl' data=$found.faction.data params=$found.faction.params } {/if}
|
||||
{if isset($found.pet)} {include file='bricks/npc_table.tpl' data=$found.pet.data params=$found.pet.params } {/if}
|
||||
{if isset($found.achievement)} {include file='bricks/achievement_table.tpl' data=$found.achievement.data params=$found.achievement.params} {/if}
|
||||
{if isset($found.event)} {include file='bricks/event_table.tpl' data=$found.event.data params=$found.event.params } {/if}
|
||||
{if isset($found.skill)} {include file='bricks/skill_table.tpl' data=$found.skill.data params=$found.skill.params } {/if}
|
||||
{if isset($found.currency)} {include file='bricks/currency_table.tpl' data=$found.currency.data params=$found.currency.params } {/if}
|
||||
myTabs.flush();
|
||||
</script>
|
||||
{else}
|
||||
<h1>{$lang.noResult} <i>{$search|escape:"html"}</i></h1>
|
||||
|
||||
{$lang.tryAgain}
|
||||
{/if}
|
||||
<div class="clear"></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{include file='footer.tpl'}
|
||||
Loading…
Add table
Add a link
Reference in a new issue