2 include ("GameEngine/Village.php");
4 if($session->plus
== 0) {
5 header("Location: plus.php?id=3");
8 if($_POST['type'] == 15) {
9 header("Location: ".$_SERVER['PHP_SELF']."?s=1");
11 if($_POST['type'] == 9) {
12 header("Location: ".$_SERVER['PHP_SELF']."?s=2");
16 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
23 ?
> - Crop Finder
</title
>
24 <link REL
="shortcut icon" HREF
="favicon.ico"/>
25 <meta http
-equiv
="cache-control" content
="max-age=0" />
26 <meta http
-equiv
="pragma" content
="no-cache" />
27 <meta http
-equiv
="expires" content
="0" />
28 <meta http
-equiv
="imagetoolbar" content
="no" />
29 <meta http
-equiv
="content-type" content
="text/html; charset=UTF-8" />
30 <script src
="mt-full.js?0faaa" type
="text/javascript"></script
>
31 <script src
="unx.js?0faaa" type
="text/javascript"></script
>
32 <script src
="new.js?0faaa" type
="text/javascript"></script
>
37 ?>lang/en/lang.css?f4b7c" rel
="stylesheet" type
="text/css" />
42 ?>lang/en/compact.css?f4b7c" rel
="stylesheet" type
="text/css" />
45 if($session->gpack
== null || GP_ENABLE
== false) {
47 <link href='".GP_LOCATE
."travian.css?e21d2' rel='stylesheet' type='text/css' />
48 <link href='".GP_LOCATE
."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
52 <link href='".$session->gpack
."travian.css?e21d2' rel='stylesheet' type='text/css' />
53 <link href='".$session->gpack
."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
57 <script type
="text/javascript">
59 window
.addEvent('domready', start
);
64 <body
class="v35 ie ie8">
66 <img style
="filter:chroma();" src
="img/x.gif" id
="msfilter" alt
="" />
67 <div id
="dynamic_header">
71 include ("Templates/header.tpl");
77 include ("Templates/menu.tpl");
80 <div id
="content" class="player">
84 <img width
="200" src
="gpack/travian_default/img/g/f6.jpg" />
85 <img width
="200" src
="gpack/travian_default/img/g/f1.jpg" />
90 echo $_SERVER['PHP_SELF'];
93 <span
>Search
for:</span
><br
/>
94 <input type
="radio" class="radio" name
="type" value
="15" /> 15 crop
95 <input type
="radio" class="radio" name
="type" value
="9" /> 9 crop
<br
/>
96 <input type
="submit" name
="submit" value
="Search">
101 define('PREFIX', TB_PREFIX
);
102 $type15 = mysql_query("SELECT id,x,y,occupied FROM ".PREFIX
."wdata WHERE fieldtype = 6");
103 $type9 = mysql_query("SELECT id,x,y,occupied FROM ".PREFIX
."wdata WHERE fieldtype = 1");
104 $wref = $village->wid
;
105 $coor = $database->getCoor($wref);
107 function getDistance($coorx1, $coory1, $coorx2, $coory2) {
108 $max = WORLD_MAX
* WORLD_MAX
;
109 $x1 = intval($coorx1);
110 $y1 = intval($coory1);
111 $x2 = intval($coorx2);
112 $y2 = intval($coory2);
113 $distanceX = min(abs($x2 - $x1), abs($max - abs($x2 - $x1)));
114 $distanceY = min(abs($y2 - $y1), abs($max - abs($y2 - $y1)));
115 $dist = sqrt(pow($distanceX, 2) +
pow($distanceY, 2));
116 return round($dist, 1);
119 if($_GET['s'] == 1) {
125 <th colspan
='5'>Crop Finder
- 15c
</th
>
141 while($row = mysql_fetch_array($type15)) {
142 $dist = getDistance($coor['x'], $coor['y'], $row['x'], $row['y']);
148 foreach($rows as $dist => $row) {
152 if($row['occupied'] == 0) {
153 echo "<td>(".$row['x']."|".$row['y'].")</td>";
155 echo "<td><b><font color=\"green\">Unoccupied</b></font></td>";
157 echo "<td><a href=\"karte.php?d=".$row['id']."&c=".$generator->getMapCheck($row['id'])."\">".$database->getVillageField($row['id'], "name")." (".$row['x']."|".$row['y'].")</a></td>";
158 echo "<td><a href=\"spieler.php?uid=".$database->getVillageField($row['id'], "owner")."\">".$database->getUserField($database->getVillageField($row['id'], "owner"), "username", 0)."</a></td>";
159 echo "<td><b><font color=\"red\">Occupied</b></font></td>";
161 echo "<td><center>".getDistance($coor['x'], $coor['y'], $row['x'], $row['y'])."</center></td>";
171 else if($_GET['s'] == 2) {
177 <th colspan
='5'>Crop Finder
- 9c
</th
>
193 while($row = mysql_fetch_array($type9)) {
194 $dist = getDistance($coor['x'], $coor['y'], $row['x'], $row['y']);
200 foreach($rows as $dist => $row) {
205 if($row['occupied'] == 0) {
206 echo "<td>(".$row['x']."|".$row['y'].")</td>";
208 echo "<td><b><font color=\"green\">Unoccupied</b></font></td>";
210 echo "<td><a href=\"karte.php?d=".$row['id']."&c=".$generator->getMapCheck($row['id'])."\">".$database->getVillageField($row['id'], "name")." (".$row['x']."|".$row['y'].")</a></td>";
211 echo "<td><a href=\"spieler.php?uid=".$database->getVillageField($row['id'], "owner")."\">".$database->getUserField($database->getVillageField($row['id'], "owner"), "username", 0)."</a></td>";
212 echo "<td><b><font color=\"red\">Occupied</b></font></td>";
214 echo "<td><center>".getDistance($coor['x'], $coor['y'], $row['x'], $row['y'])."</center></td>";
230 include ("Templates/quest.tpl");
231 include ("Templates/news.tpl");
232 include ("Templates/multivillage.tpl");
233 include ("Templates/links.tpl");
237 <div
class="clear"></div
>
239 <div
class="footer-stopper"></div
>
240 <div
class="clear"></div
>
244 include ("Templates/footer.tpl");
245 include ("Templates/res.tpl");
251 Calculated in
<b
><?php
253 echo round(($generator->pageLoadTimeEnd() - $start) * 1000);
257 <br
/>Server time
: <span id
="tp1" class="b"><?php