mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-06 04:44:21 +00:00
Farmlist improvements and fixes
+Troops while adding/editing a raid lists are now inside of a table, this is a graphic enhancement +Reduced the X and Y textboxes size while adding/editing a raid list +Fixed a bug that didn't permit to add a raid list +Fixed a bug that did permit to insert spies in raid lists +The farmlists graphic is now more clear, "Add raid" and "Start raid" are now two general buttons, instead of having two buttons for raid list +"Select all" checkbox, will select all raid without refreshing the page (through JS) +Moved the function "getDistance" to Database.php +Removed a lot of redundant code from crop_finder.php +Removed rams, catapults, chiefs and settlers from the raid list, because the first three can't even loot resources +Removed trooplist2.tpl because of a more general unique template file (trooplist.tpl) +Some minor improvements and bug fixing IMPORTANT NOTE: if you don't want to reinstal the whole server, you can simply run this little query (where "s1_" is the prefix of your server): ALTER TABLE `s1_raidlist` DROP `t7`, DROP `t8`, DROP `t9`, DROP `t10`;
This commit is contained in:
+23
-42
@@ -2,17 +2,6 @@
|
||||
$artefact1 = $database->getOwnArtefactInfo3($session->uid);
|
||||
$wref = $village->wid;
|
||||
$coor = $database->getCoor($wref);
|
||||
function getDistance($coorx1, $coory1, $coorx2, $coory2) {
|
||||
$max = 2 * WORLD_MAX + 1;
|
||||
$x1 = intval($coorx1);
|
||||
$y1 = intval($coory1);
|
||||
$x2 = intval($coorx2);
|
||||
$y2 = intval($coory2);
|
||||
$distanceX = min(abs($x2 - $x1), abs($max - abs($x2 - $x1)));
|
||||
$distanceY = min(abs($y2 - $y1), abs($max - abs($y2 - $y1)));
|
||||
$dist = sqrt(pow($distanceX, 2) + pow($distanceY, 2));
|
||||
return round($dist, 1);
|
||||
}
|
||||
?>
|
||||
<body>
|
||||
<div class="gid27">
|
||||
@@ -107,40 +96,32 @@ if($count == 0) {
|
||||
$rows = array();
|
||||
while($row = mysqli_fetch_array($arts)) {
|
||||
$query = mysqli_query($database->dblink,'SELECT x, y FROM `' . TB_PREFIX . 'wdata` WHERE `id` = ' . (int) $row['vref']);
|
||||
$coor2 = mysqli_fetch_assoc($query);
|
||||
|
||||
|
||||
$dist = round(getDistance($coor['x'], $coor['y'], $coor2['x'], $coor2['y']),1);
|
||||
|
||||
$rows[$dist] = $row;
|
||||
|
||||
$coor2 = mysqli_fetch_assoc($query);
|
||||
$dist = $database->getDistance($coor['x'], $coor['y'], $coor2['x'], $coor2['y']);
|
||||
$rows[$dist] = $row;
|
||||
}
|
||||
ksort($rows);
|
||||
foreach($rows as $row) {
|
||||
$wref = $village->wid;
|
||||
$coor = $database->getCoor($wref);
|
||||
$wref2 = $row['vref'];
|
||||
$coor2 = $database->getCoor($wref2);
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span>';
|
||||
echo '<div class="info">';
|
||||
if($row['size'] == 1 && $row['type'] != 11){
|
||||
$reqlvl = 10;
|
||||
$effect = VILLAGE;
|
||||
}else{
|
||||
if($row['type'] != 11){
|
||||
$reqlvl = 20;
|
||||
}else{
|
||||
$reqlvl = 10;
|
||||
}
|
||||
$effect = ACCOUNT;
|
||||
}
|
||||
echo '<div class="info">'.TREASURY.' <b>' . $reqlvl . '</b>, '.EFFECT.' <b>' . $effect . '</b>';
|
||||
echo '</div></td><td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="dist">'.getDistance($coor['x'], $coor['y'], $coor2['x'], $coor2['y']).'</td>';
|
||||
echo '</tr>';
|
||||
$wref = $village->wid;
|
||||
$coor = $database->getCoor($wref);
|
||||
$wref2 = $row['vref'];
|
||||
$coor2 = $database->getCoor($wref2);
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span>';
|
||||
echo '<div class="info">';
|
||||
if($row['size'] == 1 && $row['type'] != 11){
|
||||
$reqlvl = 10;
|
||||
$effect = VILLAGE;
|
||||
}else{
|
||||
$reqlvl = $row['type'] != 11 ? 20 : 10;
|
||||
$effect = ACCOUNT;
|
||||
}
|
||||
echo '<div class="info">'.TREASURY.' <b>' . $reqlvl . '</b>, '.EFFECT.' <b>' . $effect . '</b>';
|
||||
echo '</div></td><td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="dist">'.$database->getDistance($coor['x'], $coor['y'], $coor2['x'], $coor2['y']).'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user