3 #################################################################################
4 ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
5 ## --------------------------------------------------------------------------- ##
6 ## Filename crop_finder.php ##
8 ## License: TravianX Project ##
9 ## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
11 #################################################################################
13 include ("GameEngine/Village.php");
15 if($session->plus
== 0) {
16 header("Location: plus.php?id=3");
19 if($_POST['type'] == 15) {
20 header("Location: ".$_SERVER['PHP_SELF']."?s=1");
22 if($_POST['type'] == 9) {
23 header("Location: ".$_SERVER['PHP_SELF']."?s=2");
27 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
34 ?
> - Crop Finder
</title
>
35 <link REL
="shortcut icon" HREF
="favicon.ico"/>
36 <meta http
-equiv
="cache-control" content
="max-age=0" />
37 <meta http
-equiv
="pragma" content
="no-cache" />
38 <meta http
-equiv
="expires" content
="0" />
39 <meta http
-equiv
="imagetoolbar" content
="no" />
40 <meta http
-equiv
="content-type" content
="text/html; charset=UTF-8" />
41 <script src
="mt-full.js?0faaa" type
="text/javascript"></script
>
42 <script src
="unx.js?0faaa" type
="text/javascript"></script
>
43 <script src
="new.js?0faaa" type
="text/javascript"></script
>
48 ?>lang/en/lang.css?f4b7c" rel
="stylesheet" type
="text/css" />
53 ?>lang/en/compact.css?f4b7c" rel
="stylesheet" type
="text/css" />
56 if($session->gpack
== null || GP_ENABLE
== false) {
58 <link href='".GP_LOCATE
."travian.css?e21d2' rel='stylesheet' type='text/css' />
59 <link href='".GP_LOCATE
."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
63 <link href='".$session->gpack
."travian.css?e21d2' rel='stylesheet' type='text/css' />
64 <link href='".$session->gpack
."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
68 <script type
="text/javascript">
70 window
.addEvent('domready', start
);
75 <body
class="v35 ie ie8">
77 <img style
="filter:chroma();" src
="img/x.gif" id
="msfilter" alt
="" />
78 <div id
="dynamic_header">
82 include ("Templates/header.tpl");
88 include ("Templates/menu.tpl");
91 <div id
="content" class="player">
95 <img width
="200" src
="gpack/travian_default/img/g/f6.jpg" />
96 <img width
="200" src
="gpack/travian_default/img/g/f1.jpg" />
101 echo $_SERVER['PHP_SELF'];
104 <span
>Search
for:</span
><br
/>
105 <input type
="radio" class="radio" name
="type" value
="15" /> 15 crop
106 <input type
="radio" class="radio" name
="type" value
="9" /> 9 crop
<br
/>
107 <input type
="submit" name
="submit" value
="Search">
112 define('PREFIX', TB_PREFIX
);
113 $type15 = mysql_query("SELECT id,x,y,occupied FROM ".PREFIX
."wdata WHERE fieldtype = 6");
114 $type9 = mysql_query("SELECT id,x,y,occupied FROM ".PREFIX
."wdata WHERE fieldtype = 1");
115 $wref = $village->wid
;
116 $coor = $database->getCoor($wref);
118 function getDistance($coorx1, $coory1, $coorx2, $coory2) {
119 $max = 2 * WORLD_MAX +
1;
120 $x1 = intval($coorx1);
121 $y1 = intval($coory1);
122 $x2 = intval($coorx2);
123 $y2 = intval($coory2);
124 $distanceX = min(abs($x2 - $x1), $max - abs($x2 - $x1));
125 $distanceY = min(abs($y2 - $y1), $max - abs($y2 - $y1));
126 $dist = sqrt(pow($distanceX, 2) +
pow($distanceY, 2));
127 return round($dist, 1);
130 if($_GET['s'] == 1) {
136 <th colspan
='5'>Crop Finder
- 15c
</th
>
152 while($row = mysql_fetch_array($type15)) {
153 $dist = getDistance($coor['x'], $coor['y'], $row['x'], $row['y']);
159 foreach($rows as $dist => $row) {
163 if($row['occupied'] == 0) {
164 echo "<td>(".$row['x']."|".$row['y'].")</td>";
166 echo "<td><b><font color=\"green\">Unoccupied</b></font></td>";
168 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>";
169 echo "<td><a href=\"spieler.php?uid=".$database->getVillageField($row['id'], "owner")."\">".$database->getUserField($database->getVillageField($row['id'], "owner"), "username", 0)."</a></td>";
170 echo "<td><b><font color=\"red\">Occupied</b></font></td>";
172 echo "<td><center>".getDistance($coor['x'], $coor['y'], $row['x'], $row['y'])."</center></td>";
182 else if($_GET['s'] == 2) {
188 <th colspan
='5'>Crop Finder
- 9c
</th
>
204 while($row = mysql_fetch_array($type9)) {
205 $dist = getDistance($coor['x'], $coor['y'], $row['x'], $row['y']);
211 foreach($rows as $dist => $row) {
216 if($row['occupied'] == 0) {
217 echo "<td>(".$row['x']."|".$row['y'].")</td>";
219 echo "<td><b><font color=\"green\">Unoccupied</b></font></td>";
221 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>";
222 echo "<td><a href=\"spieler.php?uid=".$database->getVillageField($row['id'], "owner")."\">".$database->getUserField($database->getVillageField($row['id'], "owner"), "username", 0)."</a></td>";
223 echo "<td><b><font color=\"red\">Occupied</b></font></td>";
225 echo "<td><center>".getDistance($coor['x'], $coor['y'], $row['x'], $row['y'])."</center></td>";
241 include ("Templates/quest.tpl");
242 include ("Templates/news.tpl");
243 include ("Templates/multivillage.tpl");
244 include ("Templates/links.tpl");
248 <div
class="clear"></div
>
250 <div
class="footer-stopper"></div
>
251 <div
class="clear"></div
>
255 include ("Templates/footer.tpl");
256 include ("Templates/res.tpl");
262 Calculated in
<b
><?php
264 echo round(($generator->pageLoadTimeEnd() - $start) * 1000);
268 <br
/>Server time
: <span id
="tp1" class="b"><?php