source: aowow/spells.php

Last change on this file was 170, checked in by maron, 16 years ago
  • Property svn:executable set to *
File size: 4.6 KB
Line 
1<?php
2
3require_once('includes/allspells.php');
4
5$smarty->config_load($conf_file, 'spells');
6
7global $DB;
8global $AoWoWconf;
9global $spell_cols;
10
11@list($s1, $s2, $s3) = explode('.', $podrazdel);
12
13$cache_str = (empty($s1)?'x':intval($s1)).'_'.(empty($s2)?'x':intval($s2)).'_'.(empty($s3)?'x':intval($s3));
14
15if(!$spells = load_cache(15, $cache_str))
16{
17 unset($spells);
18
19 $spells = array();
20 if($s1 == 7)
21 {
22 $title = $smarty->get_config_vars('Class_spells');
23 // Классовые
24 $rows = $DB->select('
25 SELECT ?#, s.`spellID`, sk.skillID
26 FROM ?_spell s, ?_skill_line_ability sla, ?_spellicons i, ?_skill sk
27 WHERE
28 s.spellID = sla.spellID
29 AND s.levelspell >= 1
30 AND i.id=s.spellicon
31 {AND sla.classmask = ?d}
32 {AND sla.skillID=?d}
33 AND sla.skillID=sk.skillID
34 ORDER BY s.levelspell
35 {LIMIT ?d}
36 ',
37 $spell_cols[2],
38 (isset($s2))? pow(2, ($s2-1)): DBSIMPLE_SKIP,
39 (isset($s3))? $s3: DBSIMPLE_SKIP,
40 ($AoWoWconf['limit']!=0)? $AoWoWconf['limit']: DBSIMPLE_SKIP
41 );
42 }
43 elseif($s1 > 0)
44 {
45 switch($s1)
46 {
47 case 6:
48 $title = $smarty->get_config_vars('Оружейные навыки');
49 break;
50 case 8:
51 $title = $smarty->get_config_vars('Специализации брони');
52 break;
53 case 10:
54 $title = $smarty->get_config_vars('Языки');
55 break;
56 case 9:
57 $title = $smarty->get_config_vars('Вспомогательные профессии');
58 break;
59 case 11:
60 $title = $smarty->get_config_vars('Профессии');
61 break;
62 default:
63 $title = '???';
64 break;
65 }
66 $spells['sort'] = "'skill', 'name'";
67 // Профессии & other
68 $rows = $DB->select('
69 SELECT
70 ?#, `s`.`spellID`,
71 sla.skillID, sla.min_value, sla.max_value
72 FROM ?_spell s, ?_skill_line_ability sla, ?_spellicons i, ?_skill sk
73 WHERE
74 s.spellID = sla.spellID
75 AND i.id=s.spellicon
76 {AND sk.categoryID=?d}
77 {AND sla.skillID=?d}
78 AND sla.skillID=sk.skillID
79 {LIMIT ?d}
80 ',
81 $spell_cols[2],
82 $s1,
83 (isset($s2))? $s2: DBSIMPLE_SKIP,
84 ($AoWoWconf['limit']!=0)? $AoWoWconf['limit']: DBSIMPLE_SKIP
85 );
86 }
87 elseif($s1 == -3)
88 {
89 $title = $smarty->get_config_vars('Pet_spells');
90 // Петы
91 $spells['sort'] = "'name'";
92 if (!isset($s2))
93 $pets = array(270, 653, 210, 211, 213, 209, 214, 212, 763, 215, 654, 764, 655, 217, 767, 236, 768, 203, 218, 251, 766, 656, 208, 761, 189, 188, 205, 204);
94 $rows = $DB->select('
95 SELECT
96 ?#, `s`.`spellID`, sk.skillID
97 FROM ?_spell s, ?_skill_line_ability sla, ?_spellicons i, ?_skill sk
98 WHERE
99 s.spellID = sla.spellID
100 AND s.levelspell > 0
101 AND i.id=s.spellicon
102 {AND sla.skillID=?d}
103 {AND sla.skillID IN (?a)}
104 AND sla.skillID=sk.skillID
105 {LIMIT ?d}
106 ',
107 $spell_cols[2],
108 (isset($s2))? $s2: DBSIMPLE_SKIP,
109 (isset($pets))? $pets: DBSIMPLE_SKIP,
110 ($AoWoWconf['limit']!=0)? $AoWoWconf['limit']: DBSIMPLE_SKIP
111 );
112 }
113 elseif($s1 == -4)
114 {
115 $title = $smarty->get_config_vars('Racial_spells');
116 $spells['sort'] = "'name'";
117 // Racial Traits
118 $rows = $DB->select('
119 SELECT
120 ?#, `s`.`spellID`
121 FROM ?_spell s, ?_spellicons i
122 WHERE
123 s.spellID IN (SELECT spellID FROM ?_skill_line_ability WHERE racemask>0)
124 AND i.id=s.spellicon
125 {LIMIT ?d}
126 ',
127 $spell_cols[2],
128 ($AoWoWconf['limit']!=0)? $AoWoWconf['limit']: DBSIMPLE_SKIP
129 );
130 }
131 elseif ($s1==-2) {
132 // Talents
133 // todo
134 }
135 else
136 {
137 $spells['sort'] = "'name'";
138 // просто спеллы
139 $rows = $DB->select('
140 SELECT
141 ?#, `s`.`spellID`
142 FROM ?_spell s, ?_spellicons i
143 WHERE
144 i.id=s.spellicon
145 {LIMIT ?d}
146 ',
147 $spell_cols[2],
148 ($AoWoWconf['limit']!=0)? $AoWoWconf['limit']: DBSIMPLE_SKIP
149 );
150 }
151
152 foreach($rows as $i => $row)
153 $spells['data'][] = spellinfo2($row);
154
155 save_cache(15, $cache_str, $spells);
156}
157global $page;
158$page = array(
159 'Mapper' => false,
160 'Book' => false,
161 'Title' => ($title?$title.' - ':'').$smarty->get_config_vars('Spells'),
162 'tab' => 0,
163 'type' => 6,
164 'typeid' => 0,
165 'path' => "[0, 1, ".intval($s1).", ".intval($s2).", ".intval($s3)."]",
166 'sort' => isset($spells['sort'])?$spells['sort']:"'level','name'"
167);
168$smarty->assign('page', $page);
169
170// Статистика выполнения mysql запросов
171$smarty->assign('mysql', $DB->getStatistics());
172// Если хоть одна информация о вещи найдена - передаём массив с информацией о вещях шаблонизатору
173if (isset($allitems))
174 $smarty->assign('allitems',$allitems);
175if (count($allspells)>=0)
176 $smarty->assign('allspells',$allspells);
177if (count($spells)>=0)
178 $smarty->assign('spells',$spells['data']);
179// Загружаем страницу
180$smarty->display('spells.tpl');
181
182?>
Note: See TracBrowser for help on using the repository browser.