2 include_once("conf.php");
3 include_once("include/functions.php");
5 function getQuestText($quest_text)
7 $letter = array( '$b' ,'$B$B', '$B' , '$N' , '$n' , '$C' , '$r');
8 $values = array('<br>','<br>','<br>','(Name)', '(Name)','(Class)', '(Race)');
9 return str_replace($letter, $values, $quest_text);
12 function renderReqCollect($item_id, $maxcount, $count)
16 $name=getItemName($item_id);
17 echo "<tr><td> <a href=\"?item=$item_id\">$name</a>: $count/$maxcount</td></tr>";
20 function renderReqKillOrCast($text,$ReqCreatureOrGOId,$ReqCreatureOrGOCount,$ReqSpellCast, $count)
23 if ($ReqCreatureOrGOId>0)
25 echo "<tr><td><a style='float: right;' href=\"?map&npc=$ReqCreatureOrGOId\">$lang[map]</a> ";
26 if ($ReqSpellCast==0) // Требуется убить моба
29 echo "<a href=\"?npc=$ReqCreatureOrGOId\">$text</a>";
31 echo $lang['kill'].' '.getCreatureName($ReqCreatureOrGOId);
35 // $spell_name=getSpellName($ReqSpellCast);
36 if (!$text) $text = $lang['cast'];
37 echo "<a href=\"?spell=$ReqSpellCast\">$text</a> $lang[cast_on] ".getCreatureName($ReqCreatureOrGOId);
39 echo ": $count/$ReqCreatureOrGOCount</td></tr>";
41 else if ($ReqCreatureOrGOId<0)
43 $ReqCreatureOrGOId=-$ReqCreatureOrGOId;
44 echo "<tr><td><a style='float: right;' href=\"?map&obj=$ReqCreatureOrGOId\">$lang[map]</a> ";
45 if ($ReqSpellCast==0) // Требуется использовать геймобьект
48 echo "<a href=\"?object=$ReqCreatureOrGOId\">$text</a>";
50 echo $lang['use'].' '.getGameobjectName($ReqCreatureOrGOId);
54 if (!$text) $text = $lang['cast'];
55 // $spell_name=getSpellName($ReqSpellCast);
56 echo "<a href=\"?spell=$ReqSpellCast\">$text</a> $lang[cast_on] ".getGameobjectName($ReqCreatureOrGOId);
58 echo ": $count/$ReqCreatureOrGOCount</td></tr>";
61 function renderQuestSource($srcID, $srcCount)
65 $name=getItemName($srcID);
66 echo "<tr><td> <a href=\"?item=$srcID\">$name</a>".($srcCount?
' x '.$srcCount:'').'</td></tr>';
71 $entry = intval(@$_REQUEST['quest']);
72 $guid = intval(@$_REQUEST['guid']);
74 $quest=getQuest($entry);
77 RenderError("$lang[quest_not_found1]");
83 $q_status = $cDB->selectRow("SELECT * FROM `character_queststatus` WHERE `guid` = ?d AND `quest` = ?d", $guid, $entry);
84 if ($lang['www_quest'])
85 echo "<a href=\"".sprintf($lang['www_quest'], $entry)."\" target=\"_blank\"\">".sprintf($lang['www_quest'], $entry)."</a><br>";
87 echo "<table class=quest width=550>";
90 echo "<tr><td class=head>$quest[Title]";
92 echo "<br><FONT size=-3><".getQuestType($quest['Type'])."></FONT>";
94 if (getAllowableRace($quest['RequiredRaces']) && ($quest['RequiredRaces'] & 1101) && ($quest['RequiredRaces'] !=1791))
96 echo "<br><FONT color=#0000ff>$lang[required_races] $lang[Alliance] </FONT><img width=22 height=22 src='images/player_info/factions_img/alliance.gif'>";
97 echo '<br><FONT color=#0000ff>'.$game_text['allowable_race'].' '.getAllowableRace($quest['RequiredRaces']).'</FONT>';
100 if (getAllowableRace($quest['RequiredRaces']) && ($quest['RequiredRaces'] & 690) && ($quest['RequiredRaces'] !=1791))
102 echo "<br><FONT color=#ff0000>$lang[required_races] $lang[Horde] </FONT><img width=22 height=22 src='images/player_info/factions_img/horde.gif'>";
103 echo '<br><FONT color=#ff0000>'.$game_text['allowable_race'].' '.getAllowableRace($quest['RequiredRaces']).'</FONT>';
106 if (($quest['RequiredRaces'] == 0) OR ($quest['RequiredRaces'] == 1791))
109 echo "<br><FONT color=#008800>$lang[required_races] $lang[Both]</FONT>";
110 echo '<br><FONT color=#008800>'.$game_text['allowable_race'].' '.getAllowableRace(1791).'</FONT>';
113 if (getAllowableClass($quest['RequiredClasses']))
114 echo '<br><FONT color=#000000>'.$game_text['allowable_class'].' '.getAllowableClass($quest['RequiredClasses']).'</FONT>';
116 if ($entry == getQuestOld($entry))
117 echo '<br><FONT color=#ff0000><b>'.$lang['quest_marked'].'</FONT></b>';
123 if ($quest['ZoneOrSort']>0)
124 echo "<a style='float: right;' href=\"?s=q&ZoneID=".$quest['ZoneOrSort']."\">".getAreaName($quest['ZoneOrSort'], 0)."</a>";
126 if ($quest['ZoneOrSort']<0 AND ((-$quest['ZoneOrSort']) >= 374 OR (-$quest['ZoneOrSort']) == 221 OR (-$quest['ZoneOrSort']) == 241 OR ((-$quest['ZoneOrSort']) >= 344 AND (-$quest['ZoneOrSort']) < 371) or
127 (-$quest['ZoneOrSort']) == 284 OR (-$quest['ZoneOrSort']) == 25 OR (-$quest['ZoneOrSort']) == 41 OR (-$quest['ZoneOrSort']) < 24))
128 echo "<a style='float: right;' href=\"?s=q&SortID=".(-$quest['ZoneOrSort'])."\">".getQuestSort(-$quest['ZoneOrSort'], 0)."</a>";
130 echo "$lang[quest_level] $quest[QuestLevel]<br>";
132 if ($quest['RequiredSkill'])
133 echo "<a style='float: right;' href=\"?s=q&SkillID=".($quest['RequiredSkill'])."\">".getSkillName($quest['RequiredSkill'], 0)." ($quest[RequiredSkillValue])</a>";
134 echo "$lang[obtained_at_level] $quest[MinLevel]</td></tr>";
136 if ($quest['SuggestedPlayers'])
137 echo "<tr><td>$lang[suggestedplayers] <b>$quest[SuggestedPlayers]</b></td></tr>";
139 if ($quest['LimitTime'])
140 echo '<tr><td>'.$lang['qlimittime'].' '.getTimeText($quest['LimitTime']).'</td></tr>';
142 if (getGameEventQuest($quest['entry']))
144 $qevent=getGameEventQuest($quest['entry']);
145 echo '<tr><td>'.$lang['obtained_at_event'].': <FONT color=#E614E6>'.getGameEventName($qevent).'</FONT></td></tr>';
148 if ($quest['SpecialFlags'] & QUEST_SPECIAL_FLAG_MONTHLY
)
149 echo "<tr><td>$lang[item_type]: <a href=\"?s=q&Sfm=".($quest['SpecialFlags'])."\">".$lang['quest_type3']."</a></td></tr>";
151 if ($quest['QuestFlags'] & QUEST_FLAGS_WEEKLY
)
152 echo "<tr><td>$lang[item_type]: <a href=\"?s=q&Sfw=".($quest['QuestFlags'])."\">".$lang['quest_type2']."</a></td></tr>";
154 if ($quest['QuestFlags'] & QUEST_FLAGS_DAILY
)
155 echo "<tr><td>$lang[item_type]: <a href=\"?s=q&Sfd=".($quest['QuestFlags'])."\">".$lang['quest_type1']."</a></td></tr>";
157 if (($quest['SpecialFlags'] & QUEST_SPECIAL_FLAG_REPEATABLE
) && (($quest['SpecialFlags'] & QUEST_SPECIAL_FLAG_MONTHLY
) ==0)&& ($quest['QuestFlags'] & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY
)) == 0)
158 echo "<tr><td>$lang[item_type]: <a href=\"?s=q&Sfr=".($quest['SpecialFlags'])."\">".$lang['quest_type0']."</a></td></tr>";
160 if ($quest['RequiredMinRepFaction'])
161 echo "<tr><td>$lang[item_faction_rank]:</td></tr>";
163 if ($quest['RequiredMinRepFaction'])
164 echo "<tr><td> ".getFactionName($quest['RequiredMinRepFaction']).": $quest[RequiredMinRepValue]($lang[item_min_level])</td></tr>";
166 if ($quest['RequiredMaxRepFaction'])
167 echo "<tr><td>".getFactionName($quest['RequiredMaxRepFaction']).": $quest[RequiredMaxRepValue]($lang[item_max_level])</td></tr>";
169 echo "<tr><td>".getQuestText($quest['Objectives'])."<hr></td></tr>";
171 if ($quest['RepObjectiveFaction'])
172 echo "<tr><td>$lang[item_faction_rank]:</td></tr>";
174 if ($quest['RepObjectiveFaction'])
175 echo "<tr><td> ".getFactionName($quest['RepObjectiveFaction']).": $quest[RepObjectiveValue]($lang[item_min_level])</td></tr>";
177 if ($quest['ReqItemId1'] OR $quest['ReqItemId2'] OR $quest['ReqItemId3'] OR $quest['ReqItemId4'] OR $quest['ReqItemId5'] OR $quest['ReqItemId6'])
179 echo "<tr><td class=mark>$lang[collect]</td></tr>";
180 renderReqCollect($quest['ReqItemId1'],$quest['ReqItemCount1'],$q_status?
$q_status['itemcount1']:0);
181 renderReqCollect($quest['ReqItemId2'],$quest['ReqItemCount2'],$q_status?
$q_status['itemcount2']:0);
182 renderReqCollect($quest['ReqItemId3'],$quest['ReqItemCount3'],$q_status?
$q_status['itemcount3']:0);
183 renderReqCollect($quest['ReqItemId4'],$quest['ReqItemCount4'],$q_status?
$q_status['itemcount4']:0);
184 renderReqCollect($quest['ReqItemId5'],$quest['ReqItemCount5'],$q_status?
$q_status['itemcount5']:0);
185 renderReqCollect($quest['ReqItemId6'],$quest['ReqItemCount6'],$q_status?
$q_status['itemcount6']:0);
189 if ($quest['ReqCreatureOrGOId1'] != 0 OR $quest['ReqCreatureOrGOId2'] != 0 OR
190 $quest['ReqCreatureOrGOId3'] != 0 OR $quest['ReqCreatureOrGOId4'] != 0 )
192 // echo "<tr><td class=mark>$lang[kill]</td></tr>";
193 renderReqKillOrCast($quest['ObjectiveText1'],$quest['ReqCreatureOrGOId1'],$quest['ReqCreatureOrGOCount1'],$quest['ReqSpellCast1'],$q_status?
$q_status['mobcount1']:0);
194 renderReqKillOrCast($quest['ObjectiveText2'],$quest['ReqCreatureOrGOId2'],$quest['ReqCreatureOrGOCount2'],$quest['ReqSpellCast2'],$q_status?
$q_status['mobcount2']:0);
195 renderReqKillOrCast($quest['ObjectiveText3'],$quest['ReqCreatureOrGOId3'],$quest['ReqCreatureOrGOCount3'],$quest['ReqSpellCast3'],$q_status?
$q_status['mobcount3']:0);
196 renderReqKillOrCast($quest['ObjectiveText4'],$quest['ReqCreatureOrGOId4'],$quest['ReqCreatureOrGOCount4'],$quest['ReqSpellCast4'],$q_status?
$q_status['mobcount4']:0);
199 if ($quest['ReqSourceId1'] != 0 OR $quest['ReqSourceId2'] != 0 OR
200 $quest['ReqSourceId3'] != 0 OR $quest['ReqSourceId4'] != 0 )
202 echo "<tr><td class=mark>$lang[req_items]</td></tr>";
203 renderQuestSource($quest['ReqSourceId1'],$quest['ReqSourceCount1']);
204 renderQuestSource($quest['ReqSourceId2'],$quest['ReqSourceCount2']);
205 renderQuestSource($quest['ReqSourceId3'],$quest['ReqSourceCount3']);
206 renderQuestSource($quest['ReqSourceId4'],$quest['ReqSourceCount4']);
210 echo "<tr><td>".getQuestText($quest['Details'])."</td></tr>";
211 if ($quest['CompletedText'])
213 echo "<tr><td class = head>$lang[quest_completed]</td></tr>";
214 echo '<tr><td>'.$quest['CompletedText'].'</td></tr>';
216 if ($quest['SrcItemId'] ||
$quest['SrcSpell'])
218 echo "<tr><td class = head>$lang[provided]</td></tr>";
219 if ($quest['SrcItemId'])
221 $item = getItem($quest['SrcItemId'], "`entry`, `name`, `Quality`, `displayid`");
222 echo '<tr><td class=reward> '.text_show_item($item['entry'], $item['displayid']);
223 echo ' <a class='.$Quality[$item['Quality']].' href="?item='.$item['entry'].'">'.$item['name'].'</a>';
224 if ($quest['SrcItemCount']>1) echo " x$quest[SrcItemCount]";
227 if ($quest['SrcSpell'])
229 $spell=getSpell($quest['SrcSpell']); // Кастуемый спелл
230 if ($spell) $spellName = getSpellName($spell);
231 else $spellName = "Spell $quest[SrcSpell]";
232 echo "<tr><td class=reward> ";show_spell($spell['id'], $spell['SpellIconID']);
233 echo " <a href=\"?spell=$spell[id]\">$spell[SpellName]</a></td></tr>";
236 echo "<tr><td class = head>$lang[quest_rewards]</td></tr>";
238 if ($quest['RewItemId1'] OR $quest['RewItemId1'] OR $quest['RewItemId1'] OR $quest['RewItemId1'])
240 echo "<tr><td class=mark>$lang[Rew_item]</td></tr>";
241 echo "<tr><td class=reward> ";
242 if ($quest['RewItemId1']) {show_item($quest['RewItemId1']);}
243 if ($quest['RewItemId2']) {echo $lang['item_sel_and'];show_item($quest['RewItemId2']);}
244 if ($quest['RewItemId3']) {echo $lang['item_sel_and'];show_item($quest['RewItemId3']);}
245 if ($quest['RewItemId4']) {echo $lang['item_sel_and'];show_item($quest['RewItemId4']);}
248 if ($quest['RewChoiceItemId1'] OR $quest['RewChoiceItemId2'] OR $quest['RewChoiceItemId3'] OR
249 $quest['RewChoiceItemId4'] OR $quest['RewChoiceItemId5'] OR $quest['RewChoiceItemId6'])
251 echo "<tr><td class=mark>$lang[Rew_select_item]</td></tr>";
252 echo "<tr><td class=reward> ";
253 if ($quest['RewChoiceItemId1']) {show_item($quest['RewChoiceItemId1']);}
254 if ($quest['RewChoiceItemId2']) {echo $lang['item_sel_or'];show_item($quest['RewChoiceItemId2']);}
255 if ($quest['RewChoiceItemId3']) {echo $lang['item_sel_or'];show_item($quest['RewChoiceItemId3']);}
256 if ($quest['RewChoiceItemId4']) {echo $lang['item_sel_or'];show_item($quest['RewChoiceItemId4']);}
257 if ($quest['RewChoiceItemId5']) {echo $lang['item_sel_or'];show_item($quest['RewChoiceItemId5']);}
258 if ($quest['RewChoiceItemId6']) {echo $lang['item_sel_or'];show_item($quest['RewChoiceItemId6']);}
261 if ($quest['RewMailTemplateId'])
263 $MailTime=$quest['RewMailDelaySecs']/60/60;
264 $ItemMail=getItemMail($quest['RewMailTemplateId']);
267 echo "<tr><td class=mark>$lang[Rew_mail] $lang[Mail_item_time]".$MailTime."$lang[Mail_time]";
268 echo "<tr><td class=mark>$lang[Rew_item_mail]</td></tr>";
269 echo "<tr><td class=reward> ";{show_item($ItemMail);}
274 echo "<tr><td class=mark>$lang[Rew_mail] $lang[Mail_item_time]".$MailTime."$lang[Mail_time]";
278 if ($quest['RewSpell'] ||
$quest['RewSpellCast'])
280 $learn = $quest['RewSpell'] ?
$quest['RewSpell'] : $quest['RewSpellCast'];
281 $spell=getSpell($learn);
282 if ($spell) $spellName = getSpellName($spell);
283 else $spellName = "Spell $learn";
284 echo '<tr><td class=mark>'.($quest['RewSpell']?
$lang['learn_spell']:$lang['cast_spell']).'</td></tr>';
285 echo "<tr><td class=reward> ";show_spell($spell['id'], $spell['SpellIconID']);
286 echo " <a href=\"?spell=$spell[id]\">$spell[SpellName]</a></td></tr>";
289 for ($i = 1; $i <= 5; $i++
)
291 switch (ABS($quest['RewRepValueId'.$i])):
292 case 1: $RepValueId[$i] = 10; break;
293 case 2: $RepValueId[$i] = 25; break;
294 case 3: $RepValueId[$i] = 75; break;
295 case 4: $RepValueId[$i] = 150; break;
296 case 5: $RepValueId[$i] = 250; break;
297 case 6: $RepValueId[$i] = 350; break;
298 case 7: $RepValueId[$i] = 500; break;
299 case 8: $RepValueId[$i] = 1000; break;
300 case 9: $RepValueId[$i] = 5; break;
301 default: $RepValueId[$i] = 0;
304 $quest_rate[$i] = getRepRewRate($quest['RewRepFaction'.$i]);
306 if ($quest['RewRepValueId'.$i] < 0)
307 $RepValueId[$i] = -$RepValueId[$i];
309 if ($quest['RewRepValue'.$i] && $quest['RewRepValueId'.$i])
310 $quest['RewRepValue'.$i] = $quest['RewRepValue'.$i]/100;
312 if (!$quest['RewRepValue'.$i] && $quest['RewRepValueId'.$i])
313 $quest['RewRepValue'.$i] = $RepValueId[$i];
315 $quest['RewRepValue'.$i]=$quest['RewRepValue'.$i]*$quest_rate[$i];
318 if ($quest['RewRepFaction1'] AND !$quest['RewRepFaction2'] AND
319 !$quest['RewRepFaction3'] AND !$quest['RewRepFaction4'] AND
320 !$quest['RewRepFaction5'])
322 $spillover=getRepSpillover($quest['RewRepFaction1']);
324 foreach ($spillover as $faction)
326 if ($faction['faction1'])
328 $quest['RewRepFaction2']=$faction['faction1'];
329 $quest['RewRepValue2']=$quest['RewRepValue1']*$faction['rate_1'];
331 if ($faction['faction2'])
333 $quest['RewRepFaction3']=$faction['faction2'];
334 $quest['RewRepValue3']=$quest['RewRepValue1']*$faction['rate_2'];
336 if ($faction['faction3'])
338 $quest['RewRepFaction4']=$faction['faction3'];
339 $quest['RewRepValue4']=$quest['RewRepValue1']*$faction['rate_3'];
341 if ($faction['faction4'])
343 $quest['RewRepFaction5']=$faction['faction4'];
344 $quest['RewRepValue5']=$quest['RewRepValue1']*$faction['rate_4'];
349 if ($quest['RewRepFaction1'] OR $quest['RewRepFaction2'] OR
350 $quest['RewRepFaction3'] OR $quest['RewRepFaction4'] OR
351 $quest['RewRepFaction5'])
353 echo "<tr><td class=mark>$lang[Rew_reputation]</td></tr>";
354 if ($quest['RewRepFaction1'] && $quest['RewRepValue1'])echo "<tr><td> ".getFactionName($quest['RewRepFaction1']).": $quest[RewRepValue1]</td></tr>";
355 if ($quest['RewRepFaction2'] && $quest['RewRepValue2'])echo "<tr><td> ".getFactionName($quest['RewRepFaction2']).": $quest[RewRepValue2]</td></tr>";
356 if ($quest['RewRepFaction3'] && $quest['RewRepValue3'])echo "<tr><td> ".getFactionName($quest['RewRepFaction3']).": $quest[RewRepValue3]</td></tr>";
357 if ($quest['RewRepFaction4'] && $quest['RewRepValue4'])echo "<tr><td> ".getFactionName($quest['RewRepFaction4']).": $quest[RewRepValue4]</td></tr>";
358 if ($quest['RewRepFaction5'] && $quest['RewRepValue5'])echo "<tr><td> ".getFactionName($quest['RewRepFaction5']).": $quest[RewRepValue5]</td></tr>";
360 if($quest['RewMoneyMaxLevel']) echo "<tr><td class=mark>$lang[Rew_XP] ".getQuestXPValue($quest)." xp";
361 if($quest['RewHonorAddition'] OR $quest['RewHonorMultiplier'])
363 if ($quest['RewHonorMultiplier'])
364 $ihonor=getTeamContributionPoints(79)*$quest['RewHonorMultiplier']*0.1+
$quest['RewHonorAddition'];
366 $ihonor=$quest['RewHonorAddition'];
367 echo "<tr><td class=mark>$lang[Rew_honor] ".$ihonor;
369 if($quest['RewOrReqMoney']) echo "<tr><td class=mark>$lang[Rew_money] ".money($quest['RewOrReqMoney'])."</td></tr>";
373 echo "<tr><td class = head>$lang[start]:</td></tr>";
374 if ($rows = $dDB->select("SELECT *
375 FROM `creature_template` join `creature_questrelation`
377 `creature_questrelation`.`quest` = ?d AND
378 `creature_questrelation`.`id` = `creature_template`.`entry`", $quest['entry']))
379 foreach ($rows as $creature)
381 localiseCreature($creature);
382 $loyality = getLoyality($creature['faction_A']);
383 echo "<tr><td><a style='float: right;' href=\"?map&npc=$creature[entry]\">$lang[map]</a>";
384 echo "<a href=\"?npc=$creature[entry]\">$creature[name]</a> ($loyality)";
385 if ($creature['subname'] != "")
386 echo "<br><FONT color=#008800 size=-3><$creature[subname]></FONT>";
391 if ($rows = $dDB->select("SELECT *
392 FROM `gameobject_template` join `gameobject_questrelation`
394 `gameobject_questrelation`.`quest` = ?d AND
395 `gameobject_questrelation`.`id` = `gameobject_template`.`entry`", $quest['entry']))
396 foreach ($rows as $go)
398 localiseGameobject($go);
399 echo "<tr><td><a style='float: right;' href=\"?map&obj=$go[entry]\">$lang[map]</a>";
400 echo "<a href=\"?object=$go[entry]\">$go[name]</a></td></tr>";
404 if ($rows = $dDB->select("SELECT `entry`, `name`,`Quality`, `displayid` FROM `item_template` WHERE `startquest` = ?d", $quest['entry']))
405 foreach ($rows as $item)
408 echo '<tr><td class=reward> '.text_show_item($item['entry'], $item['displayid']);
409 echo ' <a class='.$Quality[$item['Quality']].' href="?item='.$item['entry'].'">'.$item['name'].'</a>';
414 echo "<tr><td bgColor=#ff0000>$lang[quest_not_found]</td></tr>";
417 echo "<tr><td class = head>$lang[end_q]:</td></tr>";
418 if ($rows = $dDB->select("SELECT *
419 FROM `creature_template` join `creature_involvedrelation`
421 `creature_involvedrelation`.`quest` = ?d AND
422 `creature_involvedrelation`.`id` = `creature_template`.`entry`", $quest['entry']))
423 foreach ($rows as $creature)
425 localiseCreature($creature);
426 $loyality = getLoyality($creature['faction_A']);
427 echo "<tr><td><a style='float: right;' href=\"?map&npc=$creature[entry]\">$lang[map]</a>";
428 echo "<a href=\"?npc=$creature[entry]\">$creature[name]</a> ($loyality)";
429 if ($creature['subname'] != "")
430 echo "<br><FONT color=#008800 size=-3><$creature[subname]></FONT>";
435 if ($rows = $dDB->select("SELECT *
436 FROM `gameobject_template` join `gameobject_involvedrelation`
438 `gameobject_involvedrelation`.`quest` = ?d AND
439 `gameobject_involvedrelation`.`id` = `gameobject_template`.`entry`", $quest['entry']))
440 foreach ($rows as $go)
442 localiseGameobject($go);
443 echo "<tr><td><a style='float: right;' href=\"?map&obj=$go[entry]\">$lang[map]</a>";
444 echo "<a href=\"?object=$go[entry]\">$go[name]</a></td></tr>";
449 echo "<tr><td bgColor=#ff0000>$lang[quest_not_found]</td></tr>";
451 ### этот квест часть серии:
452 $needForQuest = $dDB->selectRow("SELECT * FROM `quest_template` WHERE ABS(`PrevQuestId`) = ?d", $quest['entry']);
453 if ($quest['PrevQuestId'] != 0 OR $quest['NextQuestId'] != 0 OR $needForQuest)
455 echo "<tr><td class = head>$lang[this_quest_is_part_of_a_series]</td></tr>";
457 // Разматываем цепочку квестов назад
458 if ($quest['PrevQuestId']!=0)
460 $prevquest[0]=$quest;
462 while ($prevquest[$list]['PrevQuestId']!=0)
464 $qbefore = getQuest(abs($prevquest[$list]['PrevQuestId']));
467 $prevquest[$list+
1]=$qbefore;
472 $entry = $prevquest[$list]['PrevQuestId'];
473 $prevquest[$list+
1]['entry'] = $entry;
474 $prevquest[$list+
1]['Title'] = "Error qid = $entry";
475 $prevquest[$list+
1]['QuestLevel'] = "??";
480 // Выводим все предыдущие квесты
483 $qinfo = $prevquest[$list-$step];
485 echo "<div style='float: right;'>($lang[level] $qinfo[QuestLevel])</div>";
486 echo "$lang[step]($step) <a href=\"?quest=$qinfo[entry]\">$qinfo[Title]</a>";
492 echo "<div style='float: right;'>($lang[level] $quest[QuestLevel])</div>";
493 echo "$lang[step]($step) $quest[Title]";
496 // Пытаемся найти следующие квесты
500 // Сначала по полю NextQuestId
501 if ($nextquest['NextQuestId']!=0)
503 $nextquest = getQuest(abs($nextquest['NextQuestId']));
505 echo "<div style='float: right;'>($lang[level] $nextquest[QuestLevel])</div>";
506 echo "$lang[step]($step) <a href=\"?quest=$nextquest[entry]\">$nextquest[Title]</a>";
509 // Если не вышло то по полю PrevQuestId = $nextquest[entry](у других квестов)
514 localiseQuest($needForQuest);
515 $nextquest=$needForQuest;
517 echo "<div style='float: right;'>($lang[level] $nextquest[QuestLevel])</div>";
518 echo "$lang[step]($step) <a href=\"?quest=$nextquest[entry]\">$nextquest[Title]</a>";
520 $needForQuest = $dDB->selectRow("SELECT * FROM `quest_template` WHERE ABS(`PrevQuestId`) = ?d", $nextquest['entry']);
528 // Ищем квесты требующие выполнение даного квеста
529 $needForQuest = $dDB->selectPage($number, "SELECT * FROM `quest_template` WHERE ABS(`PrevQuestId`) = ?d", $quest['entry']);
530 if ($needForQuest AND $number > 1) // если == 1 то мы уже вывели это в цепочке
532 echo "<tr><td class = head>$lang[req_for_quest]</td></tr>";
533 foreach ($needForQuest as $nextquest)
535 localiseQuest($nextquest);
537 echo "<div style='float: right;'>($lang[level] $nextquest[QuestLevel])</div>";
538 echo "<a href=\"?quest=$nextquest[entry]\">$nextquest[Title]</a>";
544 echo "<tr><td class = head>$lang[additional_info]</td></tr>";
545 echo "<tr><td><b style='float: right;'>".getNumPalayersCompletedQuest($quest['entry'])."</b>{$lang['players_completed_quest']}:</td></tr>";
546 echo "<tr><td><b style='float: right;'>".getNumPalayersWithThisQuest($quest['entry'])."</b>{$lang['players_with_this_quest']}:</td></tr>";
547 echo "</tbody></table>";