Разделение иконок для нпц, на дающих и принимающих квест...
[cswow.git] / module / show / show_npc.php
blob6dc3522a6b64734f2f8c2107c833a2d1d6e2859c
1 <?php
2 include_once("conf.php");
3 include_once("include/creature_table.php");
4 include_once("include/info_table_generator.php");
5 include_once("include/report_generator.php");
6 ##########
7 /*
8 Скрипт показывает Creature по его $entry
9 Показывает:
10 - Что кастует
11 - Каким спеллом может быть призыван
12 - Что он продаёт
13 - Чему обучает
14 - Нужен для какого квеста
15 - В какую группу входит существо (kredit)
16 - Какие квесты даёт
17 - Какие квесты принимает
18 - Лут с существа
19 - Лут который можно украсть у существа
20 - Лут шкурок с трупа существа
22 $entry = intval(@$_REQUEST['npc']);
23 $page = intval(@$_REQUEST['page']);
24 $mark = @$_REQUEST['mark'];
26 $cr=getCreature($entry);
27 if (!$cr)
29 RenderError("$lang[creature_not_found]");
31 else
33 $baseLink = '?npc='.$entry;
35 if ($ajaxmode==0)
37 if ($lang['www_creature'])
38 echo "<a href=\"".sprintf($lang['www_creature'], $entry)."\" target=\"_blank\"\">".sprintf($lang['www_creature'], $entry)."</a><br>";
39 echo "<table cellspacing=0 cellpadding=0 width=500>";
40 echo "<tbody>";
41 echo "<tr>";
42 echo "<td align=center>";generateCreatureTable($cr);echo "</td>";
43 echo "</tr>";
44 echo "</tbody></table>";
46 if ($cr['mingold']) echo "<b>$lang[Rew_money]</b>&nbsp;&nbsp;".money($cr['mingold']);
47 if (($cr['maxgold']) && ($cr['maxgold']>$cr['mingold'])) echo "&nbsp;-&nbsp;".money($cr['maxgold']);
48 if ($cr['mingold']) echo "<br>";
49 $heroic=getHeroicList();
50 $heroic1=getHeroicList1();
51 $heroic2=getHeroicList2();
52 $hentry=isset($heroic[$entry])?$heroic[$entry]:$entry;
53 $hentry1=isset($heroic1[$entry])?$heroic1[$entry]:$entry;
54 $hentry2=isset($heroic2[$entry])?$heroic2[$entry]:$entry;
55 if ($hentry2)
56 echo "<a href=\"?map&npc=$hentry2\">$lang[show_map]&nbsp;(".getCreatureCount($hentry2).")</a><br>";
57 else
58 if ($hentry1)
59 echo "<a href=\"?map&npc=$hentry1\">$lang[show_map]&nbsp;(".getCreatureCount($hentry1).")</a><br>";
60 else
61 if ($hentry)
62 echo "<a href=\"?map&npc=$hentry\">$lang[show_map]&nbsp;(".getCreatureCount($hentry).")</a><br>";
64 if ($config['show_npc_detalis'])
66 echo "<br><table class=details width=600>";
67 echo "<tbody>";
68 echo "<tr><td colspan=4 class=head>$lang[detail_info]</td></tr>";
69 echo "<tr><th>entry</th><td>".$cr['entry']."</td><th>difficulty_entry_1</th><td>".$cr['difficulty_entry_1']."</td></tr>";
70 echo "<tr><th>difficulty_entry_2</th><td>".$cr['difficulty_entry_2']."</td><th>difficulty_entry_3</th><td>".$cr['difficulty_entry_3']."</td></tr>";
71 echo "<tr><th>modelid_1</th><td>".$cr['modelid_1']."</td><th>modelid_3</th><td>".$cr['modelid_3']."</td></tr>";
72 echo "<tr><th>modelid_2</th><td>".$cr['modelid_2']."</td><th>modelid_4</th><td>".$cr['modelid_4']."</td></tr>";
73 echo "<tr><th>name</th><td>".$cr['name']."<br><div class=subname>".$cr['subname']."</div></td>";
74 echo "<th>IconName</th><td>".$cr['IconName']."</td></tr>";
75 echo "<tr><th>level</th><td>".$cr['minlevel']." - ".$cr['maxlevel']."</td>";
76 echo "<th>armor</th><td>".$cr['armor']."</td></tr>";
77 echo "<tr><th>health</th><td>".$cr['minhealth']." - ".$cr['maxhealth']."</td>";
78 echo "<th>mana</th><td>".$cr['minmana']." - ".$cr['maxmana']."</td></tr>";
79 echo "<tr><th>faction_A</th><td>".$cr['faction_A']."</td><th>faction_H</th><td>".$cr['faction_H']."</td></tr>";
80 echo "<tr><th>npcflag</th><td>".$cr['npcflag']."</td><th>gossip_menu_id</th><td>".$cr['gossip_menu_id']."</td></tr>";
81 echo "<tr><th>speed_walk</th><td>".$cr['speed_walk']."</td><th>speed_run</th><td>".$cr['speed_run']."</td></tr>";
82 echo "<tr><th>scale</th><td>".$cr['scale']."</td><th>rank</th><td>".$cr['rank']."</td></tr>";
83 echo "<tr><th>mindmg</th><td>".$cr['mindmg']."</td><th>maxdmg</th><td>".$cr['maxdmg']."</td></tr>";
84 echo "<tr><th>dmgschool</th><td>".$cr['dmgschool']."</td><th>dmg_multiplier</th><td>".$cr['dmg_multiplier']."</td></tr>";
85 echo "<tr><th>attackpower</th><td>".$cr['attackpower']."</td><th>rangedattackpower</th><td>".$cr['rangedattackpower']."</td></tr>";
86 echo "<tr><th>baseattacktime</th><td>".$cr['baseattacktime']."</td><th>rangeattacktime</th><td>".$cr['rangeattacktime']."</td></tr>";
87 echo "<tr><th>unit_flags</th><td>".$cr['unit_flags']."</td><th>dynamicflags</th><td>".$cr['dynamicflags']."</td></tr>";
88 echo "<tr><th>unit_class</th><td>".$cr['unit_class']."</td><th>family</th><td>".$cr['family']."</td></tr>";
89 echo "<tr><th>trainer_type</th><td>".$cr['trainer_type']."</td><th>trainer_spell</th><td>".$cr['trainer_spell']."</td></tr>";
90 echo "<tr><th>trainer_class</th><td>".$cr['trainer_class']."</td><th>trainer_race</th><td>".$cr['trainer_race']."</td></tr>";
91 echo "<tr><th>minrangedmg</th><td>".$cr['minrangedmg']."</td><th>maxrangedmg</th><td>".$cr['maxrangedmg']."</td></tr>";
92 echo "<tr><th>type</th><td>".$cr['type']."</td><th>type_flags</th><td>".$cr['type_flags']."</td></tr>";
93 echo "<tr><th>lootid</th><td>".$cr['lootid']."</td></tr>";
94 echo "<tr><th>pickpocketloot</th><td>".$cr['pickpocketloot']."</td></tr>";
95 echo "<tr><th>skinloot</th><td>".$cr['skinloot']."</td></tr>";
96 echo "<tr><th>resistance1</th><td>".$cr['resistance1']."</td><th>resistance2</th><td>".$cr['resistance2']."</td></tr>";
97 echo "<tr><th>resistance3</th><td>".$cr['resistance3']."</td><th>resistance4</th><td>".$cr['resistance4']."</td></tr>";
98 echo "<tr><th>resistance5</th><td>".$cr['resistance5']."</td><th>resistance6</th><td>".$cr['resistance6']."</td></tr>";
99 echo "<tr><th>spell1</th><td>".$cr['spell1']."</td><th>spell2</th><td>".$cr['spell2']."</td></tr>";
100 echo "<tr><th>spell3</th><td>".$cr['spell3']."</td><th>spell4</th><td>".$cr['spell4']."</td></tr>";
101 echo "<tr><th>PetSpellDataId</th><td>".$cr['PetSpellDataId']."</td></tr>";
102 echo "<tr><th>mingold</th><td>".$cr['mingold']."</td><th>maxgold</th><td>".$cr['maxgold']."</td></tr>";
103 echo "<tr><th>MovementType</th><td>".$cr['MovementType']."</td><th>InhabitType</th><td>".$cr['InhabitType']."</td></tr>";
104 echo "<tr><th>RacialLeader</th><td>".$cr['RacialLeader']."</td><th>RegenHealth</th><td>".$cr['RegenHealth']."</td></tr>";
105 echo "<tr><th>equipment_id</th><td>".$cr['equipment_id']."</td></tr>";
106 echo "<tr><th>mechanic_immune_mask</th><td>".$cr['mechanic_immune_mask']."</td></tr>";
107 echo "<tr><th>flags_extra</th><td>".$cr['flags_extra']."</td></tr>";
108 echo "<tr><th>AIName</th><td>".$cr['AIName']."</td><th>ScriptName</th><td>".$cr['ScriptName']."</td></tr>";
109 echo "</tbody></table>";
112 createReportTab();
113 //********************************************************************************
114 // Summoned by spell
115 //********************************************************************************
116 $summoned_by =& new SpellReportGenerator;
117 $fields = array('SPELL_REPORT_ICON','SPELL_REPORT_NAME');
118 if ($summoned_by->Init($fields, $baseLink, 'summonLIST', $config['fade_limit'], 'name'))
120 $summoned_by->summonCreature($entry);
121 $summoned_by->createReport($lang['summoned_by_spell']);
123 //********************************************************************************
124 // Cast spells
125 //********************************************************************************
126 $cast_spell =& new SpellReportGenerator;
127 $fields = array('SPELL_REPORT_ICON','SPELL_REPORT_NAME');
128 if ($cast_spell->Init($fields, $baseLink, 'castLIST', $config['fade_limit'], 'name'))
130 $cast_spell->castByCreature($cr);
131 $cast_spell->createReport($lang['cast_spells']);
133 //**************************************************
134 // Vendor items list
135 //**************************************************
136 if ($cr['npcflag']&(UNIT_NPC_FLAG_VENDOR|UNIT_NPC_FLAG_VENDOR_AMMO|UNIT_NPC_FLAG_VENDOR_FOOD|UNIT_NPC_FLAG_VENDOR_POISON|UNIT_NPC_FLAG_VENDOR_REAGENT))
138 $sold =& new ItemReportGenerator('vendor');
139 $fields = array('ITEM_REPORT_ICON','ITEM_REPORT_NAME', 'VENDOR_REPORT_COST', 'VENDOR_REPORT_COUNT', 'VENDOR_REPORT_INCTIME');
140 if ($sold->Init($fields, $baseLink, 'vendorLIST', $config['fade_limit'], 'name'))
142 $sold->vendorItemList($entry);
143 $sold->createReport($lang['sold']);
146 //**************************************************
147 // Train spells
148 //**************************************************
149 if ($cr['npcflag']&(UNIT_NPC_FLAG_TRAINER|UNIT_NPC_FLAG_TRAINER_CLASS|UNIT_NPC_FLAG_TRAINER_PROFESSION))
151 $train =& new NPCTrainerReportGenerator();
152 $fields = array('TRAIN_REPORT_LEVEL','TRAIN_REPORT_ICON', 'TRAIN_REPORT_NAME', 'TRAIN_REPORT_SKILL', 'TRAIN_REPORT_VALUE', 'TRAIN_REPORT_COST');
153 if ($train->Init($fields, $baseLink, 'trainLIST', $config['fade_limit'], 'level'))
155 $train->trainSpell($entry);
156 $train->createReport($lang['train']);
159 //********************************************************************************
160 // Required for quest list
161 //********************************************************************************
162 $reqForQuest =& new QuestReportGenerator();
163 $fields = array('QUEST_REPORT_LEVEL', 'QUEST_REPORT_NAME', 'QUEST_REPORT_GIVER', 'QUEST_REPORT_REWARD');
164 if ($reqForQuest->Init($fields, $baseLink, 'qreqLIST', $config['fade_limit'], 'name'))
166 $reqForQuest->requireCreature($entry);
167 $reqForQuest->createReport($lang['req_for_quest']);
169 //********************************************************************************
170 // Kill kredit list
171 //********************************************************************************
172 $kredit =& new CreatureReportGenerator();
173 $fields = array('NPC_REPORT_LEVEL', 'NPC_REPORT_RNAME', 'NPC_REPORT_MAP');
174 if ($kredit->Init($fields, $baseLink, 'r_creatureLIST', $config['fade_limit'], 'name'))
176 $kredit->kreditGroup($entry);
177 $kredit->createReport($lang['kill_kredit_group']);
179 //**************************************************
180 // Give quests
181 //**************************************************
182 if ($cr['npcflag']&(UNIT_NPC_FLAG_QUESTGIVER))
184 $giveQuest =& new QuestReportGenerator('npc_giver');
185 $fields = array('QUEST_REPORT_LEVEL', 'QUEST_REPORT_NAME', 'QUEST_REPORT_REWARD');
186 if ($giveQuest->Init($fields, $baseLink, 'qgLIST', $config['fade_limit'], 'name'))
188 $giveQuest->getGiveTakeList($entry);
189 $giveQuest->createReport($lang['give_quest']);
192 //**************************************************
193 // Take quests
194 //**************************************************
195 if ($cr['npcflag']&(UNIT_NPC_FLAG_QUESTGIVER))
197 $takeQuest =& new QuestReportGenerator('npc_take');
198 $fields = array('QUEST_REPORT_LEVEL', 'QUEST_REPORT_NAME', 'QUEST_REPORT_REWARD');
199 if ($takeQuest->Init($fields, $baseLink, 'qtLIST', $config['fade_limit'], 'name'))
201 $takeQuest->getGiveTakeList($entry);
202 $takeQuest->createReport($lang['take_quest']);
206 //**************************************************
207 // Loot list
208 //**************************************************
209 if ($ajaxmode==0)
211 if ($cr['lootid'])
214 $loot =& new LootReportGenerator('creature_loot');
215 if ($loot->Init($fields, $baseLink, 'lootLIST', $config['fade_limit'], ''))
217 $loot->getLootList($cr['lootid']);
218 $loot->createReport($lang['can_loot']);
220 $page_seek = init_pagePerMark($mark, "lootLIST", $page);
221 $rows = getLootList($cr['lootid'], "creature_loot_template", $totalRecords, $page_seek, $config['fade_limit']);
222 renderLootTableList($rows, $lang['can_loot'], $page_seek, $totalRecords, $baseLink, "lootLIST");
225 //**************************************************
226 // Pickpocket loot
227 //**************************************************
228 if ($ajaxmode==0)
230 if ($cr['pickpocketloot'])
232 $page_seek = init_pagePerMark($mark, "pickpocketLIST", $page);
233 $rows = getLootList($cr['pickpocketloot'], "pickpocketing_loot_template", $totalRecords, $page_seek, $config['fade_limit']);
234 renderLootTableList($rows, $lang['can_pickpocketing'], $page_seek, $totalRecords, $baseLink, "pickpocketLIST");
237 //**************************************************
238 // Skining loot
239 //**************************************************
240 if ($ajaxmode==0)
242 if ($cr['skinloot'])
244 $page_seek = init_pagePerMark($mark, "skinLIST", $page);
245 $rows = getLootList($cr['skinloot'], "skinning_loot_template", $totalRecords, $page_seek, $config['fade_limit']);
246 if ($cr['type_flags'] & CREATURE_TYPEFLAGS_HERBLOOT)
247 renderLootTableList($rows, $lang['give_herb'], $page_seek, $totalRecords, $baseLink, "skinLIST");
248 else if ($cr['type_flags'] & CREATURE_TYPEFLAGS_MININGLOOT)
249 renderLootTableList($rows, $lang['give_mining'], $page_seek, $totalRecords, $baseLink, "skinLIST");
250 else if ($cr['type_flags'] & CREATURE_TYPEFLAGS_ENGINEERLOOT)
251 renderLootTableList($rows, $lang['give_engineer'], $page_seek, $totalRecords, $baseLink, "skinLIST");
252 else
253 renderLootTableList($rows, $lang['give_skin'], $page_seek, $totalRecords, $baseLink, "skinLIST");
256 //**************************************************
257 // Reputation
258 //**************************************************
259 $r_knpc =& new CreatureReportGenerator('reputation');
260 $fields = array('ONKILL_REPUTATION');
261 if ($r_knpc->Init($fields, $baseLink, 'r_ccreatureLIST', $config['fade_limit'], 'rep'))
263 $r_knpc->rewardNpcFactionReputation($entry);
264 $r_knpc->createReport($lang['faction_kill_rew']);