2 include_once("include/functions.php");
3 include_once("include/report_generator.php");
4 include_once("include/map_data.php");
6 $mapId = @$_REQUEST['instance'] == '' ?
-1 : intval(@$_REQUEST['instance']);
9 // Вывод таблицы со списком инстансов
10 include("inst_list.php");
14 $dungeon = isDungeon($mapId);
15 // Вывод карты, мобов и ГО инстанса
16 $baseLink = "?instance=$mapId";
18 // Если это не ajax подгрузка данных
22 $desc_file = 'lang/map_'.'ru'.'/'.$mapId.'.html';
23 if (file_exists($desc_file)) include($desc_file);
25 // Выводим карту если есть дляэтого данные
26 if ($map = getRenderMapData($mapId))
28 // Вывод карты делаетсяс помощью java script
29 // Необходимо только записать данные для него в $mapdata
30 echo "<script type=\"text/javascript\" src=\"js/mapper.js\"></script>";
32 $mapdata['header'] = getMapName($mapId);
33 $mapdata['imageX'] = $map[5];
34 $mapdata['imageY'] = $map[4];
35 $mapdata['image'] = "images/map_image/maps/".$map[6];
36 $mapdata['defImg'] = "images/map_points/green.gif";
37 $mapdata['defImgX'] = 2;
38 $mapdata['defImgY'] = 2;
39 $mapdata['selImg'] = "images/map_points/gps_icon.png";
40 $mapdata['selImgX'] = 7;
41 $mapdata['selImgY'] = 7;
42 // Вспомогательные переменные
49 //***********************************
51 //***********************************
52 $go_list = $dungeon ?
$dDB->selectPage($totalRecords,
65 ORDER BY `id`", $mapId) : 0;
67 foreach ($go_list as $point)
69 $posMap= $point['map'];
70 $posX = $point['position_x'];
71 $posY = $point['position_y'];
72 $posZ = $point['position_z'];
73 transformWorldCoordinates($posMap, $posX, $posY, $posZ);
74 if ($mapId == $posMap AND
75 $areaY1 >= $posY AND $areaY2 <= $posY AND
76 $areaX1 >= $posX AND $areaX2 <= $posX)
78 $x = ($posX-$areaX1)/($areaX2-$areaX1)*100;
79 $y = ($posY-$areaY1)/($areaY2-$areaY1)*100;
81 $o = getGameobject($point['id']);
82 $id= "o".$point['id'];
83 $mapdata['points'][$i]['id']=$id;
84 $mapdata['points'][$i]['x']=$y;
85 $mapdata['points'][$i]['y']=$x;
86 $mapdata['points'][$i]['image']="images/map_points/vein.gif";
87 $mapdata['points'][$i]['icenterx']=4;
88 $mapdata['points'][$i]['icentery']=4;
89 $mapdata['points'][$i]['href']="\"?object=".$point['id']."\" onclick=\"return changeSelect('".$id."');\"";
90 $tt = "<table class=maptooltip>";
91 $tt.= "<tr><td class=name>".getGameobjectType($o['type'])." - ".validateText($o['name'])." (".$point['guid'].")</td></tr>";
93 $mapdata['points'][$i]['tooltip']= $tt;
97 //***********************************
99 //***********************************
100 $creatures_list = $dungeon ?
$dDB->selectPage($totalRecords,
113 ORDER BY `id`", $mapId) : 0;
115 foreach ($creatures_list as $point)
117 $posMap= $point['map'];
118 $posX = $point['position_x'];
119 $posY = $point['position_y'];
120 $posZ = $point['position_z'];
121 transformWorldCoordinates($posMap, $posX, $posY, $posZ);
122 if ($mapId == $posMap AND
123 $areaY1 >= $posY AND $areaY2 <= $posY AND
124 $areaX1 >= $posX AND $areaX2 <= $posX)
126 $x = ($posX-$areaX1)/($areaX2-$areaX1)*100;
127 $y = ($posY-$areaY1)/($areaY2-$areaY1)*100;
129 $c = getCreature($point['id']);
130 $id= "c".$point['id'];
131 $mapdata['points'][$i]['id']=$id;
132 $mapdata['points'][$i]['x']=$y;
133 $mapdata['points'][$i]['y']=$x;
134 $mapdata['points'][$i]['image']=0;
135 $mapdata['points'][$i]['icenterx']=0;
136 $mapdata['points'][$i]['icentery']=0;
137 $mapdata['points'][$i]['href']="\"?npc=".$point['id']."\" onclick=\"return changeSelect('".$id."');\"";
138 $tt = "<table class=maptooltip>";
139 $tt.= "<tr><td class=name>".validateText($c['Name'])." (".$point['guid'].")</td></tr>";
141 $mapdata['points'][$i]['tooltip']= $tt;
146 $teleport_list = $dDB->selectPage($totalRecords,'SELECT * FROM `areatrigger_teleport` WHERE `target_map` = ?d', $mapId);
148 foreach ($teleport_list as $point)
150 $posMap= $point['target_map'];
151 $posX = $point['target_position_x'];
152 $posY = $point['target_position_y'];
153 $posZ = $point['target_position_z'];
154 transformWorldCoordinates($posMap, $posX, $posY, $posZ);
155 if ($mapId == $posMap AND
156 $areaY1 >= $posY AND $areaY2 <= $posY AND
157 $areaX1 >= $posX AND $areaX2 <= $posX)
159 $x = ($posX-$areaX1)/($areaX2-$areaX1)*100;
160 $y = ($posY-$areaY1)/($areaY2-$areaY1)*100;
161 $mapdata['points'][$i]['id']=$point['id'];
162 $mapdata['points'][$i]['x']=$y;
163 $mapdata['points'][$i]['y']=$x;
164 $mapdata['points'][$i]['image']="images/map_points/binder_icon.gif";
165 $mapdata['points'][$i]['icenterx']=8;
166 $mapdata['points'][$i]['icentery']=8;
167 $mapdata['points'][$i]['href']='';
168 $mapdata['points'][$i]['tooltip']= validateText($point['name']);
173 // Выбираем лучший масштаб
174 if ($mapdata['imageX'])
176 $bestScale = 768 / $mapdata['imageX'];
177 if ($bestScale > 0.00 && $bestScale < 0.40) $bestScale = 0.25;
178 else if ($bestScale > 0.40 && $bestScale < 0.62) $bestScale = 0.50;
179 else if ($bestScale > 0.62 && $bestScale < 0.87) $bestScale = 0.75;
180 else if ($bestScale > 0.87 && $bestScale < 1.5) $bestScale = 1.00;
181 else $bestScale = 2.00;
182 echo "<script type=\"text/javascript\">setScale($bestScale);</script>";
184 // Сюда будет создана карта скриптом
185 echo "<div id=mapper></div>";
186 // Записываем данные о карте в Java Script и запускаем вывод данных
187 echo "<script type=\"text/javascript\">var data=".php2js($mapdata).";setMapData(data); renderInstance('mapper',0);</script>";
190 echo $lang['inst_no_map_present'].getMapName($mapId);
196 //********************************************************************************
198 //********************************************************************************
199 function r_npcDungeon($data){global $lang; echo '<a href="?map&npc='.$data['Entry'].'" onClick="changeSelect(\'c'.$data['Entry'].'\'); return false;">'.$lang['map'].'</a>';}
201 $creatures =& new CreatureReportGenerator('position');
202 $creatures->addColumnConfig('NPC_REPORT_DUNGEON', array('class'=>'small','sort'=>'','text'=>$lang['map'],'draw'=>'r_npcDungeon','sort_str'=>'','fields'=>''));
203 $fields = array('NPC_REPORT_RANK', 'NPC_REPORT_RNAME', 'NPC_REPORT_DUNGEON');
204 if ($creatures->Init($fields, $baseLink, 'creatureLIST', $config['fade_limit'], 'rank'))
206 $creatures->onMap($mapId);
207 $creatures->createReport($lang['inst_creature_list']);
210 //********************************************************************************
212 //********************************************************************************
213 function r_goDungeon($data){global $lang; echo '<a href="?map&obj='.$data['entry'].'" onClick="changeSelect(\'o'.$data['entry'].'\'); return false;">'.$lang['map'].'</a>';}
215 $go =& new GameobjectReportGenerator('position');
216 $go->addColumnConfig('GO_REPORT_DUNGEON', array('class'=>'small','sort'=>'','text'=>$lang['map'],'draw'=>'r_goDungeon','sort_str'=>'','fields'=>''));
217 $fields = array('GO_REPORT_NAME', 'GO_REPORT_TYPE', 'GO_REPORT_DUNGEON');
218 if ($go->Init($fields, $baseLink, 'objectLIST', $config['fade_limit'], 'name'))
221 $go->createReport($lang['inst_go_list']);