Текстовое сообщение о требуемой репутации.
[cswow.git] / module / show / show_quest.php
blob1d1cb4be47409eb6a03fb6e58fed543cdd5b8c6d
1 <?php
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' , '$c' , '$r' , '$R' ,'<a' ,'<A');
8 $values = array('<br>','<br>','<br>','(Name)', '(Name)','(Class)','(Class)','(Race)','(Race)','< a','< A');
9 return str_replace($letter, $values, $quest_text);
12 function renderReqCollect($item_id, $maxcount, $count)
14 if (!$item_id > 0)
15 return;
16 $name=getItemName($item_id);
17 echo "<tr><td>&nbsp;&nbsp;<a href=\"?item=$item_id\">$name</a>:&nbsp;$count/$maxcount</td></tr>";
20 function renderReqKillOrCast($text,$ReqCreatureOrGOId,$ReqCreatureOrGOCount,$ReqSpellCast, $count)
22 global $lang;
23 if ($ReqCreatureOrGOId>0)
25 echo "<tr><td><a style='float: right;' href=\"?map&npc=$ReqCreatureOrGOId\">$lang[map]</a>&nbsp;&nbsp;";
26 if ($ReqSpellCast==0) // Требуется убить моба
28 if ($text)
29 echo "<a href=\"?npc=$ReqCreatureOrGOId\">$text</a>";
30 else
31 echo $lang['kill'].'&nbsp;'.getCreatureName($ReqCreatureOrGOId);
33 else
35 // $spell_name=getSpellName($ReqSpellCast);
36 if (!$text) $text = $lang['cast'];
37 echo "<a href=\"?spell=$ReqSpellCast\">$text</a>&nbsp;$lang[cast_on]&nbsp;".getCreatureName($ReqCreatureOrGOId);
39 echo ":&nbsp;$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>&nbsp;&nbsp;";
45 if ($ReqSpellCast==0) // Требуется использовать геймобьект
47 if ($text)
48 echo "<a href=\"?object=$ReqCreatureOrGOId\">$text</a>";
49 else
50 echo $lang['use'].'&nbsp;'.getGameobjectName($ReqCreatureOrGOId);
52 else
54 if (!$text) $text = $lang['cast'];
55 // $spell_name=getSpellName($ReqSpellCast);
56 echo "<a href=\"?spell=$ReqSpellCast\">$text</a> $lang[cast_on]&nbsp;".getGameobjectName($ReqCreatureOrGOId);
58 echo ":&nbsp;$count/$ReqCreatureOrGOCount</td></tr>";
61 function renderQuestSource($srcID, $srcCount)
63 if (!$srcID)
64 return;
65 $name=getItemName($srcID);
66 echo "<tr><td>&nbsp;&nbsp;<a href=\"?item=$srcID\">$name</a>".($srcCount?'&nbsp;x&nbsp;'.$srcCount:'').'</td></tr>';
69 ########
71 $entry = intval(@$_REQUEST['quest']);
72 $guid = intval(@$_REQUEST['guid']);
74 $quest=getQuest($entry);
75 if (!$quest)
77 RenderError("$lang[quest_not_found1]");
79 else
81 $q_status = 0;
82 if ($guid)
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>";
88 echo "<tbody>";
90 echo "<tr><td class=head>$quest[Title]";
92 if ($quest['Type'])
93 echo "<br><FONT size=-3>&lt;".getQuestType($quest['Type'])."&gt;</FONT>";
95 if (getAllowableRace($quest['RequiredRaces']) && ($quest['RequiredRaces'] & 1101) && ($quest['RequiredRaces'] !=1791))
97 echo "<br><FONT color=#0000ff>$lang[required_races]&nbsp;$lang[Alliance]&nbsp;</FONT><img width=22 height=22 src='images/player_info/factions_img/alliance.gif'>";
98 echo '<br><FONT color=#0000ff>'.$game_text['allowable_race'].'&nbsp;'.getAllowableRace($quest['RequiredRaces']).'</FONT>';
101 if (getAllowableRace($quest['RequiredRaces']) && ($quest['RequiredRaces'] & 690) && ($quest['RequiredRaces'] !=1791))
103 echo "<br><FONT color=#ff0000>$lang[required_races]&nbsp;$lang[Horde]&nbsp;</FONT><img width=22 height=22 src='images/player_info/factions_img/horde.gif'>";
104 echo '<br><FONT color=#ff0000>'.$game_text['allowable_race'].'&nbsp;'.getAllowableRace($quest['RequiredRaces']).'</FONT>';
107 if (($quest['RequiredRaces'] == 0) OR ($quest['RequiredRaces'] == 1791))
109 echo "</br>";
110 echo "<br><FONT color=#008800>$lang[required_races]&nbsp;$lang[Both]</FONT>";
111 echo '<br><FONT color=#008800>'.$game_text['allowable_race'].'&nbsp;'.getAllowableRace(1791).'</FONT>';
114 if (getAllowableClass($quest['RequiredClasses']))
115 echo '<br><FONT color=#000000>'.$game_text['allowable_class'].'&nbsp;'.getQAllowableClass($quest['RequiredClasses']).'</FONT>';
117 if ($entry == getQuestOld($entry))
118 echo '<br><FONT color=#ff0000><b>'.$lang['quest_marked'].'</FONT></b>';
120 echo "</th></tr>";
121 echo "</th></tr>";
123 echo '<tr><td>';
124 if ($quest['ZoneOrSort']>0)
125 echo "<a style='float: right;' href=\"?s=q&ZoneID=".$quest['ZoneOrSort']."\">".getAreaName($quest['ZoneOrSort'], 0)."</a>";
126 else
127 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
128 (-$quest['ZoneOrSort']) == 284 OR (-$quest['ZoneOrSort']) == 25 OR (-$quest['ZoneOrSort']) == 41 OR (-$quest['ZoneOrSort']) < 24))
129 echo "<a style='float: right;' href=\"?s=q&SortID=".(-$quest['ZoneOrSort'])."\">".getQuestSort(-$quest['ZoneOrSort'], 0)."</a>";
131 echo "$lang[quest_level]&nbsp;$quest[QuestLevel]<br>";
133 if ($quest['RequiredSkill'])
134 echo "<a style='float: right;' href=\"?s=q&SkillID=".($quest['RequiredSkill'])."\">".getSkillName($quest['RequiredSkill'], 0)."&nbsp;($quest[RequiredSkillValue])</a>";
136 if ($quest['MinLevel'])
137 echo "$lang[obtained_at_level]&nbsp;$quest[MinLevel]</td></tr>";
139 if ($quest['SuggestedPlayers'])
140 echo "<tr><td>$lang[suggestedplayers]&nbsp;<b>$quest[SuggestedPlayers]</b></td></tr>";
142 if ($quest['LimitTime'])
143 echo '<tr><td>'.$lang['qlimittime'].'&nbsp;'.getTimeText($quest['LimitTime']).'</td></tr>';
145 if (getGameEventQuest($quest['entry']))
147 $qevent=getGameEventQuest($quest['entry']);
148 echo '<tr><td>'.$lang['obtained_at_event'].':&nbsp;<FONT color=#E614E6>'.getGameEventName($qevent).'</FONT></td></tr>';
151 if ($quest['SpecialFlags'] & QUEST_SPECIAL_FLAG_MONTHLY)
152 echo "<tr><td>$lang[item_type]:&nbsp;<a href=\"?s=q&Sfm=".($quest['SpecialFlags'])."\">".$lang['quest_type3']."</a></td></tr>";
154 if ($quest['QuestFlags'] & QUEST_FLAGS_WEEKLY)
155 echo "<tr><td>$lang[item_type]:&nbsp;<a href=\"?s=q&Sfw=".($quest['QuestFlags'])."\">".$lang['quest_type2']."</a></td></tr>";
157 if ($quest['QuestFlags'] & QUEST_FLAGS_DAILY)
158 echo "<tr><td>$lang[item_type]:&nbsp;<a href=\"?s=q&Sfd=".($quest['QuestFlags'])."\">".$lang['quest_type1']."</a></td></tr>";
160 if (($quest['SpecialFlags'] & QUEST_SPECIAL_FLAG_REPEATABLE) && (($quest['SpecialFlags'] & QUEST_SPECIAL_FLAG_MONTHLY) ==0) && ($quest['QuestFlags'] & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY)) == 0)
161 echo "<tr><td>$lang[item_type]:&nbsp;<a href=\"?s=q&Sfr=".($quest['SpecialFlags'])."\">".$lang['quest_type0']."</a></td></tr>";
163 if ($quest['RequiredMinRepFaction'] OR $quest['RequiredMaxRepFaction'])
164 echo "<tr><td>$lang[item_faction_rank]:</td></tr>";
166 if ($quest['RequiredMinRepFaction'])
168 $qrep_data = getReputationDataFromReputation($quest['RequiredMinRepValue']);
169 echo "<tr><td>".getFactionName($quest['RequiredMinRepFaction']).":&nbsp;".$qrep_data['rank_name']."&nbsp;-&nbsp;$quest[RequiredMinRepValue]($lang[item_min_level])</td></tr>";
171 if ($quest['RequiredMaxRepFaction'])
173 $qrep_data = getReputationDataFromReputation($quest['RequiredMaxRepValue']);
174 echo "<tr><td>".getFactionName($quest['RequiredMaxRepFaction']).":&nbsp;".$qrep_data['rank_name']."&nbsp;-&nbsp;$quest[RequiredMaxRepValue]($lang[item_max_level])</td></tr>";
177 $questobjectives = getQuestText($quest['Objectives']);
178 $questrequestitemstext = getQuestText($quest['RequestItemsText']);
179 $questofferrewardtext = getQuestText($quest['OfferRewardText']);
180 if ($questobjectives)
181 echo "<tr><td>$questobjectives<hr></td></tr>";
182 else if ($questrequestitemstext)
183 echo "<tr><td>$questrequestitemstext<hr></td></tr>";
184 else if ($questofferrewardtext)
185 echo "<tr><td>$questofferrewardtext<hr></td></tr>";
187 ### Рек собрать
188 if ($quest['RepObjectiveFaction'])
189 echo "<tr><td>$lang[item_faction_rank]:</td></tr>";
191 if ($quest['RepObjectiveFaction'])
193 $qrep_data = getReputationDataFromReputation($quest['RepObjectiveValue']);
194 echo "<tr><td>".getFactionName($quest['RepObjectiveFaction']).":&nbsp;".$qrep_data['rank_name']."&nbsp;-&nbsp;$quest[RepObjectiveValue]($lang[item_min_level])</td></tr>";
197 if ($quest['ReqItemId1'] OR $quest['ReqItemId2'] OR $quest['ReqItemId3'] OR $quest['ReqItemId4'] OR $quest['ReqItemId5'] OR $quest['ReqItemId6'])
199 echo "<tr><td class=mark>$lang[collect]</td></tr>";
200 renderReqCollect($quest['ReqItemId1'],$quest['ReqItemCount1'],$q_status?$q_status['itemcount1']:0);
201 renderReqCollect($quest['ReqItemId2'],$quest['ReqItemCount2'],$q_status?$q_status['itemcount2']:0);
202 renderReqCollect($quest['ReqItemId3'],$quest['ReqItemCount3'],$q_status?$q_status['itemcount3']:0);
203 renderReqCollect($quest['ReqItemId4'],$quest['ReqItemCount4'],$q_status?$q_status['itemcount4']:0);
204 renderReqCollect($quest['ReqItemId5'],$quest['ReqItemCount5'],$q_status?$q_status['itemcount5']:0);
205 renderReqCollect($quest['ReqItemId6'],$quest['ReqItemCount6'],$q_status?$q_status['itemcount6']:0);
208 ### Рек убить
209 if ($quest['ReqCreatureOrGOId1'] != 0 OR $quest['ReqCreatureOrGOId2'] != 0 OR
210 $quest['ReqCreatureOrGOId3'] != 0 OR $quest['ReqCreatureOrGOId4'] != 0 )
212 // echo "<tr><td class=mark>$lang[kill]</td></tr>";
213 renderReqKillOrCast($quest['ObjectiveText1'],$quest['ReqCreatureOrGOId1'],$quest['ReqCreatureOrGOCount1'],$quest['ReqSpellCast1'],$q_status?$q_status['mobcount1']:0);
214 renderReqKillOrCast($quest['ObjectiveText2'],$quest['ReqCreatureOrGOId2'],$quest['ReqCreatureOrGOCount2'],$quest['ReqSpellCast2'],$q_status?$q_status['mobcount2']:0);
215 renderReqKillOrCast($quest['ObjectiveText3'],$quest['ReqCreatureOrGOId3'],$quest['ReqCreatureOrGOCount3'],$quest['ReqSpellCast3'],$q_status?$q_status['mobcount3']:0);
216 renderReqKillOrCast($quest['ObjectiveText4'],$quest['ReqCreatureOrGOId4'],$quest['ReqCreatureOrGOCount4'],$quest['ReqSpellCast4'],$q_status?$q_status['mobcount4']:0);
219 if ($quest['ReqSourceId1'] != 0 OR $quest['ReqSourceId2'] != 0 OR
220 $quest['ReqSourceId3'] != 0 OR $quest['ReqSourceId4'] != 0 )
222 echo "<tr><td class=mark>$lang[req_items]</td></tr>";
223 renderQuestSource($quest['ReqSourceId1'],$quest['ReqSourceCount1']);
224 renderQuestSource($quest['ReqSourceId2'],$quest['ReqSourceCount2']);
225 renderQuestSource($quest['ReqSourceId3'],$quest['ReqSourceCount3']);
226 renderQuestSource($quest['ReqSourceId4'],$quest['ReqSourceCount4']);
230 echo "<tr><td>".getQuestText($quest['Details'])."</td></tr>";
231 if ($quest['CompletedText'])
233 echo "<tr><td class=head>$lang[quest_completed]</td></tr>";
234 echo '<tr><td>'.$quest['CompletedText'].'</td></tr>';
236 if ($quest['SrcItemId'] || $quest['SrcSpell'])
238 echo "<tr><td class=head>$lang[provided]</td></tr>";
239 if ($quest['SrcItemId'])
241 $item = getItem($quest['SrcItemId'], "`entry`, `name`, `Quality`, `displayid`");
242 echo '<tr><td class=reward>&nbsp;'.text_show_item($item['entry'], $item['displayid']);
243 echo '&nbsp;<a class='.$Quality[$item['Quality']].' href="?item='.$item['entry'].'">'.$item['name'].'</a>';
244 if ($quest['SrcItemCount']>1) echo "&nbsp;x$quest[SrcItemCount]";
245 echo "</td></tr>";
247 if ($quest['SrcSpell'])
249 $spell=getSpell($quest['SrcSpell']); // Кастуемый спелл
250 if ($spell) $spellName = getSpellName($spell);
251 else $spellName = "Spell $quest[SrcSpell]";
252 echo "<tr><td class=reward>&nbsp;";show_spell($spell['id'], $spell['SpellIconID']);
253 echo " <a href=\"?spell=$spell[id]\">$spell[SpellName]</a></td></tr>";
256 echo "<tr><td class=head>$lang[quest_rewards]</td></tr>";
258 if ($quest['RewItemId1'] OR $quest['RewItemId1'] OR $quest['RewItemId1'] OR $quest['RewItemId1'])
260 echo "<tr><td class=mark>$lang[Rew_item]</td></tr>";
261 echo "<tr><td class=reward>&nbsp;";
262 if ($quest['RewItemId1']) {show_item($quest['RewItemId1']);}
263 if ($quest['RewItemId2']) {echo $lang['item_sel_and'];show_item($quest['RewItemId2']);}
264 if ($quest['RewItemId3']) {echo $lang['item_sel_and'];show_item($quest['RewItemId3']);}
265 if ($quest['RewItemId4']) {echo $lang['item_sel_and'];show_item($quest['RewItemId4']);}
266 echo "</td></tr>";
268 if ($quest['RewChoiceItemId1'] OR $quest['RewChoiceItemId2'] OR $quest['RewChoiceItemId3'] OR
269 $quest['RewChoiceItemId4'] OR $quest['RewChoiceItemId5'] OR $quest['RewChoiceItemId6'])
271 echo "<tr><td class=mark>$lang[Rew_select_item]</td></tr>";
272 echo "<tr><td class=reward>&nbsp;";
273 if ($quest['RewChoiceItemId1']) {show_item($quest['RewChoiceItemId1']);}
274 if ($quest['RewChoiceItemId2']) {echo $lang['item_sel_or'];show_item($quest['RewChoiceItemId2']);}
275 if ($quest['RewChoiceItemId3']) {echo $lang['item_sel_or'];show_item($quest['RewChoiceItemId3']);}
276 if ($quest['RewChoiceItemId4']) {echo $lang['item_sel_or'];show_item($quest['RewChoiceItemId4']);}
277 if ($quest['RewChoiceItemId5']) {echo $lang['item_sel_or'];show_item($quest['RewChoiceItemId5']);}
278 if ($quest['RewChoiceItemId6']) {echo $lang['item_sel_or'];show_item($quest['RewChoiceItemId6']);}
279 echo "</td></tr>";
281 if ($quest['RewMailTemplateId'])
283 $MailTime=$quest['RewMailDelaySecs']/60/60;
284 $ItemMail=getItemMail($quest['RewMailTemplateId']);
285 echo "<tr><td class=mark>$lang[Rew_mail]&nbsp;$lang[Mail_item_time]".$MailTime."$lang[Mail_time]";
286 if ($ItemMail)
288 echo "<tr><td class=mark>$lang[Rew_item_mail]</td></tr>";
289 echo "<tr><td class=reward>&nbsp;";{show_item($ItemMail);}
291 echo "</td></tr>";
293 if ($quest['RewSpell'] || $quest['RewSpellCast'])
295 $learn = $quest['RewSpell'] ? $quest['RewSpell'] : $quest['RewSpellCast'];
296 $spell=getSpell($learn);
297 if ($spell) $spellName = getSpellName($spell);
298 else $spellName = "Spell $learn";
299 echo '<tr><td class=mark>'.($quest['RewSpell']?$lang['learn_spell']:$lang['cast_spell']).'</td></tr>';
300 echo "<tr><td class=reward>&nbsp;";show_spell($spell['id'], $spell['SpellIconID']);
301 echo " <a href=\"?spell=$spell[id]\">$spell[SpellName]</a></td></tr>";
304 for ($i = 1; $i <= 5; $i++)
306 switch (ABS($quest['RewRepValueId'.$i])):
307 case 1: $RepValueId[$i] = 10; break;
308 case 2: $RepValueId[$i] = 25; break;
309 case 3: $RepValueId[$i] = 75; break;
310 case 4: $RepValueId[$i] = 150; break;
311 case 5: $RepValueId[$i] = 250; break;
312 case 6: $RepValueId[$i] = 350; break;
313 case 7: $RepValueId[$i] = 500; break;
314 case 8: $RepValueId[$i] = 1000; break;
315 case 9: $RepValueId[$i] = 5; break;
316 default: $RepValueId[$i] = 0;
317 endswitch;
319 $quest_rate[$i] = getRepRewRate($quest['RewRepFaction'.$i]);
321 if ($quest['RewRepValueId'.$i] < 0)
322 $RepValueId[$i] = -$RepValueId[$i];
324 if ($quest['RewRepValue'.$i] && $quest['RewRepValueId'.$i])
325 $quest['RewRepValue'.$i] = $quest['RewRepValue'.$i]/100;
327 if (!$quest['RewRepValue'.$i] && $quest['RewRepValueId'.$i])
328 $quest['RewRepValue'.$i] = $RepValueId[$i];
330 $quest['RewRepValue'.$i]=$quest['RewRepValue'.$i]*$quest_rate[$i];
333 if ($quest['RewRepFaction1'] AND !$quest['RewRepFaction2'] AND
334 !$quest['RewRepFaction3'] AND !$quest['RewRepFaction4'] AND
335 !$quest['RewRepFaction5'])
337 $spillover=getRepSpillover($quest['RewRepFaction1']);
338 if ($spillover)
339 foreach ($spillover as $faction)
341 if ($faction['faction1'])
343 $quest['RewRepFaction2']=$faction['faction1'];
344 $quest['RewRepValue2']=$quest['RewRepValue1']*$faction['rate_1'];
346 if ($faction['faction2'])
348 $quest['RewRepFaction3']=$faction['faction2'];
349 $quest['RewRepValue3']=$quest['RewRepValue1']*$faction['rate_2'];
351 if ($faction['faction3'])
353 $quest['RewRepFaction4']=$faction['faction3'];
354 $quest['RewRepValue4']=$quest['RewRepValue1']*$faction['rate_3'];
356 if ($faction['faction4'])
358 $quest['RewRepFaction5']=$faction['faction4'];
359 $quest['RewRepValue5']=$quest['RewRepValue1']*$faction['rate_4'];
364 if ($quest['RewRepFaction1'] OR $quest['RewRepFaction2'] OR
365 $quest['RewRepFaction3'] OR $quest['RewRepFaction4'] OR
366 $quest['RewRepFaction5'])
368 echo "<tr><td class=mark>$lang[Rew_reputation]</td></tr>";
369 if ($quest['RewRepFaction1'] && $quest['RewRepValue1'])echo "<tr><td>&nbsp;".getFactionName($quest['RewRepFaction1']).":&nbsp;$quest[RewRepValue1]</td></tr>";
370 if ($quest['RewRepFaction2'] && $quest['RewRepValue2'])echo "<tr><td>&nbsp;".getFactionName($quest['RewRepFaction2']).":&nbsp;$quest[RewRepValue2]</td></tr>";
371 if ($quest['RewRepFaction3'] && $quest['RewRepValue3'])echo "<tr><td>&nbsp;".getFactionName($quest['RewRepFaction3']).":&nbsp;$quest[RewRepValue3]</td></tr>";
372 if ($quest['RewRepFaction4'] && $quest['RewRepValue4'])echo "<tr><td>&nbsp;".getFactionName($quest['RewRepFaction4']).":&nbsp;$quest[RewRepValue4]</td></tr>";
373 if ($quest['RewRepFaction5'] && $quest['RewRepValue5'])echo "<tr><td>&nbsp;".getFactionName($quest['RewRepFaction5']).":&nbsp;$quest[RewRepValue5]</td></tr>";
375 if($quest['RewMoneyMaxLevel']) echo "<tr><td class=mark>$lang[Rew_XP]&nbsp;".getQuestXPValue($quest)."&nbsp;xp";
376 if($quest['RewHonorAddition'] OR $quest['RewHonorMultiplier'])
378 if ($quest['RewHonorMultiplier'])
379 $ihonor=round(getTeamContributionPoints(79)*$quest['RewHonorMultiplier']*0.1+$quest['RewHonorAddition']);
380 else
381 $ihonor=round($quest['RewHonorAddition']);
382 echo "<tr><td class=mark>$lang[Rew_honor]&nbsp;".substr($ihonor, 0, 4);
384 if($quest['RewOrReqMoney']) echo "<tr><td class=mark>$lang[Rew_money]&nbsp;".money($quest['RewOrReqMoney'])."</td></tr>";
387 $number = 0;
388 echo "<tr><td class = head>$lang[start]:</td></tr>";
389 if ($rows = $dDB->select("SELECT *
390 FROM `creature_template` join `creature_questrelation`
391 WHERE
392 `creature_questrelation`.`quest` = ?d AND
393 `creature_questrelation`.`id` = `creature_template`.`Entry`", $quest['entry']))
394 foreach ($rows as $creature)
396 localiseCreature($creature);
397 $loyality = getLoyality($creature['FactionAlliance']);
398 echo "<tr><td><a style='float: right;' href=\"?map&npc=$creature[Entry]\">$lang[map]</a>";
399 echo "<a href=\"?npc=$creature[Entry]\">$creature[Name]</a> ($loyality)";
400 if ($creature['SubName'] != "")
401 echo "<br><FONT color=#008800 size=-3>&lt;$creature[SubName]&gt;</FONT>";
402 echo "</td></tr>";
403 $number++;
406 if ($rows = $dDB->select("SELECT *
407 FROM `gameobject_template` join `gameobject_questrelation`
408 WHERE
409 `gameobject_questrelation`.`quest` = ?d AND
410 `gameobject_questrelation`.`id` = `gameobject_template`.`entry`", $quest['entry']))
411 foreach ($rows as $go)
413 localiseGameobject($go);
414 echo "<tr><td><a style='float: right;' href=\"?map&obj=$go[entry]\">$lang[map]</a>";
415 echo "<a href=\"?object=$go[entry]\">$go[name]</a></td></tr>";
416 $number++;
419 if ($rows = $dDB->select("SELECT `entry`, `name`,`Quality`, `displayid` FROM `item_template` WHERE `startquest` = ?d", $quest['entry']))
420 foreach ($rows as $item)
422 localiseItem($item);
423 echo '<tr><td class=reward>&nbsp;'.text_show_item($item['entry'], $item['displayid']);
424 echo '&nbsp;<a class='.$Quality[$item['Quality']].' href="?item='.$item['entry'].'">'.$item['name'].'</a>';
425 $number++;
428 if ($number==0)
429 echo "<tr><td bgColor=#ff0000>$lang[quest_not_found]</td></tr>";
431 $number = 0;
432 echo "<tr><td class = head>$lang[end_q]:</td></tr>";
433 if ($rows = $dDB->select("SELECT *
434 FROM `creature_template` join `creature_involvedrelation`
435 WHERE
436 `creature_involvedrelation`.`quest` = ?d AND
437 `creature_involvedrelation`.`id` = `creature_template`.`Entry`", $quest['entry']))
438 foreach ($rows as $creature)
440 localiseCreature($creature);
441 $loyality = getLoyality($creature['FactionAlliance']);
442 echo "<tr><td><a style='float: right;' href=\"?map&npc=$creature[Entry]\">$lang[map]</a>";
443 echo "<a href=\"?npc=$creature[Entry]\">$creature[Name]</a> ($loyality)";
444 if ($creature['SubName'] != "")
445 echo "<br><FONT color=#008800 size=-3>&lt;$creature[SubName]&gt;</FONT>";
446 echo "</td></tr>";
447 $number++;
450 if ($rows = $dDB->select("SELECT *
451 FROM `gameobject_template` join `gameobject_involvedrelation`
452 WHERE
453 `gameobject_involvedrelation`.`quest` = ?d AND
454 `gameobject_involvedrelation`.`id` = `gameobject_template`.`entry`", $quest['entry']))
455 foreach ($rows as $go)
457 localiseGameobject($go);
458 echo "<tr><td><a style='float: right;' href=\"?map&obj=$go[entry]\">$lang[map]</a>";
459 echo "<a href=\"?object=$go[entry]\">$go[name]</a></td></tr>";
460 $number++;
463 if ($number==0)
464 echo "<tr><td bgColor=#ff0000>$lang[quest_not_found]</td></tr>";
466 ### этот квест часть серии:
467 $needForQuest = $dDB->selectRow("SELECT * FROM `quest_template` WHERE ABS(`PrevQuestId`) = ?d", $quest['entry']);
468 if ($quest['PrevQuestId'] != 0 OR $quest['NextQuestId'] != 0 OR $needForQuest)
470 echo "<tr><td class = head>$lang[this_quest_is_part_of_a_series]</td></tr>";
471 $step=0;
472 // Разматываем цепочку квестов назад
473 if ($quest['PrevQuestId']!=0)
475 $prevquest[0]=$quest;
476 $list = 0;
477 while ($prevquest[$list]['PrevQuestId']!=0)
479 $qbefore = getQuest(abs($prevquest[$list]['PrevQuestId']));
480 if ($qbefore)
482 $prevquest[$list+1]=$qbefore;
483 $list+=1;
485 else
487 $entry = $prevquest[$list]['PrevQuestId'];
488 $prevquest[$list+1]['entry'] = $entry;
489 $prevquest[$list+1]['Title'] = "Error qid = $entry";
490 $prevquest[$list+1]['QuestLevel'] = "??";
491 $list+=1;
492 break;
495 // Выводим все предыдущие квесты
496 while ($step<$list)
498 $qinfo = $prevquest[$list-$step];
499 echo "<tr><td>";
500 echo "<div style='float: right;'>($lang[level]&nbsp;$qinfo[QuestLevel])</div>";
501 if (getAllowableRace($qinfo['RequiredRaces']) && ($qinfo['RequiredRaces'] & 1101) && ($qinfo['RequiredRaces'] !=1791))
502 echo "$lang[step]($step)&nbsp;<img width=14 height=14 src='images/player_info/factions_img/alliance.gif'>&nbsp;<a href=\"?quest=$qinfo[entry]\">$qinfo[Title]</a>";
503 else
504 if (getAllowableRace($qinfo['RequiredRaces']) && ($qinfo['RequiredRaces'] & 690) && ($qinfo['RequiredRaces'] !=1791))
505 echo "$lang[step]($step)&nbsp;<img width=14 height=14 src='images/player_info/factions_img/horde.gif'>&nbsp;<a href=\"?quest=$qinfo[entry]\">$qinfo[Title]</a>";
506 else
507 echo "$lang[step]($step)&nbsp;<a href=\"?quest=$qinfo[entry]\">$qinfo[Title]</a>";
508 echo "</td></tr>";
509 $step++;
512 echo "<tr><td>";
513 echo "<div style='float: right;'>($lang[level]&nbsp;$quest[QuestLevel])</div>";
514 if (getAllowableRace($quest['RequiredRaces']) && ($quest['RequiredRaces'] & 1101) && ($quest['RequiredRaces'] !=1791))
515 echo "$lang[step]($step)&nbsp;<img width=14 height=14 src='images/player_info/factions_img/alliance.gif'>&nbsp;$quest[Title]";
516 else
517 if (getAllowableRace($quest['RequiredRaces']) && ($quest['RequiredRaces'] & 690) && ($quest['RequiredRaces'] !=1791))
518 echo "$lang[step]($step)&nbsp;<img width=14 height=14 src='images/player_info/factions_img/horde.gif'>&nbsp;$quest[Title]";
519 else
520 echo "$lang[step]($step)&nbsp;$quest[Title]";
521 echo "</td></tr>";
522 $step++;
523 // Пытаемся найти следующие квесты
524 $nextquest = $quest;
525 while($nextquest!=0)
527 // Сначала по полю NextQuestId
528 if ($nextquest['NextQuestId']!=0)
530 $nextquest = getQuest(abs($nextquest['NextQuestId']));
531 echo "<tr><td>";
532 echo "<div style='float: right;'>($lang[level]&nbsp;$nextquest[QuestLevel])</div>";
533 if (getAllowableRace($nextquest['RequiredRaces']) && ($nextquest['RequiredRaces'] & 1101) && ($nextquest['RequiredRaces'] !=1791))
534 echo "$lang[step]($step)&nbsp;<img width=14 height=14 src='images/player_info/factions_img/alliance.gif'>&nbsp;<a href=\"?quest=$nextquest[entry]\">$nextquest[Title]</a>";
535 else
536 if (getAllowableRace($nextquest['RequiredRaces']) && ($nextquest['RequiredRaces'] & 690) && ($nextquest['RequiredRaces'] !=1791))
537 echo "$lang[step]($step)&nbsp;<img width=14 height=14 src='images/player_info/factions_img/horde.gif'>&nbsp;<a href=\"?quest=$nextquest[entry]\">$nextquest[Title]</a>";
538 else
539 echo "$lang[step]($step)&nbsp;<a href=\"?quest=$nextquest[entry]\">$nextquest[Title]</a>";
540 echo "</td></tr>";
542 // Если не вышло то по полю PrevQuestId = $nextquest[entry](у других квестов)
543 else
545 if ($needForQuest)
547 localiseQuest($needForQuest);
548 $nextquest=$needForQuest;
549 echo "<tr><td>";
550 echo "<div style='float: right;'>($lang[level]&nbsp;$nextquest[QuestLevel])</div>";
551 if (getAllowableRace($nextquest['RequiredRaces']) && ($nextquest['RequiredRaces'] & 1101) && ($nextquest['RequiredRaces'] !=1791))
552 echo "$lang[step]($step)&nbsp;<img width=14 height=14 src='images/player_info/factions_img/alliance.gif'>&nbsp;<a href=\"?quest=$nextquest[entry]\">$nextquest[Title]</a>";
553 else
554 if (getAllowableRace($nextquest['RequiredRaces']) && ($nextquest['RequiredRaces'] & 690) && ($nextquest['RequiredRaces'] !=1791))
555 echo "$lang[step]($step)&nbsp;<img width=14 height=14 src='images/player_info/factions_img/horde.gif'>&nbsp;<a href=\"?quest=$nextquest[entry]\">$nextquest[Title]</a>";
556 else
557 echo "$lang[step]($step)&nbsp;<a href=\"?quest=$nextquest[entry]\">$nextquest[Title]</a>";
558 echo "</td></tr>";
559 $needForQuest = $dDB->selectRow("SELECT * FROM `quest_template` WHERE ABS(`PrevQuestId`) = ?d", $nextquest['entry']);
561 else
562 $nextquest = 0;
564 $step++;
567 // Ищем квесты требующие выполнение даного квеста
568 $needForQuest = $dDB->selectPage($number, "SELECT * FROM `quest_template` WHERE ABS(`PrevQuestId`) = ?d", $quest['entry']);
569 if ($needForQuest AND $number > 1) // если == 1 то мы уже вывели это в цепочке
571 echo "<tr><td class = head>$lang[req_for_quest_next]</td></tr>";
572 foreach ($needForQuest as $nextquest)
574 localiseQuest($nextquest);
575 echo "<tr><td>";
576 echo "<div style='float: right;'>($lang[level]&nbsp;$nextquest[QuestLevel])</div>";
577 if (getAllowableRace($nextquest['RequiredRaces']) && ($nextquest['RequiredRaces'] & 1101) && ($nextquest['RequiredRaces'] !=1791))
578 echo "<img width=14 height=14 src='images/player_info/factions_img/alliance.gif'>&nbsp;<a href=\"?quest=$nextquest[entry]\">$nextquest[Title]</a>";
579 else
580 if (getAllowableRace($nextquest['RequiredRaces']) && ($nextquest['RequiredRaces'] & 690) && ($nextquest['RequiredRaces'] !=1791))
581 echo "<img width=14 height=14 src='images/player_info/factions_img/horde.gif'>&nbsp;<a href=\"?quest=$nextquest[entry]\">$nextquest[Title]</a>";
582 else
583 echo "<a href=\"?quest=$nextquest[entry]\">$nextquest[Title]</a>";
584 echo "</td></tr>";
589 echo "<tr><td class = head>$lang[additional_info]</td></tr>";
590 echo "<tr><td><b style='float: right;'>".getNumPalayersCompletedQuest($quest['entry'])."</b>{$lang['players_completed_quest']}:</td></tr>";
591 echo "<tr><td><b style='float: right;'>".getNumPalayersWithThisQuest($quest['entry'])."</b>{$lang['players_with_this_quest']}:</td></tr>";
592 echo "</tbody></table>";