db.mojotrollz.eu/itemset.php
2017-01-12 02:54:18 +01:00

92 lines
3.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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 '.$UDWBaseconf['aowow']['db'].'.?_aowow_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');