Попытка подгонки под ревизию 12606. 2-й кусочек.)
[cswow.git] / map / gps2.php
blobf3d4312d65854c67b5aa79acdbce1b5b6abcc90c
1 <?php
2 include_once("../conf.php");
3 include_once("zone_tables.php");
4 echo "<html>";
5 echo "<head>";
6 echo "<meta http-equiv=Content-Type content=text/html; charset=utf-8>";
7 echo "<title></title>";
8 $id = intval(@$_REQUEST['id']);
9 $where = @$_REQUEST['where'];
11 if ($where == "gameobject")
13 $where = "gameobject";
14 $where_template = "gameobject_template";
16 else
18 $where = "creature";
19 $where_template = "creature_template";
21 if ($id == "") { echo "<center><table valign=\"bottom\"><tr><td><img src=\"../images/wowd.jpg\"></td></tr><tr><td><center>Отсутствует запрос</center></td></tr></table></center>"; die(); }
23 mysql_connect($config['hostname'],$config['username'],$config['password']) or die("Unable to connect to the database. Maybe the server is down.");
24 mysql_select_db($config['dbName']) or die(mysql_error());
26 // Предварительный выбор карты берётся 1 моб и определяем его местоположение
27 $res2 = mysql_query("SELECT * FROM `$where` WHERE id = '$id'") or die(mysql_error());
28 $count= mysql_num_rows($res2);
29 if ($count==0)
31 echo "<center><table valign=\"bottom\"><tr><td><img src=\"../images/wowd.jpg\"></td></tr><tr><td><center>Никого не найдено</center></td></tr></table></center>";
32 die();
34 $row2=mysql_fetch_array($res2);mysql_data_seek($res2,0);
36 $imageMAP = $row2['map'];
37 $background = "no_map";
39 $scale=2; // Масштаб карты
40 // Моб находится на Азероте или Калимдоре
41 // Карта Азерота и Калимдора на одной картинке
42 if ($row2['map']==0 OR $row2['map']==1)
44 $background = "img/map_image/map.jpg";
45 $imageX = 2300;
46 $imageY = 1600;
47 // Коэффициенты перевода координат для Азерота
48 if ($row2['map']==0)
50 $image_DX = 472;
51 $image_SX = -1180/18000;
52 $image_DY = 1838;
53 $image_SY = -340/5350;
55 // Коэффициенты перевода координат для Калимдора
56 else
58 $image_DX = 795;
59 $image_SX = -1270/19100;
60 $image_DY = 318;
61 $image_SY = -570/8850;
64 // Карта Аутлэнда на ней также находятся Острова дреней и блудэльфов
65 else if ($row2['map']==530)
67 // Весь Аутланд находится в этих координатах
68 if ($row2['position_x']< 5333.3333333 AND $row2['position_x'] > -5866.666666 AND
69 $row2['position_y']<10133.3333333 AND $row2['position_y'] > -1066.666666)
71 $background = "img/map_image/Outland_".$scale."x.jpg";
72 $imageX = 5376/$scale;
73 $imageY = 5376/$scale;
74 $image_DX = 2560/$scale;
75 $image_SX = -0.48/$scale;
76 $image_DY = 4864/$scale;
77 $image_SY = -0.48/$scale;
79 // Острова Дреней находятся тут
80 else if ($row2['position_y']<-10075 AND $row2['position_y'] > -14570 AND
81 $row2['position_x']< -758 AND $row2['position_x'] > -5508)
83 $background = "img/map_image/Isle1.jpg";
84 $imageX = 2272;
85 $imageY = 2444;
86 $image_DX = -256;
87 $image_SX = -0.48;
88 $image_DY = -4718;
89 $image_SY = -0.48;
91 // Острова блудэльфов тут
92 else if ($row2['position_y']<-4487 AND $row2['position_y'] > -9412 AND
93 $row2['position_x']<11041 AND $row2['position_x'] > 6067)
95 $background = "img/map_image/Isle2.jpg";
96 $imageX = 1746;
97 $imageY = 2511;
98 $image_DX = 5324;
99 $image_SX = -0.48;
100 $image_DY = -2345;
101 $image_SY = -0.48;
104 // Карты не найденна
105 if ($background == "no_map")
107 // echo "<center><table valign=\"bottom\"><tr><td><img src=\"../images/wowd.jpg\"></td></tr><tr><td><center>Нет этой карты</center></td></tr></table></center>";
108 $map=$row2['map'];
109 include("instance.php");
111 else
113 // Показ карты
115 <style type="text/css">
116 <!--
117 body {
118 margin-left: 0px;
119 margin-top: 0px;
120 margin-right: 0px;
121 margin-bottom: 0px;
122 color: #EABA28;
123 background-color: #000000;
125 #world {
126 position: absolute;
127 <?php echo " width: $imageX"."px".";\n"?>
128 <?php echo " height: $imageY"."px".";\n"?>
129 left: 0;
130 margin-left: 0px;
131 <?php echo " background-image: url($background);\n"?>
132 z-index: 2;
135 </style>
136 </head>
137 <body>
138 <div id="world">
139 <?php
140 $dx=0;$dy=0;
141 $sx=0;
142 $sy=0;
143 $n=0;
144 $res = mysql_query("SELECT * FROM `$where_template` WHERE entry = '$id'") or die(mysql_error());
145 $row = mysql_fetch_array($res);
146 $row['name']=validateTextForMap($row['name']);
149 $img = "img/red_soft.gif";
150 $x = $image_DY+$image_SY*$posy;
151 $y = $image_DX+$image_SX*$posx;
152 echo "<a href=\"map.php?id=$id&where=$where&x=$posx&y=$posy&map=$row2[map]\">";
153 echo "<img src=\"$img\" style=\"position: absolute; border: 0px; left: $x; top: $y;
154 \"onmouseover=\"this.T_TITLE='<div align=center>$row[name]</div>';
155 return escape('Респавн: $time<br>GUID $row2[guid]<br>$posy $posx $row2[position_z] $row2[map]')\"
156 ></a>\n";
161 while ($row2=mysql_fetch_array($res2))
163 if ($where == "gameobject")
165 $posx = $row2['position_x'];
166 $posy = $row2['position_y'];
167 $type = $row['type'];
168 $time = get_time_text($row2['spawntimesecs']);
169 if ($type == "3") {$img = "img/iron.gif"; $centerImage = 4;}
170 else {$img = "img/gps_icon.png";$centerImage = 8;}
172 else
174 $posx = $row2['position_x'];
175 $posy = $row2['position_y'];
176 $type = $row['type'];
177 $time = get_time_text($row2['spawntimesecs']);
179 $img = "img/gps_icon.png";$centerImage = 8;
182 $currentMap = $row2['map'];
183 if (($currentMap==0 AND $imageMAP==1) OR ($currentMap==1 AND $imageMAP==0) OR $currentMap==$imageMAP)
185 if ($currentMap==0)
187 $image_DX = 472;
188 $image_SX = -1180/18000;
189 $image_DY = 1838;
190 $image_SY = -340/5350;
192 // Коэффициенты перевода координат для Калимдора
193 else if ($currentMap==1)
195 $image_DX = 795;
196 $image_SX = -1270/19100;
197 $image_DY = 318;
198 $image_SY = -570/8850;
200 $x = $image_DY+$image_SY*$posy+0.5-$centerImage;
201 $y = $image_DX+$image_SX*$posx+0.5-$centerImage;
202 $sx+= $x;
203 $sy+= $y;
204 $n++;
206 else
209 $x = 10+$dx;
210 $y = 10+$dy;
211 $dx+=8;if ($dx>160){$dx=0;$dy+=8;}
212 $sx+=$x;
213 $sy+=$y;
214 $n++;
216 if ($where == "gameobject")
218 echo "<a href=\"map.php?id=$id&where=$where&x=$posx&y=$posy&map=$row2[map]\">";
219 echo "<img src=\"$img\" style=\"position: absolute; border: 0px; left: $x; top: $y;
220 \"onmouseover=\"this.T_TITLE='<div align=center>$row[name]</div>';
221 return escape('Респавн: $time<br>GUID $row2[guid]<br>$posy $posx $row2[position_z] $row2[map]')\"
222 ></a>\n";
224 else
226 echo "<a href=\"map.php?id=$id&where=$where&x=$posx&y=$posy&map=$row2[map]\">";
227 echo "<img src=\"$img\" style=\"position: absolute; border: 0px; left: $x; top: $y;
228 \"onmouseover=\"this.T_TITLE='<div align=center>$row[name]</div>';
229 return escape('Уровень: $row[maxlevel]<br>Тип: $NPCType[$type]<br>Жизнь: $row2[curhealth]<br>Урон: $row[mindmg] - $row[maxdmg]<br>Респавн: $time<br>GUID $row2[guid]<br>$posy $posx $row2[position_z] $row2[map]')\"
230 ></a>\n";
233 $sx=$sx/$n-512;
234 $sy=$sy/$n-384;
236 </div>
237 <script language="JavaScript" type="text/javascript" src="wz_tooltip.js"></script>
238 <script language="JavaScript" type="text/javascript">
239 <?php
240 echo "javascript:scroll($sx,$sy)";
242 </script>
243 </body>
244 </html>
245 <?php