-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathitemset.php
95 lines (87 loc) · 2.77 KB
/
itemset.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/*
* UDWBase: WOWDB Web Interface
*
* © UDW 2009-2011
*
* Released under the terms and conditions of the
* GNU General Public License (http://gnu.org).
*
*/
require_once('includes/game.php');
require_once('includes/allcomments.php');
$smarty->config_load($conf_file, 'itemset');
// БД
global $DB;
$id = $podrazdel;
if(!$itemset = load_cache(8, intval($id)))
{
unset($itemset);
$row = $DB->selectRow("SELECT * FROM ?_udwbase_itemset WHERE itemsetID=? LIMIT 1", $id);
if ($row) {
$itemset = array();
$itemset['entry'] = $row['itemsetID'];
$itemset['name'] = $row['name_loc'.$_SESSION['locale']];
$itemset['minlevel'] = 255;
$itemset['maxlevel'] = 0;
$itemset['count'] = 0;
$x=0;
$itemset['pieces'] = array();
for ($j=1;$j<=10;$j++)
{
if ($row['item'.$j])
{
$itemset['pieces'][$itemset['count']] = array();
$itemset['pieces'][$itemset['count']] = iteminfo($row['item'.$j]);
if ($itemset['pieces'][$itemset['count']]['level'] < $itemset['minlevel']) $itemset['minlevel'] = $itemset['pieces'][$itemset['count']]['level'];
if ($itemset['pieces'][$itemset['count']]['level'] > $itemset['maxlevel']) $itemset['maxlevel'] = $itemset['pieces'][$itemset['count']]['level'];
$itemset['count']++;
}
}
$itemset['spells'] = array();
for ($j=1;$j<=8;$j++)
if ($row['spell'.$j])
{
$itemset['spells'][$x] = array();
$itemset['spells'][$x]['entry'] = $row['spell'.$j];
$itemset['spells'][$x]['tooltip'] = spell_desc($row['spell'.$j]);
$itemset['spells'][$x]['bonus'] = $row['bonus'.$j];
$x++;
}
for ($i=0;$i<=$x-1;$i++)
for ($j=$i;$j<=$x-1;$j++)
if ($itemset['spells'][$j]['bonus'] < $itemset['spells'][$i]['bonus'])
{
UnSet($tmp);
$tmp = $itemset['spells'][$i];
$itemset['spells'][$i] = $itemset['spells'][$j];
$itemset['spells'][$j] = $tmp;
}
}
save_cache(8, $id, $itemset);
}
$smarty->assign('itemset', $itemset);
global $page;
$page = array(
'Mapper' => false,
'Book' => false,
'Title' => $itemset['name'].' - '.$smarty->get_config_vars('Item_Sets'),
'tab' => 0,
'type' => 4,
'typeid' => $itemset['entry'],
'path' => '[0, 2]'
);
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
// --Передаем данные шаблонизатору--
// Количество MySQL запросов
$smarty->assign('mysql', $DB->getStatistics());
// Если хоть одна информация о вещи найдена - передаём массив с информацией о вещях шаблонизатору
if (isset($allitems))
$smarty->assign('allitems',$allitems);
if (isset($allitems))
$smarty->assign('allspells',$allspells);
// Запускаем шаблонизатор
$smarty->display('itemset.tpl');
?>