source: aowow/itemset.php

Last change on this file was 170, checked in by maron, 15 years ago
  • Property svn:executable set to *
File size: 2.6 KB
Line 
1<?php
2require_once('includes/game.php');
3require_once('includes/allcomments.php');
4
5$smarty->config_load($conf_file, 'itemset');
6
7// БД
8global $DB;
9$id = $podrazdel;
10
11if(!$itemset = load_cache(8, intval($id)))
12{
13 unset($itemset);
14
15 $row = $DB->selectRow("SELECT * from ?_itemset WHERE itemsetID=? LIMIT 1", $id);
16 if ($row) {
17 $itemset = array();
18 $itemset['entry'] = $row['itemsetID'];
19 $itemset['name'] = $row['name'];
20 $itemset['minlevel'] = 255;
21 $itemset['maxlevel'] = 0;
22 $itemset['count'] = 0;
23 $x=0;
24 $itemset['pieces'] = array();
25 for ($j=1;$j<=10;$j++)
26 {
27 if ($row['item'.$j])
28 {
29 $itemset['pieces'][$itemset['count']] = array();
30 $itemset['pieces'][$itemset['count']] = iteminfo($row['item'.$j]);
31 if ($itemset['pieces'][$itemset['count']]['level'] < $itemset['minlevel']) $itemset['minlevel'] = $itemset['pieces'][$itemset['count']]['level'];
32 if ($itemset['pieces'][$itemset['count']]['level'] > $itemset['maxlevel']) $itemset['maxlevel'] = $itemset['pieces'][$itemset['count']]['level'];
33 $itemset['count']++;
34 }
35 }
36 $itemset['spells'] = array();
37 for ($j=1;$j<=8;$j++)
38 if ($row['spell'.$j])
39 {
40 $itemset['spells'][$x] = array();
41 $itemset['spells'][$x]['entry'] = $row['spell'.$j];
42 $itemset['spells'][$x]['tooltip'] = spell_desc($row['spell'.$j]);
43 $itemset['spells'][$x]['bonus'] = $row['bonus'.$j];
44 $x++;
45 }
46 for ($i=0;$i<=$x-1;$i++)
47 for ($j=$i;$j<=$x-1;$j++)
48 if ($itemset['spells'][$j]['bonus'] < $itemset['spells'][$i]['bonus'])
49 {
50 UnSet($tmp);
51 $tmp = $itemset['spells'][$i];
52 $itemset['spells'][$i] = $itemset['spells'][$j];
53 $itemset['spells'][$j] = $tmp;
54 }
55 }
56 save_cache(8, $id, $itemset);
57}
58$smarty->assign('itemset', $itemset);
59
60global $page;
61$page = array(
62 'Mapper' => false,
63 'Book' => false,
64 'Title' => $itemset['name'].' - '.$smarty->get_config_vars('Item_Sets'),
65 'tab' => 0,
66 'type' => 4,
67 'typeid' => $itemset['entry'],
68 'path' => '[0, 2]'
69);
70$smarty->assign('page', $page);
71
72// Комментарии
73$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
74
75// --Передаем данные шаблонизатору--
76// Количество MySQL запросов
77$smarty->assign('mysql', $DB->getStatistics());
78// Если хоть одна информация о вещи найдена - передаём массив с информацией о вещях шаблонизатору
79if (isset($allitems))
80 $smarty->assign('allitems',$allitems);
81if (isset($allitems))
82 $smarty->assign('allspells',$allspells);
83// Запускаем шаблонизатор
84$smarty->display('itemset.tpl');
85?>
Note: See TracBrowser for help on using the repository browser.