just a quick uncomment cause some just run and wonder why it dose nothing
[travianx.git] / crop_finder_dps.php
blobb33e15caa254d554ecbbbf66a10063203d80ad3d
1 <?php
3 /**
4 * @author Genesis
5 * @copyright 2011
6 * @name CropFinder
7 * @uses Village
8 * @uses Database
9 */
11 include("GameEngine/Village.php");
14 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
15 <html>
16 <head>
17 <title><?php echo SERVER_NAME ?> - Crop finder</title>
18 <link REL="shortcut icon" HREF="favicon.ico"/>
19 <meta http-equiv="cache-control" content="max-age=0" />
20 <meta http-equiv="pragma" content="no-cache" />
21 <meta http-equiv="expires" content="0" />
22 <meta http-equiv="imagetoolbar" content="no" />
23 <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
24 <script src="mt-full.js?0faaa" type="text/javascript"></script>
25 <script src="unx.js?0faaa" type="text/javascript"></script>
26 <script src="new.js?0faaa" type="text/javascript"></script>
27 <link href="<?php echo GP_LOCATE; ?>lang/en/compact.css?e21d2" rel="stylesheet" type="text/css" />
28 <link href="<?php echo GP_LOCATE; ?>lang/en/lang.css?e21d2" rel="stylesheet" type="text/css" />
29 <?php
30 if($session->gpack == null || GP_ENABLE == false) {
31 echo "
32 <link href='".GP_LOCATE."travian.css?e21d2' rel='stylesheet' type='text/css' />
33 <link href='".GP_LOCATE."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
34 } else {
35 echo "
36 <link href='".$session->gpack."travian.css?e21d2' rel='stylesheet' type='text/css' />
37 <link href='".$session->gpack."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
40 <script type="text/javascript">
41 window.addEvent('domready', start);
42 </script>
43 </head>
46 <body class="v35 ie ie8">
47 <div class="wrapper">
48 <img style="filter:chroma();" src="img/x.gif" id="msfilter" alt="" />
49 <div id="dynamic_header">
50 </div>
51 <?php include("Templates/header.tpl"); ?>
52 <div id="mid">
53 <?php include("Templates/menu.tpl"); ?>
54 <div id="content" class="village1">
55 <h1>
56 Crop finder
57 </h1>
58 <img width="150" src="gpack/travian_default/img/g/f6.jpg" />
59 <img width="150" src="gpack/travian_default/img/g/f1.jpg" />
60 <br />
62 <?php
64 $mc15 = 6;
65 $mc9 = 1;
67 $thiscoor = mysql_Fetch_Assoc(mysql_query("SELECT x,y FROM ".TB_PREFIX."wdata WHERE id = ".$village->wid));
69 $x = "IF(ABS(x-".$thiscoor['x'].")<=".WORLD_MAX.",ABS(x-".$thiscoor['x']."),".(WORLD_MAX*2+1)."-ABS(x-".$thiscoor['x']."))";
70 $y = "IF(ABS(y-".$thiscoor['y'].")<=".WORLD_MAX.",ABS(y-".$thiscoor['y']."),".(WORLD_MAX*2+1)."-ABS(y-".$thiscoor['y']."))";
71 $DistanceCalc = "FORMAT(SQRT(POW(".$x.",2)+POW(".$y.",2)),1) AS Distance";
72 $q = "SELECT occupied,fieldtype,x,y,".$DistanceCalc." FROM ".TB_PREFIX."wdata WHERE fieldtype=".$mc15." OR fieldtype=".$mc9." ORDER BY fieldtype DESC,ABS(Distance)";
73 $croppers = mysql_query($q);
75 echo "<table cellpadding='1' cellspacing='1' class='build_details' border='1' style='border-collapse:collapse'><thead>
76 <tr><td>Type</td><td>Occupied</td><td>Position</td><td>Distance</td></tr></thead>
79 while($row = mysql_fetch_assoc($croppers)){
80 echo "<tbody><tr><td>".($row['fieldtype']==6?'15-cropper':'9-cropper')."</td><td>";
81 echo ($row['occupied'] == 1) ? 'Occupied' : 'Free';
82 echo "</td><td>".$row['x']."|".$row['y']."</td>
83 <td>".$row['Distance']."</td>
84 </tr></tbody>";
85 $newrow = $row;
88 echo '</table>';
90 </div>
91 <div id="side_info">
92 <?php
93 include("Templates/quest.tpl");
94 include("Templates/news.tpl");
95 include("Templates/multivillage.tpl");
96 include("Templates/links.tpl");
98 </div>
99 <div class="clear"></div>
100 </div>
101 <div class="footer-stopper"></div>
102 <div class="clear"></div>
104 <?php
105 include("Templates/footer.tpl");
106 include("Templates/res.tpl");
108 <div id="stime">
109 <div id="ltime">
110 <div id="ltimeWrap">
111 Calculated in <b><?php
112 echo round(($generator->pageLoadTimeEnd()-$start)*1000);
113 ?></b> ms
115 <br />Server time: <span id="tp1" class="b"><?php echo date('H:i:s'); ?></span>
116 </div>
117 </div>
118 </div>
120 <div id="ce"></div>
121 </body>
122 </html>