forked from mangostools/aowow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spells.php
163 lines (152 loc) · 5.39 KB
/
spells.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?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/allspells.php');
$smarty->config_load($conf_file, 'spells');
global $DB;
global $UDWBaseconf;
global $spell_cols;
@list($s1, $s2, $s3) = explode('.', $podrazdel);
$cache_str = (!isset($s1) ? 'x' : intval($s1)) . '_' . (!isset($s2) ? 'x' : intval($s2)) . '_' . (!isset($s3) ? 'x' : intval($s3));
if (!$spells = load_cache(15, $cache_str)) {
unset($spells);
$spells = array();
if ($s1 == 7) {
$title = $smarty->get_config_vars('Class_spells');
// Классовые
$rows = $DB->select('
SELECT ?#, s.`spellID`, sk.skillID
FROM ?_aowow_spell s, ?_aowow_skill_line_ability sla, ?_aowow_spellicons i, ?_aowow_skill sk
WHERE
s.spellID = sla.spellID
AND s.levelspell >= 1
AND i.id=s.spellicon
{AND sla.classmask = ?d}
{AND sla.skillID=?d}
AND sla.skillID=sk.skillID
ORDER BY s.levelspell
{LIMIT ?d}
', $spell_cols[2], (isset($s2)) ? pow(2, ($s2 - 1)) : DBSIMPLE_SKIP, (isset($s3)) ? $s3 : DBSIMPLE_SKIP, ($UDWBaseconf['limit'] != 0) ? $UDWBaseconf['limit'] : DBSIMPLE_SKIP
);
} elseif ($s1 > 0) {
switch ($s1) {
case 6:
$title = $smarty->get_config_vars('Оружейные навыки');
break;
case 8:
$title = $smarty->get_config_vars('Специализации брони');
break;
case 10:
$title = $smarty->get_config_vars('Языки');
break;
case 9:
$title = $smarty->get_config_vars('Вспомогательные профессии');
break;
case 11:
$title = $smarty->get_config_vars('Профессии');
break;
default:
$title = '???';
break;
}
$spells['sort'] = "'skill', 'name'";
// Профессии & other
$rows = $DB->select('
SELECT
?#, `s`.`spellID`,
sla.skillID, sla.min_value, sla.max_value
FROM ?_aowow_spell s, ?_aowow_skill_line_ability sla, ?_aowow_spellicons i, ?_aowow_skill sk
WHERE
s.spellID = sla.spellID
AND i.id=s.spellicon
{AND sk.categoryID=?d}
{AND sla.skillID=?d}
AND sla.skillID=sk.skillID
{LIMIT ?d}
', $spell_cols[2], $s1, (isset($s2)) ? $s2 : DBSIMPLE_SKIP, ($UDWBaseconf['limit'] != 0) ? $UDWBaseconf['limit'] : DBSIMPLE_SKIP
);
} elseif ($s1 == -3) {
$title = $smarty->get_config_vars('Pet_spells');
// Петы
$spells['sort'] = "'name'";
if (!isset($s2))
$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);
$rows = $DB->select('
SELECT
?#, `s`.`spellID`, sk.skillID
FROM ?_aowow_spell s, ?_aowow_skill_line_ability sla, ?_aowow_spellicons i, ?_aowow_skill sk
WHERE
s.spellID = sla.spellID
AND s.levelspell > 0
AND i.id=s.spellicon
{AND sla.skillID=?d}
{AND sla.skillID IN (?a)}
AND sla.skillID=sk.skillID
{LIMIT ?d}
', $spell_cols[2], (isset($s2)) ? $s2 : DBSIMPLE_SKIP, (isset($pets)) ? $pets : DBSIMPLE_SKIP, ($UDWBaseconf['limit'] != 0) ? $UDWBaseconf['limit'] : DBSIMPLE_SKIP
);
}
elseif ($s1 == -4) {
$title = $smarty->get_config_vars('Racial_spells');
$spells['sort'] = "'name'";
// Racial Traits
$rows = $DB->select('
SELECT
?#, `s`.`spellID`
FROM ?_aowow_spell s, ?_aowow_spellicons i
WHERE
s.spellID IN (SELECT spellID FROM ?_aowow_skill_line_ability WHERE racemask>0)
AND i.id=s.spellicon
{LIMIT ?d}
', $spell_cols[2], ($UDWBaseconf['limit'] != 0) ? $UDWBaseconf['limit'] : DBSIMPLE_SKIP
);
} elseif ($s1 == -2) {
// Talents
// todo
} else {
$spells['sort'] = "'name'";
// просто спеллы
$rows = $DB->select('
SELECT
?#, `s`.`spellID`
FROM ?_aowow_spell s, ?_aowow_spellicons i
WHERE
i.id=s.spellicon
{LIMIT ?d}
', $spell_cols[2], ($UDWBaseconf['limit'] != 0) ? $UDWBaseconf['limit'] : DBSIMPLE_SKIP
);
}
foreach ($rows as $i => $row)
$spells['data'][] = spellinfo2($row);
save_cache(15, $cache_str, $spells);
}
global $page;
$page = array(
'Mapper' => false,
'Book' => false,
'Title' => ($title ? $title . ' - ' : '') . $smarty->get_config_vars('Spells'),
'tab' => 0,
'type' => 6,
'typeid' => 0,
'path' => "[0, 1, " . intval($s1) . ", " . intval($s2) . ", " . intval($s3) . "]",
'sort' => isset($spells['sort']) ? $spells['sort'] : "'level','name'"
);
$smarty->assign('page', $page);
// Статистика выполнения mysql запросов
$smarty->assign('mysql', $DB->getStatistics());
// Если хоть одна информация о вещи найдена - передаём массив с информацией о вещях шаблонизатору
if (isset($allitems))
$smarty->assign('allitems', $allitems);
if (count($allspells) >= 0)
$smarty->assign('allspells', $allspells);
if (count($spells) >= 0)
$smarty->assign('spells', $spells['data']);
// Загружаем страницу
$smarty->display('spells.tpl');