Инструкция по установке, скопирована с оригинального репозитория
[cswow.git] / map / map.php
blob91b96c68fe6ee6bcd4beaea0e4fd8c747ed5e28b
1 <?php
2 include_once("../conf.php");
3 include_once("zone_tables.php");
5 mysql_connect($config['hostname'],$config['username'],$config['password']) OR DIE("Не возможно создать соеденение с базой сервера.".mysql_error());
6 mysql_select_db($config['dbName']) or die(mysql_error());
8 $id = intval(@$_REQUEST['id']);
9 $where = @$_REQUEST['where'];
10 $map = intval(@$_REQUEST['map']);
11 $x = intval(@$_REQUEST['x']);
12 $y = intval(@$_REQUEST['y']);
13 if ($map!=0 AND $map!=1 AND $map != 530)
15 include("instance.php");
17 else
19 echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
20 $areaName=get_map_name($map);
21 $zone =get_zone($map,$x,$y);
22 if ($zone==0)
24 echo "<center><table valign=\"bottom\"><tr><td><img src=\"../images/wowd.jpg\"></td></tr><tr><td><center>Неизвестная зона</center></td></tr></table></center>";
25 die();
27 $area = get_Area($zone[5]);
28 if ($area==0)
30 echo "<center><table valign=\"bottom\"><tr><td><img src=\"../images/wowd.jpg\"></td></tr><tr><td><center>Карта не найденна(</center></td></tr></table></center>";
31 die();
33 $background = "img/map_image/$areaName/$area[3].jpg";
35 $mapID = $area[1];
36 $areaY1 = $area[4];
37 $areaY2 = $area[5];
38 $areaX1 = $area[6];
39 $areaX2 = $area[7];
41 $imageX = 668;
42 $imageY = 1002;
45 <html>
46 <head>
47 <meta http-equiv=Content-Type content=text/html; charset=utf-8>
48 <title></title>
49 <style type="text/css">
50 <!--
51 body {
52 margin-left: 0px;
53 margin-top: 0px;
54 margin-right: 0px;
55 margin-bottom: 0px;
56 color: #EABA28;
57 background-color: #000000;
59 -->
60 </style>
62 </head>
64 <body>
65 <?php
67 echo "<CENTER>";
68 //$imageX/=1.5;
69 //$imageY/=1.5;
70 $sizeX = $imageY;
71 $sizeY = $imageX+4;
72 $tableBorder = 1;
73 $tableWidth = $imageY+$tableBorder*2+8;
74 echo "<TABLE border=$tableBorder width=$tableWidth>";
75 echo "<TBODY><TR><TD align = center>$areaName - $zone[4]</TD></TR>";
76 echo "<TR><TD width=$sizeX height=$sizeY align=left valign=top>";
77 echo "<SPAN style=\"position: relative; border: 0px; left: 0; top: 0;\">&nbsp;";
78 echo "<IMG src=$background width=$imageY height=$imageX style=\"position: absolute; border: 0px; left: 0; top: 0;\">";
79 if ($x!=0 && $y!=0)
81 $x=round($imageX*($x - $areaX1)/($areaX2-$areaX1)-8,0);
82 $y=round($imageY*($y - $areaY1)/($areaY2-$areaY1)-8,0);
83 echo "<img src=\"img/gps_icon.png\" style=\"position: absolute; border: 0px; left: $y; top: $x;\">\n";
85 if ($id)
87 if ($where == "gameobject")
89 $res = mysql_query("SELECT * FROM `gameobject_template` WHERE entry = '$id' LIMIT 1") or die(mysql_error());
90 $row = mysql_fetch_array($res);
91 mysql_free_result($res);
92 $res2 = mysql_query("SELECT * FROM `gameobject` WHERE id = '$id'") or die(mysql_error());
93 while ($row2=mysql_fetch_array($res2))
95 $map = $row2['map'];
96 $posx = $row2['position_x'];
97 $posy = $row2['position_y'];
98 $type = $row['type'];
99 if ($areaX1 > $posx && $areaX2 < $posx &&
100 $areaY1 > $posy && $areaY2 < $posy && $mapID == $map)
102 if ($type == 3) {$img = "img/iron.gif"; $centerImage = 4; }
103 else {$img = "img/gps_icon.png"; $centerImage = 8; }
104 $type = $row['type'];
105 $time = get_time_text($row2['spawntimesecs']);
107 $x=round($imageX*($posx - $areaX1)/($areaX2-$areaX1)-$centerImage,0);
108 $y=round($imageY*($posy - $areaY1)/($areaY2-$areaY1)-$centerImage,0);
109 $name = validateTextForMap($row['name']);
110 echo "<a href=\"map.php?id=$id&where=$where&x=$posx&y=$posy&map=$row2[map]\">";
111 echo "<img src=\"$img\" style=\"position: absolute; border: 0px; left: $y; top: $x;\"onmouseover=\"this.T_TITLE='<div align=center>$name</div>';return escape('Респавн: $time<br>GUID $row2[guid]<br>$posy $posx $row2[position_z] $row2[map]')\"></a>\n";
115 else
117 $res = mysql_query("SELECT * FROM `creature_template` WHERE entry = '$id' LIMIT 1") or die(mysql_error());
118 $row = mysql_fetch_array($res);
119 mysql_free_result($res);
121 $res2 = mysql_query("SELECT * FROM `creature` WHERE id = '$id'") or die(mysql_error());
122 while ($row2=mysql_fetch_array($res2))
124 $map = $row2['map'];
125 $posx = $row2['position_x'];
126 $posy = $row2['position_y'];
128 if ($areaX1 > $posx && $areaX2 < $posx &&
129 $areaY1 > $posy && $areaY2 < $posy && $mapID == $map)
131 if ($row2['id']==$id){$img = "img/gps_icon.png"; $centerImage = 8;}
132 else {$img = "img/green.gif"; $centerImage = 2;}
134 $row['name']=str_replace("'","`",$row['name']);
135 $row['name']=str_replace("\"","`",$row['name']);
136 $type = $row['type'];
137 $time = get_time_text($row2['spawntimesecs']);
139 $x=round($imageX*($posx - $areaX1)/($areaX2-$areaX1)-$centerImage,0);
140 $y=round($imageY*($posy - $areaY1)/($areaY2-$areaY1)-$centerImage,0);
142 $name = validateTextForMap($row['name']);
143 echo "<a href=\"map.php?id=$id&where=$where&x=$posx&y=$posy&map=$row2[map]\">";
144 echo "<img src=\"$img\" style=\"position: absolute; border: 0px; left: $y; top: $x;\"onmouseover=\"this.T_TITLE='<div align=center>$name</div>';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]')\"></a>\n";
149 echo "</SPAN>";
150 echo "</TD></TR></TBODY>";
151 echo "</TABLE>";
152 echo "</CENTER>";
155 <script language="JavaScript" type="text/javascript" src="wz_tooltip.js"></script>
156 <script language="JavaScript" type="text/javascript"></script>
157 </body>
159 </html>
160 <?php