source: aowow/includes/allquests.php

Last change on this file was 170, checked in by maron, 15 years ago
  • Property svn:executable set to *
File size: 19.7 KB
Line 
1<?php
2
3require_once('includes/game.php');
4require_once('includes/alllocales.php');
5
6global $AoWoWconf;
7
8$quest_class = array(
9 0 => array(36, 45, 3, 25, 4, 35, 46, 132, 279, 41, 154, 2257, 1, 10, 139, 12, 3430, 3433, 267, 1537, 131, 38, 24, 9, 44, 51, 3487, 130, 1519, 33, 3431, 8, 47, 85, 1497, 28, 40, 11, 4080),
10 1 => array(2079, 3526, 331, 16, 3524, 3525, 148, 221, 1657, 405, 14, 15, 1116, 361, 357, 493, 215, 1637, 220, 702, 188, 1377, 406, 440, 141, 17, 3557, 400, 1638, 1216, 490, 363, 618),
11 /* Dungeons */ 2 => array(3790, 3688, 719, 1584, 1583, 1941, 3607, 2557, 133, 3535, 3792, 2100, 2437, 722, 491, 796, 2057, 3789, 209, 2017, 1417, 3842, 1581, 3717, 3715, 717, 3716, 1337, 718, 978),
12 3 => array(3428, 2677, 3606, 2562, 3836, 2717, 3456, 2159, 3429, 3840, 19),
13 4 => array(-263, -261, -161, -141, -262, -162, -82, -61, -81),
14 5 => array(-181, -121, -304, -201, -324, -101, -24, -182, -264),
15 6 => array(3358, 2597, 3277),
16 7 => array(-365, -370, -364, -1, -368, -344, -366, -369, -367, -22, -284, -221),
17 8 => array(3522, 3483, 3518, 3523, 3520, 3703, 3679, 3519, 3696, 3521),
18 -2 => array(0)
19);
20
21// Флаги квестов
22define('QUEST_FLAGS_NONE', 0);
23define('QUEST_FLAGS_STAY_ALIVE', 1);
24define('QUEST_FLAGS_EVENT ', 2);
25define('QUEST_FLAGS_EXPLORATION', 4);
26define('QUEST_FLAGS_SHARABLE', 8);
27define('QUEST_FLAGS_NONE2', 16);
28define('QUEST_FLAGS_EPIC', 32);
29define('QUEST_FLAGS_RAID', 64);
30define('QUEST_FLAGS_TBC', 128);
31define('QUEST_FLAGS_UNK2', 256);
32define('QUEST_FLAGS_HIDDEN_REWARDS', 512);
33define('QUEST_FLAGS_UNK4', 1024);
34define('QUEST_FLAGS_TBC_RACES', 2048);
35define('QUEST_FLAGS_DAILY', 4096);
36
37define('QUEST_SPECIALFLAGS_NONE', 0);
38define('QUEST_SPECIALFLAGS_REPEATABLE', 1);
39define('QUEST_SPECIALFLAGS_SCRIPTED', 2);
40
41// Флаги для GetQuestInfo
42define('QUEST_DATAFLAG_MINIMUM', 1);
43define('QUEST_DATAFLAG_STRINGS', 2);
44define('QUEST_DATAFLAG_SERIES', 4);
45define('QUEST_DATAFLAG_LOCALE', 8); // Специальный флаг, $questcols не требуется
46define('QUEST_DATAFLAG_REWARDS', 16); // Содержит также Req's
47define('QUEST_DATAFLAG_PROPS', 32);
48define('QUEST_DATAFLAG_LISTINGS', (QUEST_DATAFLAG_MINIMUM | QUEST_DATAFLAG_REWARDS | QUEST_DATAFLAG_PROPS));
49define('QUEST_DATAFLAG_AJAXTOOLTIP', (QUEST_DATAFLAG_LISTINGS | QUEST_DATAFLAG_SERIES | QUEST_DATAFLAG_STRINGS));
50
51$questcols[QUEST_DATAFLAG_MINIMUM] = array('entry', 'Title');
52$questcols[QUEST_DATAFLAG_STRINGS] = array('Objectives', 'Details', 'RequestItemsText', 'OfferRewardText', 'EndText', 'ObjectiveText1', 'ObjectiveText2', 'ObjectiveText3', 'ObjectiveText4');
53$questcols[QUEST_DATAFLAG_REWARDS] = array('RewChoiceItemId1', 'RewChoiceItemId2', 'RewChoiceItemId3', 'RewChoiceItemId4', 'RewChoiceItemId5', 'RewChoiceItemId6', 'RewChoiceItemCount1', 'RewChoiceItemCount2', 'RewChoiceItemCount3', 'RewChoiceItemCount4', 'RewChoiceItemCount5', 'RewChoiceItemCount6', 'RewItemId1', 'RewItemId2', 'RewItemId3', 'RewItemId4', 'RewItemCount1', 'RewItemCount2', 'RewItemCount3', 'RewItemCount4', 'RewMoneyMaxLevel', 'RewOrReqMoney', 'ReqSpellCast1', 'ReqSpellCast2', 'ReqSpellCast3', 'ReqSpellCast4', 'ReqCreatureOrGOId1', 'ReqCreatureOrGOId2', 'ReqCreatureOrGOId3', 'ReqCreatureOrGOId4', 'ReqItemId1', 'ReqItemId2', 'ReqItemId3', 'ReqItemId4', 'ReqItemCount1', 'ReqItemCount2', 'ReqItemCount3', 'ReqItemCount4', 'SrcItemId', 'ReqCreatureOrGOCount1', 'ReqCreatureOrGOCount2', 'ReqCreatureOrGOCount3', 'ReqCreatureOrGOCount4', 'RewSpell', 'RewSpellCast', 'RewRepFaction1', 'RewRepFaction2', 'RewRepFaction3', 'RewRepFaction4', 'RewRepFaction5', 'RewRepValue1', 'RewRepValue2', 'RewRepValue3', 'RewRepValue4', 'RewRepValue5');
54$questcols[QUEST_DATAFLAG_PROPS] = array('Type', 'ZoneOrSort', 'QuestFlags', 'QuestLevel', 'MinLevel', 'RequiredRaces');
55$questcols[QUEST_DATAFLAG_SERIES] = array('PrevQuestID', 'NextQuestInChain', 'ExclusiveGroup', 'NextQuestID');
56
57$quest_cols[2] = array('entry', 'Title', 'QuestLevel', 'MinLevel', 'RequiredRaces', 'RewChoiceItemId1', 'RewChoiceItemId2', 'RewChoiceItemId3', 'RewChoiceItemId4', 'RewChoiceItemId5', 'RewChoiceItemId6', 'RewChoiceItemCount1', 'RewChoiceItemCount2', 'RewChoiceItemCount3', 'RewChoiceItemCount4', 'RewChoiceItemCount5', 'RewChoiceItemCount6', 'RewItemId1', 'RewItemId2', 'RewItemId3', 'RewItemId4', 'RewItemCount1', 'RewItemCount2', 'RewItemCount3', 'RewItemCount4', 'RewMoneyMaxLevel', 'RewOrReqMoney', 'Type', 'ZoneOrSort', 'QuestFlags');
58$quest_cols[3] = array('Title', 'QuestLevel', 'MinLevel', 'RequiredRaces', 'RewChoiceItemId1', 'RewChoiceItemId2', 'RewChoiceItemId3', 'RewChoiceItemId4', 'RewChoiceItemId5', 'RewChoiceItemId6', 'RewChoiceItemCount1', 'RewChoiceItemCount2', 'RewChoiceItemCount3', 'RewChoiceItemCount4', 'RewChoiceItemCount5', 'RewChoiceItemCount6', 'RewItemId1', 'RewItemId2', 'RewItemId3', 'RewItemId4', 'RewItemCount1', 'RewItemCount2', 'RewItemCount3', 'RewItemCount4', 'RewMoneyMaxLevel', 'RewOrReqMoney', 'Type', 'ZoneOrSort', 'QuestFlags', 'RewRepFaction1', 'RewRepFaction2', 'RewRepFaction3', 'RewRepFaction4', 'RewRepFaction5', 'RewRepValue1', 'RewRepValue2', 'RewRepValue3', 'RewRepValue4', 'RewRepValue5', 'Objectives', 'Details', 'RequestItemsText', 'OfferRewardText', 'ReqCreatureOrGOId1', 'ReqCreatureOrGOId2', 'ReqCreatureOrGOId3', 'ReqCreatureOrGOId4', 'ReqItemId1', 'ReqItemId2', 'ReqItemId3', 'ReqItemId4', 'ReqItemCount1', 'ReqItemCount2', 'ReqItemCount3', 'ReqItemCount4', 'SrcItemId', 'ReqCreatureOrGOCount1', 'ReqCreatureOrGOCount2', 'ReqCreatureOrGOCount3', 'ReqCreatureOrGOCount4', 'ObjectiveText1', 'ObjectiveText2', 'ObjectiveText3', 'ObjectiveText4', 'EndText', 'PrevQuestID', 'NextQuestInChain', 'ExclusiveGroup', 'NextQuestID', 'RewSpellCast', 'RewSpell', 'RequiredSkillValue', 'RepObjectiveFaction', 'RepObjectiveValue', 'SuggestedPlayers', 'LimitTime', 'QuestFlags', 'SpecialFlags', 'CharTitleId', 'RequiredMinRepFaction', 'RequiredMinRepValue', 'RequiredMaxRepFaction', 'RequiredMaxRepValue', 'SrcSpell', 'SkillOrClass', 'ReqSpellCast1', 'ReqSpellCast2', 'ReqSpellCast3', 'ReqSpellCast4');
59
60$locale_quest_cols = array('Title_loc'.$AoWoWconf['locale'], 'Details_loc'.$AoWoWconf['locale'], 'Objectives_loc'.$AoWoWconf['locale'], 'OfferRewardText_loc'.$AoWoWconf['locale'], 'RequestItemsText_loc'.$AoWoWconf['locale'], 'EndText_loc'.$AoWoWconf['locale'], 'ObjectiveText1_loc'.$AoWoWconf['locale'], 'ObjectiveText2_loc'.$AoWoWconf['locale'], 'ObjectiveText3_loc'.$AoWoWconf['locale'], 'ObjectiveText4_loc'.$AoWoWconf['locale']);
61
62function QuestReplaceStr($STR)
63{
64 global $smarty;
65 // сначала заменяем $N, $R, $C
66 $toreplace = array (
67 0=>array('1'=>'$b', '2'=>'<br />',),
68 1=>array('1'=>'$r', '2'=>'&lt;'.(isset($smarty) ? $smarty->get_config_vars('race') : 'race' ).'&gt;',),
69 2=>array('1'=>'$c', '2'=>'&lt;'.(isset($smarty) ? $smarty->get_config_vars('class') : 'class' ).'&gt;',),
70 3=>array('1'=>'$n', '2'=>'&lt;'.(isset($smarty) ? $smarty->get_config_vars('name') : 'name' ).'&gt;',),
71 4=>array('1'=>'$G', '2'=>'$g',),
72 );
73 for ($i=0;$i<=3;$i++)
74 {
75 $STR = str_replace($toreplace[$i][1], $toreplace[$i][2], $STR);
76 $STR = str_replace(strtoupper($toreplace[$i][1]), $toreplace[$i][2], $STR);
77 }
78 // теперь - пол
79 while(strpos($STR, '$g') || strpos($STR, '$G'))
80 {
81 $gPos = strpos($STR, '$g');
82 if(!$gPos)
83 $gPos = strpos($STR, '$G');
84 if($gPos)
85 {
86 $ePos = strpos($STR, ';', $gPos);
87 if(!$ePos)
88 return $STR; // error!
89 $string = explode(':', substr($STR, $gPos+2, $ePos));
90 $STR = substr($STR, 0, $gPos) . $string[0] . substr($STR, $ePos+1, 0xffff);
91 }
92 }
93 return $STR;
94}
95
96function GetQuestXpOrMoney($data)
97{
98 // From MaNGOS Sources
99 $pLevel = $data['QuestLevel']>0?$data['QuestLevel']:$data['MinLevel'];;
100 $qLevel = $data['QuestLevel'];
101 $RewMoneyMaxLevel = $data['RewMoneyMaxLevel'];
102 if(!$RewMoneyMaxLevel)
103 return 0;
104 if($qLevel >= 65)
105 $fullxp = floor($RewMoneyMaxLevel/6.0);
106 elseif($qLevel == 64)
107 $fullxp = floor($RewMoneyMaxLevel/4.8);
108 elseif($qLevel == 63)
109 $fullxp = floor($RewMoneyMaxLevel/3.6);
110 elseif($qLevel == 62)
111 $fullxp = floor($RewMoneyMaxLevel/2.4);
112 elseif($qLevel == 61)
113 $fullxp = floor($RewMoneyMaxLevel/1.2);
114 elseif($qLevel > 0 && $qLevel <= 60)
115 $fullxp = floor($RewMoneyMaxLevel/0.6);
116
117 if($pLevel <= $qLevel+5)
118 return $fullxp;
119 elseif($pLevel == $qLevel+6)
120 return $fullxp * 0.8;
121 elseif($pLevel == $qLevel+7)
122 return $fullxp * 0.6;
123 elseif($pLevel == $qLevel+8)
124 return $fullxp * 0.4;
125 elseif($pLevel == $qLevel+9)
126 return $fullxp*0.2;
127 else
128 return $fullxp*0.1;
129}
130
131// ????
132function GetQuestTitle(&$data)
133{
134 $title = QuestReplaceStr( !empty($data['Title_loc']) ? $data['Title_loc'] : $data['Title']);
135 $data['Title'] = $title;
136 return $title;
137}
138
139function GetQuestStrings(&$data)
140{
141 $data['Title'] = QuestReplaceStr( ( !empty($data['Title_loc']) ? $data['Title_loc'] : $data['Title'] ));
142 $data['Objectives'] = QuestReplaceStr(htmlspecialchars( !empty($data['Objectives_loc']) ? $data['Objectives_loc'] : $data['Objectives'] ));
143 $data['Details'] = QuestReplaceStr(htmlspecialchars( !empty($data['Details_loc']) ? $data['Details_loc'] : $data['Details'] ));
144 $data['RequestItemsText'] = QuestReplaceStr(htmlspecialchars( !empty($data['RequestItemsText_loc']) ? $data['RequestItemsText_loc'] : $data['RequestItemsText'] ));
145 $data['OfferRewardText'] = QuestReplaceStr(htmlspecialchars( !empty($data['OfferRewardText_loc']) ? $data['OfferRewardText_loc'] : $data['OfferRewardText'] ));
146 $data['EndText'] = QuestReplaceStr(htmlspecialchars( !empty($data['EndText_loc']) ? $data['EndText_loc'] : $data['EndText'] ));
147
148 for($j=0;$j<=3;++$j)
149 $data['ObjectiveText'][$j] = QuestReplaceStr(htmlspecialchars(!empty($data['ObjectiveText'.$j.'_loc']) ? $data['ObjectiveText'.$j.'_loc'] : $data['ObjectiveText'.$j]));
150}
151
152function GetQuestReq($id, $count, $type)
153{
154 global $DB;
155 switch($type)
156 {
157 case 1:
158 $row = $DB->selectRow('
159 SELECT name
160 {, l.name_loc?d AS name_loc}
161 FROM creature_template c
162 { LEFT JOIN (locales_creature l) ON l.entry=c.entry AND ? }
163 WHERE
164 c.entry = ?d
165 LIMIT 1
166 ',
167 ($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
168 ($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
169 $id
170 );
171 $name = !empty($row['name_loc'])?$row['name_loc']:$row['name'];
172 return $name.(($count>1)? (' x'.$count): '');
173 break;
174 case 2:
175 $row = $DB->selectRow('
176 SELECT name
177 {, l.name_loc?d AS name_loc}
178 FROM item_template c
179 { LEFT JOIN (locales_item l) ON l.entry=c.entry AND ? }
180 WHERE
181 c.entry = ?d
182 LIMIT 1
183 ',
184 ($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP,
185 ($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP,
186 $id
187 );
188 $name = !empty($row['name_loc'])?$row['name_loc']:$row['name'];
189 return $name.(($count>1)? (' x'.$count): '');
190 break;
191 }
192}
193
194function GetQuestTooltip($row)
195{
196 $x = '';
197
198 // Название квеста
199 $x .= '<table><tr><td><b class="q">'.$row['Title'].'</b></td></tr></table>';
200
201 $x .= '<table>';
202 if($row['Objectives'])
203 {
204 $x .= '<tr><td><br>';
205 $x .= $row['Objectives'];
206 $x .= '</td></tr>';
207 }
208
209// $x .= '<br>';
210
211 if ((($row['ReqCreatureOrGOId1']) and ($row['ReqCreatureOrGOCount1'])) or
212 (($row['ReqCreatureOrGOId2']) and ($row['ReqCreatureOrGOCount2'])) or
213 (($row['ReqCreatureOrGOId3']) and ($row['ReqCreatureOrGOCount3'])) or
214 (($row['ReqCreatureOrGOId4']) and ($row['ReqCreatureOrGOCount4'])) or
215 (($row['ReqItemId1']) and ($row['ReqItemCount1'])) or
216 (($row['ReqItemId2']) and ($row['ReqItemCount2'])) or
217 (($row['ReqItemId3']) and ($row['ReqItemCount3'])) or
218 (($row['ReqItemId4']) and ($row['ReqItemCount4'])))
219 {
220 $x .= '<tr><td><br>';
221 $x .= '<div class="q">'.LOCALE_REQUIREMENTS.':<br></div>';
222 for ($j=1;$j<=4;$j++)
223 if ($row['ReqCreatureOrGOId'.$j] and $row['ReqCreatureOrGOCount'.$j])
224 $x .= '- '
225 .(
226 (!empty($row['ObjectiveText'][$j]))?
227 $row['ObjectiveText'][$j]:
228 GetQuestReq($row['ReqCreatureOrGOId'.$j], $row['ReqCreatureOrGOCount'.$j], 1)
229 ).'<br>';
230 for ($j=1;$j<=4;$j++)
231 if ($row['ReqItemId'.$j] and $row['ReqItemCount'.$j])
232 $x .= '- '.GetQuestReq($row['ReqItemId'.$j], $row['ReqItemCount'.$j], 2).'<br>';
233 $x .= '</td></tr>';
234 }
235 $x .= '</table>';
236
237 return $x;
238}
239
240function GetQuestDBLocale($quest)
241{
242 global $DB;
243 $data = array();
244 $loc = $_SESSION['locale'];
245 $row = $DB->selectRow('
246 SELECT
247 Title_loc?d AS Title,
248 Details_loc?d AS Details,
249 Objectives_loc?d AS Objectives,
250 OfferRewardText_loc?d AS OfferRewardText,
251 RequestItemsText_loc?d AS RequestItemsText,
252 EndText_loc?d AS EndText,
253 ObjectiveText1_loc?d AS ObjectiveText1,
254 ObjectiveText2_loc?d AS ObjectiveText2,
255 ObjectiveText3_loc?d AS ObjectiveText3,
256 ObjectiveText4_loc?d AS ObjectiveText4
257 FROM locales_quest
258 WHERE entry = ?d
259 LIMIT 1
260 ',
261 $loc, $loc, $loc, $loc, $loc, $loc, $loc, $loc, $loc, $loc,
262 $quest
263 );
264 if($row)
265 foreach($row as $item => $itemContent)
266 if(!empty($itemContent))
267 $data[$item] = $itemContent;
268 return $data;
269}
270
271function GetDBQuestInfo($id, $dataflag = QUEST_DATAFLAG_MINIMUM)
272{
273 global $DB, $questcols, $quest_class;
274 $data = $DB->selectRow('
275 SELECT
276 1
277 {, ?# } {, ?# } {, ?# } {, ?# } {, ?# }
278 FROM quest_template
279 WHERE entry=?d
280 LIMIT 1
281 ',
282 ($dataflag & QUEST_DATAFLAG_MINIMUM)?$questcols[QUEST_DATAFLAG_MINIMUM]:DBSIMPLE_SKIP,
283 ($dataflag & QUEST_DATAFLAG_STRINGS)?$questcols[QUEST_DATAFLAG_STRINGS]:DBSIMPLE_SKIP,
284 ($dataflag & QUEST_DATAFLAG_SERIES) ?$questcols[QUEST_DATAFLAG_SERIES] :DBSIMPLE_SKIP,
285 ($dataflag & QUEST_DATAFLAG_PROPS) ?$questcols[QUEST_DATAFLAG_PROPS] :DBSIMPLE_SKIP,
286 ($dataflag & QUEST_DATAFLAG_REWARDS)?$questcols[QUEST_DATAFLAG_REWARDS]:DBSIMPLE_SKIP,
287 $id
288 );
289 if(!$data)
290 return false;
291 else
292 return GetQuestInfo($data, $dataflag);
293}
294
295/*
296 * &$data - ссылка на массив с данными
297 * $dataflag - флаг уровень:
298 * QUEST_DATAFLAG_MINIMUN - entry, Title
299 * QUEST_DATAFLAG_STRINGS - Objectives, Details, RequestItemsText, OfferRewardText, EndText, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4
300 * QUEST_DATAFLAG_SERIES - PrevQuestID, NextQuestInChain, ExclusiveGroup, NextQuestID
301 * QUEST_DATAFLAG_PROPS - Daily, Type, side, etc.
302 * QUEST_DATAFLAG_REWARDS - RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6, RewChoiceItemCount1', 'RewChoiceItemCount2, RewChoiceItemCount3, 'RewChoiceItemCount4', 'RewChoiceItemCount5', 'RewChoiceItemCount6', 'RewItemId1', 'RewItemId2', 'RewItemId3', 'RewItemId4', 'RewItemCount1', 'RewItemCount2', 'RewItemCount3', 'RewItemCount4', 'RewMoneyMaxLevel', 'RewOrReqMoney', 'ReqSpellCast1', 'ReqSpellCast2', 'ReqSpellCast3', 'ReqSpellCast4', 'ReqCreatureOrGOId1', 'ReqCreatureOrGOId2', 'ReqCreatureOrGOId3', 'ReqCreatureOrGOId4', 'ReqItemId1', 'ReqItemId2', 'ReqItemId3', 'ReqItemId4', 'ReqItemCount1', 'ReqItemCount2', 'ReqItemCount3', 'ReqItemCount4', 'SrcItemId', 'ReqCreatureOrGOCount1', 'ReqCreatureOrGOCount2', 'ReqCreatureOrGOCount3', 'ReqCreatureOrGOCount4
303 *
304 */
305function GetQuestInfo(&$data, $dataflag = QUEST_DATAFLAG_MINIMUM)
306{
307 global $DB, $quest_class;
308 /*else
309 {
310 $data = $DB->selectRow('
311 SELECT
312 1
313 {, ?# } {, ?# } {, ?# } {, ?# } {, ?# }
314 FROM quest_template
315 WHERE entry=?d
316 LIMIT 1
317 ',
318 ($dataflag & QUEST_DATAFLAG_MINIMUM)?$questcols[QUEST_DATAFLAG_MINIMUM]:DBSIMPLE_SKIP,
319 ($dataflag & QUEST_DATAFLAG_STRINGS)?$questcols[QUEST_DATAFLAG_STRINGS]:DBSIMPLE_SKIP,
320 ($dataflag & QUEST_DATAFLAG_SERIES) ?$questcols[QUEST_DATAFLAG_SERIES] :DBSIMPLE_SKIP,
321 ($dataflag & QUEST_DATAFLAG_PROPS) ?$questcols[QUEST_DATAFLAG_PROPS] :DBSIMPLE_SKIP,
322 ($dataflag & QUEST_DATAFLAG_REWARDS)?$questcols[QUEST_DATAFLAG_REWARDS]:DBSIMPLE_SKIP,
323 $data['entry']
324 );
325 }
326 if(!$data)
327 {
328 return false;
329 }*/
330
331 // Локализация
332 $loc = $_SESSION['locale'];
333 if($dataflag & QUEST_DATAFLAG_LOCALE && $_SESSION['locale'] > 0)
334 $data = array_merge($data, $DB->selectRow('
335 SELECT
336 Title_loc?d AS Title_loc,
337 Details_loc?d AS Details_loc,
338 Objectives_loc?d AS Objectives_loc,
339 OfferRewardText_loc?d AS OfferRewardText_loc,
340 RequestItemsText_loc?d AS RequestItemsText_loc,
341 EndText_loc?d AS EndText_loc,
342 ObjectiveText1_loc?d AS ObjectiveText1_loc,
343 ObjectiveText2_loc?d AS ObjectiveText2_loc,
344 ObjectiveText3_loc?d AS ObjectiveText3_loc,
345 ObjectiveText4_loc?d AS ObjectiveText4_loc
346 FROM locales_quest
347 WHERE entry = ?d
348 LIMIT 1
349 ',
350 $loc, $loc, $loc, $loc, $loc, $loc, $loc, $loc, $loc, $loc,
351 $data['entry']
352 ));
353 // Минимальные данные
354 // ID квеста
355 $data['entry'] = $data['entry'];
356 // Имя квеста
357 $data['Title'] = GetQuestTitle($data);
358
359 // Описания
360 if($dataflag & QUEST_DATAFLAG_STRINGS)
361 GetQuestStrings($data);
362
363 // Свойства
364 if($dataflag & QUEST_DATAFLAG_PROPS)
365 {
366 // Уровень квеста
367 $data['QuestLevel'] = $data['QuestLevel'];
368 // Требуемый уровень квеста
369 $data['MinLevel'] = $data['MinLevel'];
370 // Доступен расам
371 $data['side'] = races($data['RequiredRaces']);
372 // Флаги
373 $data['QuestFlags'] = $data['QuestFlags'];
374 // Ежедневный квест?
375 if ($data['QuestFlags'] & QUEST_FLAGS_DAILY)
376 $data['Daily'] = true;
377 // Тип квеста
378 $data['type'] = $data['Type'];
379 if ($data['type'] == 1)
380 $data['typename'] = 'Group';
381 else
382 $data['typename'] = $data['type'];
383 // Путь к этому разделу (главная категория)
384 foreach($quest_class as $i => $class)
385 if(in_array($data['ZoneOrSort'], $class))
386 {
387 $data['maincat']=$i;
388 break;
389 }
390 // Категория 1
391 $data['category'] = $data['ZoneOrSort'];
392 // Категория 2 ???
393 $data['category2'] = $data['QuestFlags'];
394 // Требуемое пати
395 if ($data['SuggestedPlayers']>1)
396 $data['splayers'] = $data['SuggestedPlayers'];
397 // Лимит времени
398 if ($data['LimitTime']>0)
399 $data['LimitTime'] = sec_to_time($row['LimitTime']);
400 if ($data['QuestFlags'] & QUEST_FLAGS_SHARABLE)
401 $data['Sharable'] = true;
402 if ($data['SpecialFlags'] & QUEST_SPECIALFLAGS_REPEATABLE)
403 $data['Repeatable'] = true;
404 if ($data['CharTitleId']>0)
405 $data['titlereward'] = $DB->selectCell('SELECT name FROM ?_char_titles WHERE id=?d LIMIT 1', $row['CharTitleId']);
406 }
407
408 // Награды и задания
409 if($dataflag & QUEST_DATAFLAG_REWARDS)
410 {
411 // Опыт/деньги@70
412 $data['xp'] = GetQuestXpOrMoney($data);
413 // Награды вещей
414 for($j=0;$j<=6;++$j)
415 if (($data['RewChoiceItemId'.$j]!=0) and ($data['RewChoiceItemCount'.$j]!=0))
416 $data['itemchoices'][] = array_merge(
417 allitemsinfo($data['RewChoiceItemId'.$j], 0),
418 array('count' => $data['RewChoiceItemCount'.$j])
419 );
420 for ($j=0;$j<=4;++$j)
421 if (($data['RewItemId'.$j]!=0) and ($data['RewItemCount'.$j]!=0))
422 $data['itemrewards'][] = array_merge(
423 allitemsinfo($data['RewItemId'.$j], 0),
424 array('count' => $data['RewItemCount'.$j])
425 );
426 // Вознаграждение репутацией
427 for ($j=1;$j<=5;$j++)
428 if (($data['RewRepFaction'.$j] != 0) && ($data['RewRepValue'.$j] != 0))
429 $data['reprewards'][] = array_merge(factioninfo($data['RewRepFaction'.$j]), array('value' => $data['RewRepValue'.$j]));
430 // Вознаграждение деньгами
431 if($data['money']>0)
432 $data['money'] = money2coins($data['money']);
433 elseif($data['money']<0)
434 $data['moneyreq'] = money2coins(-$data['money']);
435 }
436
437 // Последовательность квестов, требования, цепочки
438 if($dataflag & QUEST_DATAFLAG_SERIES)
439 {
440 // не используется для вычисления самих сериесов, исключительно для внесения соответствующих полей в массив информации
441 }
442
443 // Все ОК. Это не обязательный return, но в некоторых функциях нужен.
444 return $data;
445}
446?>
Note: See TracBrowser for help on using the repository browser.