forked from Tuxinou/Freehead
-
Notifications
You must be signed in to change notification settings - Fork 0
/
npcs.php
executable file
·76 lines (63 loc) · 1.68 KB
/
npcs.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
<?php
// Необходима функция creatureinfo
require_once('includes/allnpcs.php');
$smarty->config_load($conf_file, 'npc');
@list($type) = extract_values($podrazdel);
$cache_key = cache_key($type);
if(!$npcs = load_cache(NPC_LISTING, $cache_key))
{
unset($npcs);
$rows = $DB->select('
SELECT c.?#, c.entry
{
, l.name_loc?d
, l.subname_loc?d
}
FROM ?_factiontemplate, creature_template c
{ LEFT JOIN (locales_creature l) ON l.entry=c.entry AND ? }
WHERE
factiontemplateID=faction_A
{AND type=?}
ORDER BY minlevel DESC, name
{LIMIT ?d}
',
$npc_cols[0],
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
($type!='')? $type: DBSIMPLE_SKIP,
($AoWoWconf['limit']!=0)? $AoWoWconf['limit']: DBSIMPLE_SKIP
);
$npcs = array();
foreach($rows as $row)
$npcs[] = creatureinfo2($row);
save_cache(NPC_LISTING, $cache_key, $npcs);
}
if(!$npc_tot = load_cache(NPC_TOT, 'npc_tot'))
{
unset($npc_tot);
$npc_tot = $DB->select('
SELECT COUNT(entry) as npc_tot
FROM creature_template c
'
);
save_cache(NPC_TOT, 'npc_tot', $npc_tot);
}
global $page;
$page = array(
'Mapper' => false,
'Book' => false,
'Title' => $smarty->get_config_vars('NPCs'),
'tab' => 0,
'type' => 0,
'typeid' => 0,
'path' => path(0, 4, $type)
);
$smarty->assign('page', $page);
$smarty->assign('npcs', $npcs);
$smarty->assign('npc_tot',(is_array($npc_tot) ? $npc_tot[0]['npc_tot'] : $npc_tot));
// Количество MySQL запросов
$smarty->assign('mysql', $DB->getStatistics());
// Загружаем страницу
$smarty->display('npcs.tpl');
?>