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'].' '.getQAllowableClass($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>";
135 if ($quest['MinLevel'])
136 echo "$lang[obtained_at_level] $quest[MinLevel]</td></tr>";
138 if ($quest['SuggestedPlayers'])
139 echo "<tr><td>$lang[suggestedplayers] <b>$quest[SuggestedPlayers]</b></td></tr>";
141 if ($quest['LimitTime'])
142 echo '<tr><td>'.$lang['qlimittime'].' '.getTimeText($quest['LimitTime']).'</td></tr>';
144 if (getGameEventQuest($quest['entry']))
146 $qevent=getGameEventQuest($quest['entry']);
147 echo '<tr><td>'.$lang['obtained_at_event'].': <FONT color=#E614E6>'.getGameEventName($qevent).'</FONT></td></tr>';
150 if ($quest['SpecialFlags'] & QUEST_SPECIAL_FLAG_MONTHLY
)
151 echo "<tr><td>$lang[item_type]: <a href=\"?s=q&Sfm=".($quest['SpecialFlags'])."\">".$lang['quest_type3']."</a></td></tr>";
153 if ($quest['QuestFlags'] & QUEST_FLAGS_WEEKLY
)
154 echo "<tr><td>$lang[item_type]: <a href=\"?s=q&Sfw=".($quest['QuestFlags'])."\">".$lang['quest_type2']."</a></td></tr>";
156 if ($quest['QuestFlags'] & QUEST_FLAGS_DAILY
)
157 echo "<tr><td>$lang[item_type]: <a href=\"?s=q&Sfd=".($quest['QuestFlags'])."\">".$lang['quest_type1']."</a></td></tr>";
159 if (($quest['SpecialFlags'] & QUEST_SPECIAL_FLAG_REPEATABLE
) && (($quest['SpecialFlags'] & QUEST_SPECIAL_FLAG_MONTHLY
) ==0)&& ($quest['QuestFlags'] & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY
)) == 0)
160 echo "<tr><td>$lang[item_type]: <a href=\"?s=q&Sfr=".($quest['SpecialFlags'])."\">".$lang['quest_type0']."</a></td></tr>";
162 if ($quest['RequiredMinRepFaction'])
163 echo "<tr><td>$lang[item_faction_rank]:</td></tr>";
165 if ($quest['RequiredMinRepFaction'])
166 echo "<tr><td> ".getFactionName($quest['RequiredMinRepFaction']).": $quest[RequiredMinRepValue]($lang[item_min_level])</td></tr>";
168 if ($quest['RequiredMaxRepFaction'])
169 echo "<tr><td>".getFactionName($quest['RequiredMaxRepFaction']).": $quest[RequiredMaxRepValue]($lang[item_max_level])</td></tr>";
171 echo "<tr><td>".getQuestText($quest['Objectives'])."<hr></td></tr>";
173 if ($quest['RepObjectiveFaction'])
174 echo "<tr><td>$lang[item_faction_rank]:</td></tr>";
176 if ($quest['RepObjectiveFaction'])
177 echo "<tr><td> ".getFactionName($quest['RepObjectiveFaction']).": $quest[RepObjectiveValue]($lang[item_min_level])</td></tr>";
179 if ($quest['ReqItemId1'] OR $quest['ReqItemId2'] OR $quest['ReqItemId3'] OR $quest['ReqItemId4'] OR $quest['ReqItemId5'] OR $quest['ReqItemId6'])
181 echo "<tr><td class=mark>$lang[collect]</td></tr>";
182 renderReqCollect($quest['ReqItemId1'],$quest['ReqItemCount1'],$q_status?
$q_status['itemcount1']:0);
183 renderReqCollect($quest['ReqItemId2'],$quest['ReqItemCount2'],$q_status?
$q_status['itemcount2']:0);
184 renderReqCollect($quest['ReqItemId3'],$quest['ReqItemCount3'],$q_status?
$q_status['itemcount3']:0);
185 renderReqCollect($quest['ReqItemId4'],$quest['ReqItemCount4'],$q_status?
$q_status['itemcount4']:0);
186 renderReqCollect($quest['ReqItemId5'],$quest['ReqItemCount5'],$q_status?
$q_status['itemcount5']:0);
187 renderReqCollect($quest['ReqItemId6'],$quest['ReqItemCount6'],$q_status?
$q_status['itemcount6']:0);
191 if ($quest['ReqCreatureOrGOId1'] != 0 OR $quest['ReqCreatureOrGOId2'] != 0 OR
192 $quest['ReqCreatureOrGOId3'] != 0 OR $quest['ReqCreatureOrGOId4'] != 0 )
194 // echo "<tr><td class=mark>$lang[kill]</td></tr>";
195 renderReqKillOrCast($quest['ObjectiveText1'],$quest['ReqCreatureOrGOId1'],$quest['ReqCreatureOrGOCount1'],$quest['ReqSpellCast1'],$q_status?
$q_status['mobcount1']:0);
196 renderReqKillOrCast($quest['ObjectiveText2'],$quest['ReqCreatureOrGOId2'],$quest['ReqCreatureOrGOCount2'],$quest['ReqSpellCast2'],$q_status?
$q_status['mobcount2']:0);
197 renderReqKillOrCast($quest['ObjectiveText3'],$quest['ReqCreatureOrGOId3'],$quest['ReqCreatureOrGOCount3'],$quest['ReqSpellCast3'],$q_status?
$q_status['mobcount3']:0);
198 renderReqKillOrCast($quest['ObjectiveText4'],$quest['ReqCreatureOrGOId4'],$quest['ReqCreatureOrGOCount4'],$quest['ReqSpellCast4'],$q_status?
$q_status['mobcount4']:0);
201 if ($quest['ReqSourceId1'] != 0 OR $quest['ReqSourceId2'] != 0 OR
202 $quest['ReqSourceId3'] != 0 OR $quest['ReqSourceId4'] != 0 )
204 echo "<tr><td class=mark>$lang[req_items]</td></tr>";
205 renderQuestSource($quest['ReqSourceId1'],$quest['ReqSourceCount1']);
206 renderQuestSource($quest['ReqSourceId2'],$quest['ReqSourceCount2']);
207 renderQuestSource($quest['ReqSourceId3'],$quest['ReqSourceCount3']);
208 renderQuestSource($quest['ReqSourceId4'],$quest['ReqSourceCount4']);
212 echo "<tr><td>".getQuestText($quest['Details'])."</td></tr>";
213 if ($quest['CompletedText'])
215 echo "<tr><td class = head>$lang[quest_completed]</td></tr>";
216 echo '<tr><td>'.$quest['CompletedText'].'</td></tr>';
218 if ($quest['SrcItemId'] ||
$quest['SrcSpell'])
220 echo "<tr><td class = head>$lang[provided]</td></tr>";
221 if ($quest['SrcItemId'])
223 $item = getItem($quest['SrcItemId'], "`entry`, `name`, `Quality`, `displayid`");
224 echo '<tr><td class=reward> '.text_show_item($item['entry'], $item['displayid']);
225 echo ' <a class='.$Quality[$item['Quality']].' href="?item='.$item['entry'].'">'.$item['name'].'</a>';
226 if ($quest['SrcItemCount']>1) echo " x$quest[SrcItemCount]";
229 if ($quest['SrcSpell'])
231 $spell=getSpell($quest['SrcSpell']); // Кастуемый спелл
232 if ($spell) $spellName = getSpellName($spell);
233 else $spellName = "Spell $quest[SrcSpell]";
234 echo "<tr><td class=reward> ";show_spell($spell['id'], $spell['SpellIconID']);
235 echo " <a href=\"?spell=$spell[id]\">$spell[SpellName]</a></td></tr>";
238 echo "<tr><td class = head>$lang[quest_rewards]</td></tr>";
240 if ($quest['RewItemId1'] OR $quest['RewItemId1'] OR $quest['RewItemId1'] OR $quest['RewItemId1'])
242 echo "<tr><td class=mark>$lang[Rew_item]</td></tr>";
243 echo "<tr><td class=reward> ";
244 if ($quest['RewItemId1']) {show_item($quest['RewItemId1']);}
245 if ($quest['RewItemId2']) {echo $lang['item_sel_and'];show_item($quest['RewItemId2']);}
246 if ($quest['RewItemId3']) {echo $lang['item_sel_and'];show_item($quest['RewItemId3']);}
247 if ($quest['RewItemId4']) {echo $lang['item_sel_and'];show_item($quest['RewItemId4']);}
250 if ($quest['RewChoiceItemId1'] OR $quest['RewChoiceItemId2'] OR $quest['RewChoiceItemId3'] OR
251 $quest['RewChoiceItemId4'] OR $quest['RewChoiceItemId5'] OR $quest['RewChoiceItemId6'])
253 echo "<tr><td class=mark>$lang[Rew_select_item]</td></tr>";
254 echo "<tr><td class=reward> ";
255 if ($quest['RewChoiceItemId1']) {show_item($quest['RewChoiceItemId1']);}
256 if ($quest['RewChoiceItemId2']) {echo $lang['item_sel_or'];show_item($quest['RewChoiceItemId2']);}
257 if ($quest['RewChoiceItemId3']) {echo $lang['item_sel_or'];show_item($quest['RewChoiceItemId3']);}
258 if ($quest['RewChoiceItemId4']) {echo $lang['item_sel_or'];show_item($quest['RewChoiceItemId4']);}
259 if ($quest['RewChoiceItemId5']) {echo $lang['item_sel_or'];show_item($quest['RewChoiceItemId5']);}
260 if ($quest['RewChoiceItemId6']) {echo $lang['item_sel_or'];show_item($quest['RewChoiceItemId6']);}
263 if ($quest['RewMailTemplateId'])
265 $MailTime=$quest['RewMailDelaySecs']/60/60;
266 $ItemMail=getItemMail($quest['RewMailTemplateId']);
269 echo "<tr><td class=mark>$lang[Rew_mail] $lang[Mail_item_time]".$MailTime."$lang[Mail_time]";
270 echo "<tr><td class=mark>$lang[Rew_item_mail]</td></tr>";
271 echo "<tr><td class=reward> ";{show_item($ItemMail);}
276 echo "<tr><td class=mark>$lang[Rew_mail] $lang[Mail_item_time]".$MailTime."$lang[Mail_time]";
280 if ($quest['RewSpell'] ||
$quest['RewSpellCast'])
282 $learn = $quest['RewSpell'] ?
$quest['RewSpell'] : $quest['RewSpellCast'];
283 $spell=getSpell($learn);
284 if ($spell) $spellName = getSpellName($spell);
285 else $spellName = "Spell $learn";
286 echo '<tr><td class=mark>'.($quest['RewSpell']?
$lang['learn_spell']:$lang['cast_spell']).'</td></tr>';
287 echo "<tr><td class=reward> ";show_spell($spell['id'], $spell['SpellIconID']);
288 echo " <a href=\"?spell=$spell[id]\">$spell[SpellName]</a></td></tr>";
291 for ($i = 1; $i <= 5; $i++
)
293 switch (ABS($quest['RewRepValueId'.$i])):
294 case 1: $RepValueId[$i] = 10; break;
295 case 2: $RepValueId[$i] = 25; break;
296 case 3: $RepValueId[$i] = 75; break;
297 case 4: $RepValueId[$i] = 150; break;
298 case 5: $RepValueId[$i] = 250; break;
299 case 6: $RepValueId[$i] = 350; break;
300 case 7: $RepValueId[$i] = 500; break;
301 case 8: $RepValueId[$i] = 1000; break;
302 case 9: $RepValueId[$i] = 5; break;
303 default: $RepValueId[$i] = 0;
306 $quest_rate[$i] = getRepRewRate($quest['RewRepFaction'.$i]);
308 if ($quest['RewRepValueId'.$i] < 0)
309 $RepValueId[$i] = -$RepValueId[$i];
311 if ($quest['RewRepValue'.$i] && $quest['RewRepValueId'.$i])
312 $quest['RewRepValue'.$i] = $quest['RewRepValue'.$i]/100;
314 if (!$quest['RewRepValue'.$i] && $quest['RewRepValueId'.$i])
315 $quest['RewRepValue'.$i] = $RepValueId[$i];
317 $quest['RewRepValue'.$i]=$quest['RewRepValue'.$i]*$quest_rate[$i];
320 if ($quest['RewRepFaction1'] AND !$quest['RewRepFaction2'] AND
321 !$quest['RewRepFaction3'] AND !$quest['RewRepFaction4'] AND
322 !$quest['RewRepFaction5'])
324 $spillover=getRepSpillover($quest['RewRepFaction1']);
326 foreach ($spillover as $faction)
328 if ($faction['faction1'])
330 $quest['RewRepFaction2']=$faction['faction1'];
331 $quest['RewRepValue2']=$quest['RewRepValue1']*$faction['rate_1'];
333 if ($faction['faction2'])
335 $quest['RewRepFaction3']=$faction['faction2'];
336 $quest['RewRepValue3']=$quest['RewRepValue1']*$faction['rate_2'];
338 if ($faction['faction3'])
340 $quest['RewRepFaction4']=$faction['faction3'];
341 $quest['RewRepValue4']=$quest['RewRepValue1']*$faction['rate_3'];
343 if ($faction['faction4'])
345 $quest['RewRepFaction5']=$faction['faction4'];
346 $quest['RewRepValue5']=$quest['RewRepValue1']*$faction['rate_4'];
351 if ($quest['RewRepFaction1'] OR $quest['RewRepFaction2'] OR
352 $quest['RewRepFaction3'] OR $quest['RewRepFaction4'] OR
353 $quest['RewRepFaction5'])
355 echo "<tr><td class=mark>$lang[Rew_reputation]</td></tr>";
356 if ($quest['RewRepFaction1'] && $quest['RewRepValue1'])echo "<tr><td> ".getFactionName($quest['RewRepFaction1']).": $quest[RewRepValue1]</td></tr>";
357 if ($quest['RewRepFaction2'] && $quest['RewRepValue2'])echo "<tr><td> ".getFactionName($quest['RewRepFaction2']).": $quest[RewRepValue2]</td></tr>";
358 if ($quest['RewRepFaction3'] && $quest['RewRepValue3'])echo "<tr><td> ".getFactionName($quest['RewRepFaction3']).": $quest[RewRepValue3]</td></tr>";
359 if ($quest['RewRepFaction4'] && $quest['RewRepValue4'])echo "<tr><td> ".getFactionName($quest['RewRepFaction4']).": $quest[RewRepValue4]</td></tr>";
360 if ($quest['RewRepFaction5'] && $quest['RewRepValue5'])echo "<tr><td> ".getFactionName($quest['RewRepFaction5']).": $quest[RewRepValue5]</td></tr>";
362 if($quest['RewMoneyMaxLevel']) echo "<tr><td class=mark>$lang[Rew_XP] ".getQuestXPValue($quest)." xp";
363 if($quest['RewHonorAddition'] OR $quest['RewHonorMultiplier'])
365 if ($quest['RewHonorMultiplier'])
366 $ihonor=round(getTeamContributionPoints(79)*$quest['RewHonorMultiplier']*0.1+
$quest['RewHonorAddition']);
368 $ihonor=round($quest['RewHonorAddition']);
369 echo "<tr><td class=mark>$lang[Rew_honor] ".substr($ihonor, 0, 4);
371 if($quest['RewOrReqMoney']) echo "<tr><td class=mark>$lang[Rew_money] ".money($quest['RewOrReqMoney'])."</td></tr>";
375 echo "<tr><td class = head>$lang[start]:</td></tr>";
376 if ($rows = $dDB->select("SELECT *
377 FROM `creature_template` join `creature_questrelation`
379 `creature_questrelation`.`quest` = ?d AND
380 `creature_questrelation`.`id` = `creature_template`.`entry`", $quest['entry']))
381 foreach ($rows as $creature)
383 localiseCreature($creature);
384 $loyality = getLoyality($creature['faction_A']);
385 echo "<tr><td><a style='float: right;' href=\"?map&npc=$creature[entry]\">$lang[map]</a>";
386 echo "<a href=\"?npc=$creature[entry]\">$creature[name]</a> ($loyality)";
387 if ($creature['subname'] != "")
388 echo "<br><FONT color=#008800 size=-3><$creature[subname]></FONT>";
393 if ($rows = $dDB->select("SELECT *
394 FROM `gameobject_template` join `gameobject_questrelation`
396 `gameobject_questrelation`.`quest` = ?d AND
397 `gameobject_questrelation`.`id` = `gameobject_template`.`entry`", $quest['entry']))
398 foreach ($rows as $go)
400 localiseGameobject($go);
401 echo "<tr><td><a style='float: right;' href=\"?map&obj=$go[entry]\">$lang[map]</a>";
402 echo "<a href=\"?object=$go[entry]\">$go[name]</a></td></tr>";
406 if ($rows = $dDB->select("SELECT `entry`, `name`,`Quality`, `displayid` FROM `item_template` WHERE `startquest` = ?d", $quest['entry']))
407 foreach ($rows as $item)
410 echo '<tr><td class=reward> '.text_show_item($item['entry'], $item['displayid']);
411 echo ' <a class='.$Quality[$item['Quality']].' href="?item='.$item['entry'].'">'.$item['name'].'</a>';
416 echo "<tr><td bgColor=#ff0000>$lang[quest_not_found]</td></tr>";
419 echo "<tr><td class = head>$lang[end_q]:</td></tr>";
420 if ($rows = $dDB->select("SELECT *
421 FROM `creature_template` join `creature_involvedrelation`
423 `creature_involvedrelation`.`quest` = ?d AND
424 `creature_involvedrelation`.`id` = `creature_template`.`entry`", $quest['entry']))
425 foreach ($rows as $creature)
427 localiseCreature($creature);
428 $loyality = getLoyality($creature['faction_A']);
429 echo "<tr><td><a style='float: right;' href=\"?map&npc=$creature[entry]\">$lang[map]</a>";
430 echo "<a href=\"?npc=$creature[entry]\">$creature[name]</a> ($loyality)";
431 if ($creature['subname'] != "")
432 echo "<br><FONT color=#008800 size=-3><$creature[subname]></FONT>";
437 if ($rows = $dDB->select("SELECT *
438 FROM `gameobject_template` join `gameobject_involvedrelation`
440 `gameobject_involvedrelation`.`quest` = ?d AND
441 `gameobject_involvedrelation`.`id` = `gameobject_template`.`entry`", $quest['entry']))
442 foreach ($rows as $go)
444 localiseGameobject($go);
445 echo "<tr><td><a style='float: right;' href=\"?map&obj=$go[entry]\">$lang[map]</a>";
446 echo "<a href=\"?object=$go[entry]\">$go[name]</a></td></tr>";
451 echo "<tr><td bgColor=#ff0000>$lang[quest_not_found]</td></tr>";
453 ### этот квест часть серии:
454 $needForQuest = $dDB->selectRow("SELECT * FROM `quest_template` WHERE ABS(`PrevQuestId`) = ?d", $quest['entry']);
455 if ($quest['PrevQuestId'] != 0 OR $quest['NextQuestId'] != 0 OR $needForQuest)
457 echo "<tr><td class = head>$lang[this_quest_is_part_of_a_series]</td></tr>";
459 // Разматываем цепочку квестов назад
460 if ($quest['PrevQuestId']!=0)
462 $prevquest[0]=$quest;
464 while ($prevquest[$list]['PrevQuestId']!=0)
466 $qbefore = getQuest(abs($prevquest[$list]['PrevQuestId']));
469 $prevquest[$list+
1]=$qbefore;
474 $entry = $prevquest[$list]['PrevQuestId'];
475 $prevquest[$list+
1]['entry'] = $entry;
476 $prevquest[$list+
1]['Title'] = "Error qid = $entry";
477 $prevquest[$list+
1]['QuestLevel'] = "??";
482 // Выводим все предыдущие квесты
485 $qinfo = $prevquest[$list-$step];
487 echo "<div style='float: right;'>($lang[level] $qinfo[QuestLevel])</div>";
488 echo "$lang[step]($step) <a href=\"?quest=$qinfo[entry]\">$qinfo[Title]</a>";
494 echo "<div style='float: right;'>($lang[level] $quest[QuestLevel])</div>";
495 echo "$lang[step]($step) $quest[Title]";
498 // Пытаемся найти следующие квесты
502 // Сначала по полю NextQuestId
503 if ($nextquest['NextQuestId']!=0)
505 $nextquest = getQuest(abs($nextquest['NextQuestId']));
507 echo "<div style='float: right;'>($lang[level] $nextquest[QuestLevel])</div>";
508 echo "$lang[step]($step) <a href=\"?quest=$nextquest[entry]\">$nextquest[Title]</a>";
511 // Если не вышло то по полю PrevQuestId = $nextquest[entry](у других квестов)
516 localiseQuest($needForQuest);
517 $nextquest=$needForQuest;
519 echo "<div style='float: right;'>($lang[level] $nextquest[QuestLevel])</div>";
520 echo "$lang[step]($step) <a href=\"?quest=$nextquest[entry]\">$nextquest[Title]</a>";
522 $needForQuest = $dDB->selectRow("SELECT * FROM `quest_template` WHERE ABS(`PrevQuestId`) = ?d", $nextquest['entry']);
530 // Ищем квесты требующие выполнение даного квеста
531 $needForQuest = $dDB->selectPage($number, "SELECT * FROM `quest_template` WHERE ABS(`PrevQuestId`) = ?d", $quest['entry']);
532 if ($needForQuest AND $number > 1) // если == 1 то мы уже вывели это в цепочке
534 echo "<tr><td class = head>$lang[req_for_quest]</td></tr>";
535 foreach ($needForQuest as $nextquest)
537 localiseQuest($nextquest);
539 echo "<div style='float: right;'>($lang[level] $nextquest[QuestLevel])</div>";
540 echo "<a href=\"?quest=$nextquest[entry]\">$nextquest[Title]</a>";
546 echo "<tr><td class = head>$lang[additional_info]</td></tr>";
547 echo "<tr><td><b style='float: right;'>".getNumPalayersCompletedQuest($quest['entry'])."</b>{$lang['players_completed_quest']}:</td></tr>";
548 echo "<tr><td><b style='float: right;'>".getNumPalayersWithThisQuest($quest['entry'])."</b>{$lang['players_with_this_quest']}:</td></tr>";
549 echo "</tbody></table>";