forked from mangostools/aowow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfaction.php
142 lines (127 loc) · 4.41 KB
/
faction.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
<?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/allnpcs.php');
require_once('includes/allitems.php');
require_once('includes/allquests.php');
require_once('includes/allcomments.php');
global $npc_cols;
global $item_cols;
global $quest_cols;
$smarty->config_load($conf_file, 'faction');
// Номер фракции
$id = $podrazdel;
if (!$faction = load_cache(18, intval($id))) {
unset($faction);
// Подключаемся к ДБ:
global $DB;
$row = $DB->selectRow('
SELECT factionID, name_loc' . $_SESSION['locale'] . ', description1_loc' . $_SESSION['locale'] . ', description2_loc' . $_SESSION['locale'] . ', team, side
FROM ?_aowow_factions
WHERE factionID=?d
LIMIT 1
', $id
);
if ($row) {
$faction = array();
// Номер фракции
$faction['entry'] = $row['factionID'];
// Название фракции
$faction['name'] = $row['name_loc' . $_SESSION['locale']];
// Описание фракции, из клиента:
$faction['description1'] = $row['description1_loc' . $_SESSION['locale']];
// Описание фракции, c wowwiki.com, находится в таблице factions.sql:
$faction['description2'] = $row['description2_loc' . $_SESSION['locale']];
// Команда/Группа фракции
if ($row['team'] != 0)
$faction['group'] = $DB->selectCell('SELECT name_loc' . $_SESSION['locale'] . ' FROM ?_aowow_factions WHERE factionID=?d LIMIT 1', $row['team']);
// Альянс(1)/Орда(2)
if ($row['side'] != 0)
$faction['side'] = $row['side'];
// Итемы с requiredreputationfaction
$item_rows = $DB->select('
SELECT ?#, entry
FROM ?_item_template i, ?_aowow_icons a
WHERE
i.RequiredReputationFaction=?d
AND a.id=i.displayid
', $item_cols[2], $id
);
if ($item_rows) {
$faction['items'] = array();
foreach ($item_rows as $i => $row)
$faction['items'][] = iteminfo2($row, 0);
unset($faction['items']);
}
// Персонажи, состоящие во фракции
$creature_rows = $DB->select('
SELECT ?#, entry
FROM ?_creature_template, ?_aowow_factiontemplate
WHERE
FactionAlliance IN (SELECT factiontemplateID FROM ?_aowow_factiontemplate WHERE factionID=?d)
AND factiontemplateID=FactionAlliance
', $npc_cols[0], $id
);
if ($creature_rows) {
$faction['creatures'] = array();
foreach ($creature_rows as $i => $row)
$faction['creatures'][] = creatureinfo2($row);
unset($creature_rows);
}
// Квесты для этой фракции
$quests_rows = $DB->select('
SELECT ?#
FROM ?_quest_template
WHERE
RewRepFaction1=?d
OR RewRepFaction2=?d
OR RewRepFaction3=?d
OR RewRepFaction4=?d
', $quest_cols[2], $id, $id, $id, $id
);
if ($quests_rows) {
$faction['quests'] = array();
foreach ($quests_rows as $i => $row)
$faction['quests'][] = GetQuestInfo($row, 0xFFFFFF);
unset($quests_rows);
}
// Faction cache
save_cache(18, $faction['entry'], $faction);
}
}
$page = array(
'Mapper' => false,
'Book' => false,
'Title' => $faction['name'] . ' - ' . $smarty->get_config_vars('Factions'),
'tab' => 0,
'type' => 8,
'typeid' => $faction['entry'],
'path' => '[0, 7, 0]'
);
$smarty->assign('page', $page);
// Комментарии
$smarty->assign('comments', getcomments($page['type'], $page['typeid']));
// Данные о квесте
$smarty->assign('faction', $faction);
// Если хоть одна информация о вещи найдена - передаём массив с информацией о вещях шаблонизатору
if (isset($allitems))
$smarty->assign('allitems', $allitems);
/*
if (isset($npcs))
$smarty->assign('npcs',$npcs);
if (isset($quests))
$smarty->assign('quests',$quests);
if (isset($items))
$smarty->assign('items',$items);
*/
// Количество MySQL запросов
$smarty->assign('mysql', $DB->getStatistics());
// Загружаем страницу
$smarty->display('faction.tpl');