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:
iopietro
2018-05-16 16:49:25 +02:00
parent 656bd4f970
commit bdd3bfd41c
16 changed files with 340 additions and 863 deletions
+1 -1
View File
@@ -250,7 +250,7 @@ class Battle {
//dp = Infantry defense points
//rap = Result attack points
//rdp = Result defense points
//detected = Detected or not by enemy spies
//detected = Detected or not by defender spies
$cap = $ap = $dp = $cdp = $rap = $rdp = 0;
$detected = false;
+54 -27
View File
@@ -1470,6 +1470,27 @@ class MYSQLi_DB implements IDbConnection {
return self::$oasisTroopsCountCache[$vref];
}
/**
* Calculates the distance from a village to another
*
* @param int $coorx1 X coordinate of the first village
* @param int $coory1 Y coordinate of the second village
* @param int $coorx2 X coordinate of the first village
* @param int $coory2 Y coordinate of the second village
* @return int Returns the calculated distance
*/
public 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)));
return round(sqrt(pow($distanceX, 2) + pow($distanceY, 2)), 1);
}
public function canConquerOasis($vref, $wref, $use_cache = true) {
list($vref,$wref) = $this->escape_input($vref,$wref);
@@ -1592,7 +1613,7 @@ class MYSQLi_DB implements IDbConnection {
}
/*****************************************
Function to retrieve if is ocuped via ID
Function to retrieve if is occupied via ID
References: Village ID
*****************************************/
function getVillageState($wref, $use_cache = true) {
@@ -2460,15 +2481,6 @@ class MYSQLi_DB implements IDbConnection {
return $this->getVillageByWorldID($wref, $use_cache)['oasistype'];
}
// no need to cache this method
function getFLData($id) {
list($id) = $this->escape_input((int) $id);
$q = "SELECT * FROM " . TB_PREFIX . "farmlist where id = $id LIMIT 1";
$result = mysqli_query($this->dblink,$q);
return mysqli_fetch_array($result);
}
// no need to cache this method
function checkVilExist($wref) {
list($wref) = $this->escape_input((int) $wref);
@@ -7493,18 +7505,13 @@ References: User ID/Message ID, Mode
}
// no need to cache this method
function getVilFarmlist($wref) {
list($wref) = $this->escape_input((int) $wref);
$q = 'SELECT * FROM ' . TB_PREFIX . 'farmlist WHERE wref = ' . $wref . ' ORDER BY wref ASC LIMIT 1';
function getVilFarmlist($uid) {
list($uid) = $this->escape_input((int) $uid);
$q = 'SELECT * FROM ' . TB_PREFIX . 'farmlist WHERE owner = '.$uid.' ORDER BY wref ASC LIMIT 1';
$result = mysqli_query($this->dblink,$q);
$dbarray = mysqli_fetch_array($result);
if($dbarray['id']!=0) {
return true;
} else {
return false;
}
return $dbarray['id'] > 0;
}
// no need to cache this method
@@ -7512,15 +7519,35 @@ References: User ID/Message ID, Mode
list($id) = $this->escape_input((int) $id);
$q = "SELECT * FROM " . TB_PREFIX . "raidlist WHERE id = ".$id." LIMIT 1";
$result = mysqli_query($this->dblink, $q);
return mysqli_fetch_array($result);
}
/**
* Get all informations about a farm list
*
* @param int $id The farmlist ID
* @return array Returns the seleted farm list informations
*/
function getFLData($id) {
list($id) = $this->escape_input((int) $id);
$q = "SELECT * FROM " . TB_PREFIX . "farmlist where id = $id LIMIT 1";
$result = mysqli_query($this->dblink,$q);
return mysqli_fetch_array($result);
}
function delFarmList($id, $owner) {
list($id, $owner) = $this->escape_input((int) $id, (int) $owner);
$q = "DELETE FROM " . TB_PREFIX . "farmlist where id = $id and owner = $owner";
return mysqli_query($this->dblink,$q);
if(mysqli_query($this->dblink, $q) && mysqli_affected_rows($this->dblink) > 0){
$q = "DELETE FROM " . TB_PREFIX . "raidlist where lid = $id";
return mysqli_query($this->dblink, $q);
}
return false;
}
function delSlotFarm($id, $owner, $lid) {
@@ -7537,17 +7564,17 @@ References: User ID/Message ID, Mode
return mysqli_query($this->dblink,$q);
}
function addSlotFarm($lid, $owner, $towref, $x, $y, $distance, $t1, $t2, $t3, $t4, $t5, $t6, $t7, $t8, $t9, $t10) {
list($lid, $owner, $towref, $x, $y, $distance, $t1, $t2, $t3, $t4, $t5, $t6, $t7, $t8, $t9, $t10) = $this->escape_input($lid, $owner, $towref, $x, $y, $distance, $t1, $t2, $t3, $t4, $t5, $t6, $t7, $t8, $t9, $t10);
function addSlotFarm($lid, $towref, $x, $y, $distance, $t1, $t2, $t3, $t4, $t5, $t6) {
list($lid, $towref, $x, $y, $distance, $t1, $t2, $t3, $t4, $t5, $t6) = $this->escape_input($lid, $towref, $x, $y, $distance, $t1, $t2, $t3, $t4, $t5, $t6);
$q = "INSERT INTO " . TB_PREFIX . "raidlist (`lid`, `towref`, `x`, `y`, `distance`, `t1`, `t2`, `t3`, `t4`, `t5`, `t6`, `t7`, `t8`, `t9`, `t10`) SELECT '$lid', '$towref', '$x', '$y', '$distance', '$t1', '$t2', '$t3', '$t4', '$t5', '$t6', '$t7', '$t8', '$t9', '$t10' WHERE EXISTS(SELECT 1 FROM " . TB_PREFIX . "farmlist WHERE id = $lid AND owner = $owner)";
$q = "INSERT INTO " . TB_PREFIX . "raidlist (`lid`, `towref`, `x`, `y`, `distance`, `t1`, `t2`, `t3`, `t4`, `t5`, `t6`) VALUES ('$lid', '$towref', '$x', '$y', '$distance', '$t1', '$t2', '$t3', '$t4', '$t5', '$t6')";
return mysqli_query($this->dblink,$q);
}
function editSlotFarm($eid, $lid, $oldLid, $owner, $wref, $x, $y, $dist, $t1, $t2, $t3, $t4, $t5, $t6, $t7, $t8, $t9, $t10) {
list($eid, $lid, $oldLid, $owner, $wref, $x, $y, $dist, $t1, $t2, $t3, $t4, $t5, $t6, $t7, $t8, $t9, $t10) = $this->escape_input((int) $eid, $lid, $oldLid, $owner, $wref, $x, $y, $dist, $t1, $t2, $t3, $t4, $t5, $t6, $t7, $t8, $t9, $t10);
function editSlotFarm($eid, $lid, $oldLid, $owner, $wref, $x, $y, $dist, $t1, $t2, $t3, $t4, $t5, $t6) {
list($eid, $lid, $oldLid, $owner, $wref, $x, $y, $dist, $t1, $t2, $t3, $t4, $t5, $t6) = $this->escape_input((int) $eid, $lid, $oldLid, $owner, $wref, $x, $y, $dist, $t1, $t2, $t3, $t4, $t5, $t6);
$q = "UPDATE " . TB_PREFIX . "raidlist SET lid = '$lid', towref = '$wref', x = '$x', y = '$y', t1 = '$t1', t2 = '$t2', t3 = '$t3', t4 = '$t4', t5 = '$t5', t6 = '$t6', t7 = '$t7', t8 = '$t8', t9 = '$t9', t10 = '$t10' WHERE id = $eid AND lid = $oldLid AND EXISTS(SELECT 1 FROM " . TB_PREFIX . "farmlist WHERE id = $lid AND owner = $owner) AND EXISTS(SELECT 1 FROM " . TB_PREFIX . "farmlist WHERE id = $oldLid AND owner = $owner)";
$q = "UPDATE " . TB_PREFIX . "raidlist SET lid = '$lid', towref = '$wref', x = '$x', y = '$y', t1 = '$t1', t2 = '$t2', t3 = '$t3', t4 = '$t4', t5 = '$t5', t6 = '$t6' WHERE id = $eid AND lid = $oldLid AND EXISTS(SELECT 1 FROM " . TB_PREFIX . "farmlist WHERE id = $lid AND owner = $owner) AND EXISTS(SELECT 1 FROM " . TB_PREFIX . "farmlist WHERE id = $oldLid AND owner = $owner)";
return mysqli_query($this->dblink,$q);
}
+3
View File
@@ -677,6 +677,8 @@ define("NOTROOP","no troops");
//map
define("DETAIL","Details");
define("ABANDVALLEY","Abandoned valley");
define("OCCUPIED","Occupied");
define("UNOCCUPIED","Unoccupied");
define("UNOCCUOASIS","Unoccupied oasis");
define("OCCUOASIS","Occupied oasis");
define("THERENOINFO","There is no<br>information available.");
@@ -708,6 +710,7 @@ define("WEST","West");
define("VILLAGE","Village");
define("OASIS","Oasis");
define("NO_OASIS", "You do not own any oases.");
define("NO_VILLAGES", "There are no villages.");
define("PLAYER","Player");
//LOGIN.php
+61 -75
View File
@@ -776,97 +776,83 @@ class Units {
global $database, $generator, $session;
$slots = $post['slot'];
$lid = $post['lid'];
if(empty($slots)){
header("Location: build.php?id=39&t=99");
exit();
}
$tribe = $session->tribe;
$getFLData = $database->getFLData($lid);
if($getFLData['owner'] != $session->uid) {
header("Location: build.php?id=39&t=99");
exit();
}
$sql = "SELECT id, towref, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10 FROM " . TB_PREFIX . "raidlist WHERE lid = ".$database->escape((int)$lid)." order by id asc";
$array = $database->query_return($sql);
foreach($array as $row){
$sql1 = mysqli_fetch_array(mysqli_query($database->dblink, "SELECT * FROM " . TB_PREFIX . "units WHERE vref = ".(int)$getFLData['wref']));
$sid = $row['id'];
$wref = $row['towref'];
for($i = 1; $i <= 10; $i++) ${'t'.$i} = $row['t'.$i];
foreach($slots as $slot){
$raidList = $database->getRaidList($slot);
$getFLData = $database->getFLData($raidList['lid']);
//Check if we're trying to start our raidlists or other players raidlist
if($getFLData['owner'] != $session->uid) continue;
$t11 = 0;
//Get the units in the village
$villageUnits = $database->getUnit($getFLData['wref'], false);
$sid = $raidList['id'];
$wref = $raidList['towref'];
for($i = 1; $i <= 6; $i++) ${'t'.$i} = $raidList['t'.$i];
$villageOwner = $database->getVillageField($wref, 'owner');
$userAccess = $database->getUserField($villageOwner, 'access', 0);
$userID = $database->getUserField($villageOwner, 'id', 0);
if($userAccess != 0 && !($userAccess == MULTIHUNTER && $userID == 5) && ($userAccess != ADMIN || (ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == ADMIN))){
if($tribe == 1){
$uname = "u";
$uname1 = "u1";
$uname2 = "";
}elseif($tribe == 2){
$uname = "u1";
$uname1 = "u2";
$uname2 = "1";
}elseif($tribe == 3){
$uname = "u2";
$uname1 = "u3";
$uname2 = "2";
}elseif($tribe == 4){
$uname = "u3";
$uname1 = "u4";
$uname2 = "3";
}else{
$uname = "u4";
$uname1 = "u5";
$uname2 = "4";
}
if($sql1[$uname.'1'] >= $t1 && $sql1[$uname.'2'] >= $t2 && $sql1[$uname.'3'] >= $t3 && $sql1[$uname.'4'] >= $t4 && $sql1[$uname.'5'] >= $t5 && $sql1[$uname.'6'] >= $t6 && $sql1[$uname.'7'] >= $t7 && $sql1[$uname.'8'] >= $t8 && $sql1[$uname.'9'] >= $t9 && $sql1[$uname1.'0'] >= $t10 && $sql1['hero'] >= $t11){
if($post['slot'.$sid] == 'on'){
$ckey = $generator->generateRandStr(6);
$time_now = time();
$id = $database->addA2b($ckey, $time_now, $wref, $t1, $t2, $t3, $t4, $t5, $t6, $t7, $t8, $t9, $t10, $t11, 4);
$data = $database->getA2b($ckey, $time_now);
$troopsTime = $this->getWalkingTroopsTime($getFLData['wref'], $data['to_vid'], $session->uid, $session->tribe, $data, 1, 'u');
$time = $database->getArtifactsValueInfluence($getFLData['owner'], $getFLData['wref'], 2, $troopsTime);
$ctar1 = $ctar2 = 0;
$abdata = $database->getABTech($getFLData['wref']);
$reference = $database->addAttack(($getFLData['wref']), $data['u1'], $data['u2'], $data['u3'], $data['u4'], $data['u5'], $data['u6'], $data['u7'], $data['u8'], $data['u9'], $data['u10'], $data['u11'], $data['type'], $ctar1, $ctar2, 0, $abdata['b1'], $abdata['b2'], $abdata['b3'], $abdata['b4'], $abdata['b5'], $abdata['b6'], $abdata['b7'], $abdata['b8']);
$troops = [];
$amounts = [];
$modes = [];
for($u = 1; $u <= 10; $u++){
if($tribe == 1) $unitKey = $uname2 . $u;
else $unitKey = $uname2.($u < 10 ? $u : 0);
$troops[] = $unitKey;
$amounts[] = $data['u'.$u];
$modes[] = 0;
}
$troops[] = 'hero';
$amounts[] = $data['u11'];
$modes[] = 0;
$database->modifyUnit($getFLData['wref'], $troops, $amounts, $modes);
$database->addMovement(3, $getFLData['wref'], $data['to_vid'], $reference, time(), ($time + time()));
// prevent re-use of the same attack via re-POSTing the same data
$database->remA2b($id);
//Start = the first troop of the player's tribe
//End = the last selectable troop of the player's tribe
$start = ($session->tribe - 1) * 10 + 1;
$end = $start + 5;
//Check if we've enough troops
$canSend = true;
for($i = $start; $i <= $end; $i++){
if($villageUnits['u'.$i] < ${'t'.($i - $start + 1)}){
$canSend = false;
break;
}
}
//Send the attack
if($canSend){
$ckey = $generator->generateRandStr(6);
$time_now = time();
$id = $database->addA2b($ckey, $time_now, $wref, $t1, $t2, $t3, $t4, $t5, $t6, 0, 0, 0, 0, 0, 4);
$data = $database->getA2b($ckey, $time_now);
$troopsTime = $this->getWalkingTroopsTime($getFLData['wref'], $data['to_vid'], $session->uid, $session->tribe, $data, 1, 'u');
$time = $database->getArtifactsValueInfluence($getFLData['owner'], $getFLData['wref'], 2, $troopsTime);
$abdata = $database->getABTech($getFLData['wref']);
$reference = $database->addAttack(($getFLData['wref']), $data['u1'], $data['u2'], $data['u3'], $data['u4'], $data['u5'], $data['u6'], 0, 0, 0, 0, 0, $data['type'], 0, 0, 0, $abdata['b1'], $abdata['b2'], $abdata['b3'], $abdata['b4'], $abdata['b5'], $abdata['b6'], $abdata['b7'], $abdata['b8']);
$troops = [];
$amounts = [];
$modes = [];
for($u = $start; $u <= $end; $u++){
$troops[] = $u;
$amounts[] = $data['u'.($u - $start + 1)];
$modes[] = 0;
}
$database->modifyUnit($getFLData['wref'], $troops, $amounts, $modes);
$database->addMovement(3, $getFLData['wref'], $data['to_vid'], $reference, time(), ($time + time()));
//Prevent re-use of the same attack via re-POSTing the same data
$database->remA2b($id);
}
}
}
header("Location: build.php?id=39&t=99");
exit();
}
};
$units = new Units;
?>
+23 -42
View File
@@ -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>';
}
}
+58 -173
View File
@@ -9,6 +9,10 @@ if(isset($_GET['t']) == 99 && isset($_POST['action']) == 'addList' && !empty($_P
exit;
}
?>
<form action="build.php?id=39&t=99&action=startRaid" method="post" name="msg">
<input type="hidden" name="action" value="startRaid">
<?php
$sql = mysqli_query($database->dblink,"SELECT id, name, owner, wref FROM ".TB_PREFIX."farmlist WHERE owner = ".(int) $session->uid." ORDER BY wref DESC");
$query = mysqli_num_rows($sql);
while($row = mysqli_fetch_array($sql)){
@@ -17,34 +21,26 @@ while($row = mysqli_fetch_array($sql)){
$lowner = $row["owner"];
$lwref = $row["wref"];
$lvname = $database->getVillageField($row["wref"], 'name');
if($lwref == $village->wid){
?>
<form action="build.php?id=39&t=99&action=startRaid" method="post">
<input type="hidden" name="action" value="startRaid">
<input type="hidden" name="a" value="c35">
<input type="hidden" name="sort" value="distance">
<input type="hidden" name="direction" value="asc">
<input type="hidden" name="lid" value="<?php echo $lid; ?>">
<div class="listTitleText">
<a href="build.php?gid=16&t=99&action=deleteList&lid=<?php echo $lid; ?>"><img class="del" src="img/x.gif" alt="delete" title="delete"></a>
<?php echo $lvname; ?> - <?php echo $lname; ?>
<img alt="Loading..." class="loading hide" src="img/x.gif" align="absmiddle">
</div>
<div class="openedClosedSwitch switchOpened"></div>
<div class="clear"></div>
</div>
</div>
<div class="listContent ">
<div class="detail">
<table id="raidList" cellpadding="1" cellspacing="1">
<thead>
<tr>
<td class="checkbox edit"></td>
<td class="village sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'village');">Village</td>
<td class="ew sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'ew');">Pop</td>
<td class="distance sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'distance');">Distance</td>
<td class="troops sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'troops');">Troops</td>
<td class="lastRaid sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'lastRaid');">Last raid</td>
<td class="action"></td>
<td></td>
<td>Village</td>
<td>Pop</td>
<td>Distance</td>
<td>Troops</td>
<td>Last raid</td>
<td></td>
</tr>
</thead>
<tbody>
@@ -52,49 +48,41 @@ while($row = mysqli_fetch_array($sql)){
<?php
$sql2 = mysqli_query($database->dblink,"SELECT * FROM ".TB_PREFIX."raidlist WHERE lid = ".(int) $lid." ORDER BY distance ASC");
$query2 = mysqli_num_rows($sql2);
if(!$query2) {
echo '<td class="noData" colspan="7">There are no village.</td>';
}else{
while($row = mysqli_fetch_array($sql2)){
$id = $row['id'];
$lid = $row['lid'];
$towref = $row['towref'];
$x = $row['x'];
$y = $row['y'];
if($village->wid == $towref) $distance = '0';
else $distance = $row['distance'];
for($i = 1; $i <= 10; $i++) ${'t'.$i} = $row['t'.$i];
$vdata = $database->getVillage($towref);
if(!$query2) echo '<td class="noData" colspan="7">'.NO_VILLAGES.'</td>';
else
{
while($row = mysqli_fetch_array($sql2)){
$id = $row['id'];
$lid = $row['lid'];
$towref = $row['towref'];
$x = $row['x'];
$y = $row['y'];
$distance = $row['distance'];
for($i = 1; $i <= 6; $i++) ${'t'.$i} = $row['t'.$i];
$vdata = $database->getVillage($towref);
?>
<tr class="slotRow">
<td class="checkbox">
<?php if($checked[$lid] == 0){ ?>
<input id="slot<?php echo $id; ?>" name="slot<?php echo $id; ?>" type="checkbox" class="markSlot" onclick="Travian.Game.RaidList.markSlotForRaid(<?php echo $lid; ?>, <?php echo $id; ?>, this.checked);">
<?php }else{ ?>
<input id="slot<?php echo $id; ?>" name="slot<?php echo $id; ?>" type="checkbox" class="markSlot" checked>
<?php } ?>
<input id="slot" name="slot[]" value="<?php echo $id; ?>" type="checkbox" class="markSlot">
</td>
<td class="village">
<?php
$incoming_attacks = $database->getMovement(3, $towref, 1);
if (($inc_atts = count($incoming_attacks)) > 0) {
foreach($incoming_attacks as $attack){
if($attack['attack_type'] != 4) $inc_atts -= 1;
$attacks = $database->getMovement(3, $towref, 1);
if (($attacksCount = count($attacks)) > 0) {
foreach($attacks as $attack){
if($attack['attack_type'] != 4) $attacksCount -= 1;
}
if($inc_atts > 0) echo '<img class="att2" src="img/x.gif" title="'.OWN_ATTACKING_TROOPS.'" />';
if($attacksCount > 0) echo '<img class="att2" src="img/x.gif" title="'.OWN_ATTACKING_TROOPS.'" />';
}
?>
?>
<label for="slot<?php echo $id; ?>">
<?php
$oasistype = $database->getVillageType2($towref);
if($oasistype != 0){
$thisVillageName = $database->getOasisField($towref, 'conqured') ? OCCUOASIS : UNOCCUOASIS;
}
if($oasistype != 0) $thisVillageName = $database->getOasisField($towref, 'conqured') ? OCCUOASIS : UNOCCUOASIS;
else $thisVillageName = $vdata["name"];
?>
<span class="coordinates coordinatesWithText">
@@ -113,7 +101,7 @@ $vdata = $database->getVillage($towref);
<?php
$start = ($session->tribe - 1) * 10 + 1;
$end = $session->tribe * 10;
$end = $start + 5;
for($i = $start; $i <= $end; $i++){
if(${'t'.($i - $start + 1)} > 0){
@@ -127,8 +115,11 @@ $vdata = $database->getVillage($towref);
</td>
<td class="lastRaid">
<?php
$noticeClass = array("Scout Report","Won as attacker without losses","Won as attacker with losses","Lost as attacker with losses","Won as defender without losses","Won as defender with losses","Lost as defender with losses","Lost as defender without losses","Reinforcement arrived","","Wood Delivered","Clay Delivered","Iron Delivered","Crop Delivered","","Won as defender without losses","Won as defender with losses","Lost as defender with losses","Won scouting as attacker","Lost scouting as attacker","Won scouting as defender","Lost scouting as defender");
$limits = "(ntype=1 or ntype=2 or ntype=3 or ntype=18 or ntype=19 or ntype=22)";
$noticeClass = ["Scout Report", "Won as attacker without losses", "Won as attacker with losses", "Lost as attacker with losses", "Won as defender without losses", "Won as defender with losses", "Lost as defender with losses", "Lost as defender without losses",
"Reinforcement arrived", "", "Wood Delivered", "Clay Delivered", "Iron Delivered", "Crop Delivered", "", "Won as defender without losses", "Won as defender with losses", "Lost as defender with losses", "Won scouting as attacker", "Lost scouting as attacker",
"Won scouting as defender", "Lost scouting as defender"];
$limits = "(ntype < 4 OR ntype = 18 OR ntype = 19)";
$getnotice = mysqli_query($database->dblink,"SELECT ntype, data, time, id FROM ".TB_PREFIX."ndata WHERE $limits AND toWref = ".(int) $towref." AND uid = ".(int) $session->uid." ORDER BY time DESC Limit 1");
if(mysqli_num_rows($getnotice) > 0){
while($row2 = mysqli_fetch_array($getnotice)){
@@ -136,8 +127,8 @@ while($row2 = mysqli_fetch_array($getnotice)){
$type2 = $row2['ntype'];
echo "<img src=\"img/x.gif\" class=\"iReport iReport".$row2['ntype']."\" title=\"".$noticeClass[$type2]."\"> ";
$allres = $dataarray[25] + $dataarray[26] + $dataarray[27] + $dataarray[28];
$carry = $dataarray[29];
$allres = $dataarray[23] + $dataarray[24] + $dataarray[25] + $dataarray[26];
$carry = $dataarray[27];
echo "<img title=\"$allres/$carry\" src=\"img/x.gif\" class=\"carry\"/>";
@@ -159,137 +150,31 @@ while($row2 = mysqli_fetch_array($getnotice)){
</tbody>
</table>
<div class="markAll">
<?php if($checked[$lid] == 0){ ?>
<input type="checkbox" id="raidListMarkAll<?php echo $lid; ?>" class="markAll" onclick="window.location.href = '?gid=16&t=99&slid=<?php echo $lid; ?>';">
<?php }else{ ?>
<input type="checkbox" id="raidListMarkAll<?php echo $lid; ?>" class="markAll" onclick="window.location.href = '?gid=16&t=99';" checked>
<?php } ?>
<label for="raidListMarkAll<?php echo $lid; ?>">Select All</label>
</div>
<div class="addSlot"><br />
<button type="button" class="trav_buttons" onclick="window.location.href = '?gid=16&t=99&action=addraid&lid=<?php echo $lid; ?>';">Add Raid</button>
<button type="submit" class="trav_buttons" value="Start Raid">Start Raid</button>
</div>
<div class="clear"></div><br /><br />
<div class="clear"></div><br />
<div class="troopSelection">
<?php
/*
$start = ($session->tribe-1)*10+1;
$end = ($session->tribe*10);
$un = 1;
for($i=$start;$i<=$end;$i++){
echo '<span class="troopSelectionUnit">
<img class="unit u'.$i.'" title="'.$technology->unarray[$i].'" src="img/x.gif">
<span class="troopSelectionValue">0</span>
</span>';
}
*/
?>
<div class="clear"></div>
<div class="clear"></div>
</div>
</div>
<?php }?>
<?php if($database->getVilFarmlist($session->uid)){ ?>
<div class="markAll">
<input type="checkbox" id="raidListMarkAll" name="s10" class="markAll" onclick="Allmsg(this.form);">
<label for="raidListMarkAll">Select all</label>
</div><br />
<div class="addSlot">
<button type="button" class="trav_buttons" onclick="window.location.href = '?gid=16&t=99&action=addraid';">Add Raid</button>
<button type="submit" class="trav_buttons" value="Start Raid">Start Raid</button>
</div><br />
</form>
<?php }else{ ?>
<div id="list<?php echo $lid; ?>" class="listEntry">
<div class="round spacer listTitle" onclick="Travian.Game.RaidList.toggleList(<?php echo $lid; ?>);">
<div class="listTitleText">
<a href="build.php?gid=16&t=99&action=deleteList&lid=<?php echo $lid; ?>"><img class="del" src="img/x.gif" alt="delete" title="delete"></a>
<?php echo $lvname; ?> - <?php echo $lname; ?>
<img alt="Loading..." class="loading hide" src="img/x.gif" align="absmiddle">
</div>
<div class="openedClosedSwitch switchClosed">Details</div>
<div class="clear"></div>
</div>
<div class="listContent hide">
</div>
</div>
<?php } }?>
<?php } ?>
<div class="options">
<a class="arrow" href="build.php?gid=16&t=99&action=addList">Create a new list</a>
</div>
<?php
}
$getUnit = $database->getUnit($village->wid);
if($session->tribe==1){
$unit1 = $getUnit['u1'];$unit2 = $getUnit['u2'];$unit3 = $getUnit['u3'];$unit4 = $getUnit['u4'];$unit5 = $getUnit['u5'];
$unit6 = $getUnit['u6'];$unit7 = $getUnit['u7'];$unit8 = $getUnit['u8'];$unit9 = $getUnit['u9'];$unit10 = $getUnit['u10'];
}elseif($session->tribe==2){
$unit1 = $getUnit['u11'];$unit2 = $getUnit['u12'];$unit3 = $getUnit['u13'];$unit4 = $getUnit['u14'];$unit5 = $getUnit['u15'];
$unit6 = $getUnit['u16'];$unit7 = $getUnit['u17'];$unit8 = $getUnit['u18'];$unit9 = $getUnit['u19'];$unit10 = $getUnit['u20'];
}elseif($session->tribe==3){
$unit1 = $getUnit['u21'];$unit2 = $getUnit['u22'];$unit3 = $getUnit['u23'];$unit4 = $getUnit['u24'];$unit5 = $getUnit['u25'];
$unit6 = $getUnit['u26'];$unit7 = $getUnit['u27'];$unit8 = $getUnit['u28'];$unit9 = $getUnit['u29'];$unit10 = $getUnit['u30'];
}
?>
<?php
if(!$database->getVilFarmlist($village->wid)){
?>
<script type="text/javascript">
window.addEvent('domready', function()
{
Travian.Game.RaidList.setData([]);
});
</script>
<?php }else{ ?>
<script type="text/javascript">
window.addEvent('domready', function()
{
Travian.Game.RaidList.setData({
<?php
$result = mysqli_query($database->dblink,'SELECT id FROM '.TB_PREFIX.'farmlist WHERE wref = '.(int) $village->wid.'');
$query1 = mysqli_num_rows($result);
$NUM1 = 1;
while($row = mysqli_fetch_array($result)){
$lid = $row['id'];
?>
"<?php echo $lid; ?>":{
"troops":{"1":<?php echo $unit1; ?>,"2":<?php echo $unit2; ?>,"3":<?php echo $unit3; ?>,"4":<?php echo $unit4; ?>,"5":<?php echo $unit5; ?>,"6":<?php echo $unit6; ?>,"7":<?php echo $unit7; ?>,"8":<?php echo $unit8; ?>,"9":<?php echo $unit9; ?>,"10":<?php echo $unit10; ?>,"11":<?php echo $getUnit['hero']; ?>},
"directions":{"village":"none","ew":"none","distance":"asc","troops":"none","lastRaid":"none"},
"slots":{<?php
$result3 = mysqli_query($database->dblink,'SELECT * FROM '.TB_PREFIX.'raidlist WHERE lid = '.(int) $lid.'');
$query2 = mysqli_num_rows($result3);
$NUM2 = 1;
while($row3 = mysqli_fetch_array($result3)){
$id = $row3['id'];
$t1 = $row3['t1'];$t2 = $row3['t2'];$t3 = $row3['t3'];$t4 = $row3['t4'];$t5 = $row3['t5'];$t6 = $row3['t6'];$t7 = $row3['t7'];
$t8 = $row3['t8'];$t9 = $row3['t9'];$t10 = $row3['t10'];
echo '
"'.$id.'":{"troops":{"1":'.$t1.',"2":'.$t2.',"3":'.$t3.',"4":'.$t4.',"5":'.$t5.',"6":'.$t6.',"7":'.$t7.',"8":'.$t8.',"9":'.$t9.',"10":'.$t10.',"11":0}}';
if($NUM2 != $query2){
echo ',';
}
$NUM2++;
}
echo '
}
}';
if($NUM1 != $query1){
echo ',
';
}
$NUM1++;
}
?>
});
(new Fx.Scroll(window,{
duration: 100
})).toElement('list<?php echo $lid2; ?>');
});
</script>
<?php } ?>
<?php
if($create == 1){
$hideevasion = 1;
include("Templates/goldClub/farmlist_add.tpl");
+1 -1
View File
@@ -19,7 +19,7 @@
<select id="did" name="did">
<?php
for($i = 1; $i <= count($session->villages); $i++){
if($session->villages[$i-1] == $village->wid) $select = 'selected="selected"';
if($session->villages[$i - 1] == $village->wid) $select = 'selected="selected"';
else $select = '';
echo "<option value=\"".$session->villages[$i-1]."\" ".$select.">".$database->getVillageField($session->villages[$i-1],'name')."</option>";
+31 -41
View File
@@ -1,8 +1,16 @@
<?php
if(isset($_POST['action']) == 'addSlot' && $_POST['lid']) {
$troops = 0;
for($i = 1; $i <= 10; $i++) $troops += $_POST['t'.$i];
//If the player has no farm lists, return
if(!$database->getVilFarmlist($session->uid)){
header("Location: build.php?id=39&t=99");
exit;
}
if(isset($_POST['action']) && $_POST['action'] == 'addSlot' && isset($_POST['lid']) && $database->getFLData($_POST['lid'])['owner'] == $session->uid) {
$troops = 0;
for($i = 1; $i <= 6; $i++){
if(!in_array($i + ($session->tribe - 1) * 10, [4, 14, 23])) $troops += $_POST['t'.$i];
}
if(!empty($_POST['target_id'])){
$Wref = $_POST['target_id'];
@@ -40,23 +48,10 @@ if(isset($_POST['action']) == 'addSlot' && $_POST['lid']) {
$WrefY = $_POST['y'];
}
$coor = $database->getCoor($village->wid);
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);
}
$distance = getDistance($coor['x'], $coor['y'], $WrefX, $WrefY);
$database->addSlotFarm($_POST['lid'], $session->uid, $Wref, $WrefX, $WrefY, $distance, $_POST['t1'], $_POST['t2'], $_POST['t3'], $_POST['t4'], $_POST['t5'], $_POST['t6'], $_POST['t7'], $_POST['t8'], $_POST['t9'], $_POST['t10']);
$coor = $database->getCoor($village->wid);
$distance = $database->getDistance($coor['x'], $coor['y'], $WrefX, $WrefY);
$database->addSlotFarm($_POST['lid'], $Wref, $WrefX, $WrefY, $distance, $_POST['t1'], $_POST['t2'], $_POST['t3'], $_POST['t4'], $_POST['t5'], $_POST['t6']);
header("Location: build.php?id=39&t=99");
exit;
}
@@ -83,12 +78,8 @@ $sql = mysqli_query($database->dblink, "SELECT id, name, owner, wref FROM ".TB_P
while($row = mysqli_fetch_array($sql)){
$lid = $row["id"];
$lname = $row["name"];
$lowner = $row["owner"];
$lwref = $row["wref"];
$lvname = $database->getVillageField($row["wref"], 'name');
if($_GET['lid'] == $lid) $selected = 'selected=""';
else $selected = '';
echo '<option value="'.$lid.'" '.$selected.'>'.$lvname.' - '.$lname.'</option>';
echo '<option value="'.$lid.'">'.$lvname.' - '.$lname.'</option>';
}
?>
</select>
@@ -115,22 +106,21 @@ $sql = mysqli_query($database->dblink, "SELECT id, name, owner, wref FROM ".TB_P
<label class="lastTargets">Last targets:</label>
<select name="target_id">
<?php
$getwref = "SELECT towref FROM ".TB_PREFIX."raidlist WHERE lid = ".$database->escape((int) $_GET['lid'])."";
$getwref = "SELECT movement.to, movement.ref, attacks.* FROM ".TB_PREFIX."movement as movement INNER JOIN ".TB_PREFIX."attacks as attacks ON attacks.id = movement.ref WHERE attacks.attack_type = 4 AND movement.proc = 1 AND movement.from = ".$village->wid;
$arraywref = $database->query_return($getwref);
echo '<option value="">Select village</option>';
if(mysqli_num_rows(mysqli_query($database->dblink,$getwref)) != 0){
foreach($arraywref as $row){
$towref = $row["towref"];
$tocoor = $database->getCoor($towref);
$totype = $database->getVillageType2($towref);
if($totype == 0) $tovname = $database->getVillageField($towref, 'name');
else $tovname = $database->getOasisField($towref, 'name');
if($vill[$towref] == 0){
echo '<option value="'.$towref.'">'.$tovname.' ('.$tocoor['x'].'|'.$tocoor['y'].')</option>';
}
$vill[$towref] = 1;
}
if(mysqli_num_rows(mysqli_query($database->dblink, $getwref)) != 0){
foreach($arraywref as $row){
$towref = $row["to"];
$vilInfo = $database->getVillageByWorldID($towref);
if($vilInfo['fieldtype'] > 0 && !$vilInfo['occupied']) continue;
$tocoor = $database->getCoor($towref);
if($vilInfo['oasistype'] == 0) $tovname = $database->getVillageField($towref, 'name');
else $tovname = $database->getOasisField($towref, 'name');
if($vill[$towref] == 0) echo '<option value="'.$towref.'">'.$tovname.' ('.$tocoor['x'].'|'.$tocoor['y'].')</option>';
$vill[$towref] = 1;
}
}
?>
</select>
@@ -141,7 +131,7 @@ if(mysqli_num_rows(mysqli_query($database->dblink,$getwref)) != 0){
</tbody></table>
</div>
</div>
<?php include("Templates/goldClub/trooplist2.tpl"); ?>
<?php include("Templates/goldClub/trooplist.tpl"); ?>
<br />
<button type="submit" value="save" name="save" id="save" class="trav_buttons">Create</button>
</form>
+30 -45
View File
@@ -3,8 +3,14 @@ if(isset($_GET['action']) == 'editSlot' && $_GET['eid']) {
$eiddata = $database->getRaidList($_GET['eid']);
$x = $eiddata['x'];
$y = $eiddata['y'];
for($i = 1; $i <= 10; $i++) ${'t'.$i} = $eiddata['t'.$i];
for($i = 1; $i <= 6; $i++) ${'t'.$i} = $eiddata['t'.$i];
$FLData = $database->getFLData($eiddata['lid']);
//Check if we're editing one of ours raidlists
if($FLData['owner'] != $session->uid){
header("Location: build.php?id=39&t=99");
exit;
}
}
if(isset($_POST['action']) == 'editSlot' && isset($_GET['eid']) && !empty($_GET['eid']) && isset($_POST['lid']) && !empty($_POST['lid'])) {
@@ -26,7 +32,9 @@ if(isset($_POST['action']) == 'editSlot' && isset($_GET['eid']) && !empty($_GET[
}
$troops = 0;
for($i = 1; $i <= 10; $i++) $troops += $_POST['t'.$i];
for($i = 1; $i <= 6; $i++){
if(!in_array($i + ($session->tribe - 1) * 10, [4, 14, 23])) $troops += $_POST['t'.$i];
}
if(empty($_POST['x']) && empty($_POST['y']) && empty($_POST['target_id'])) $errormsg = "Enter coordinates.";
elseif((empty($_POST['x']) || empty($_POST['y'])) && empty($_POST['target_id'])) $errormsg = "Enter the correct coordinates.";
@@ -36,7 +44,6 @@ if(isset($_POST['action']) == 'editSlot' && isset($_GET['eid']) && !empty($_GET[
elseif($_POST['target_id'] == $village->wid || $vdata['wref'] == $village->wid) $errormsg = "You can't attack the same village you send troops from.";
else
{
if(!empty($_POST['target_id'])){
$Wref = $_POST['target_id'];
$WrefCoor = $database->getCoor($Wref);
@@ -47,28 +54,15 @@ if(isset($_POST['action']) == 'editSlot' && isset($_GET['eid']) && !empty($_GET[
$WrefX = $_POST['x'];
$WrefY = $_POST['y'];
}
$coor = $database->getCoor($village->wid);
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);
}
$distance = getDistance($coor['x'], $coor['y'], $WrefX, $WrefY);
$database->editSlotFarm($_GET['eid'], $_POST['lid'], $database->getRaidList($_GET['eid'])['lid'], $session->uid, $Wref, $WrefX, $WrefY, $distance, $_POST['t1'], $_POST['t2'], $_POST['t3'], $_POST['t4'], $_POST['t5'], $_POST['t6'], $_POST['t7'], $_POST['t8'], $_POST['t9'], $_POST['t10']);
$coor = $database->getCoor($village->wid);
$distance = $database->getDistance($coor['x'], $coor['y'], $WrefX, $WrefY);
$database->editSlotFarm($_GET['eid'], $_POST['lid'], $database->getRaidList($_GET['eid'])['lid'], $session->uid, $Wref, $WrefX, $WrefY, $distance, $_POST['t1'], $_POST['t2'], $_POST['t3'], $_POST['t4'], $_POST['t5'], $_POST['t6']);
header("Location: build.php?id=39&t=99");
exit;
}
}
if($FLData['owner'] == $session->uid){
?>
<div id="raidListSlot">
@@ -95,8 +89,6 @@ $sql = mysqli_query($database->dblink,"SELECT id, name, owner, wref FROM ".TB_PR
while($row = mysqli_fetch_array($sql)){
$lid = $row["id"];
$lname = $row["name"];
$lowner = $row["owner"];
$lwref = $row["wref"];
$lvname = $database->getVillageField($row["wref"], 'name');
if($lid == $lid2) $selected = 'selected=""';
@@ -127,26 +119,25 @@ $lvname = $database->getVillageField($row["wref"], 'name');
<label class="lastTargets">Last targets:</label>
<select name="target_id">
<?php
$getwref = "SELECT id, towref FROM ".TB_PREFIX."raidlist WHERE lid = ".(int) $lid2;
$getwref = "SELECT movement.to, movement.ref, attacks.* FROM ".TB_PREFIX."movement as movement INNER JOIN ".TB_PREFIX."attacks as attacks ON attacks.id = movement.ref WHERE attacks.attack_type = 4 AND movement.proc = 1 AND movement.from = ".$village->wid;
$arraywref = $database->query_return($getwref);
echo '<option value="">Select village</option>';
echo '<option value="">Select village</option>';
if(mysqli_num_rows(mysqli_query($database->dblink, $getwref)) != 0){
foreach($arraywref as $row){
$towref = $row["towref"];
$tocoor = $database->getCoor($towref);
$totype = $database->getVillageType2($towref);
if($totype == 0) $tovname = $database->getVillageField($towref, 'name');
else $tovname = $database->getOasisField($towref, 'name');
if($row["id"] == $_GET['eid']) $selected = 'selected=""';
else $selected = '';
if($vill[$towref] == 0){
echo '<option value="'.$towref.'" '.$selected.'>'.$tovname.' ('.$tocoor['x'].'|'.$tocoor['y'].')</option>';
}
$vill[$towref] = 1;
}
foreach($arraywref as $row){
$towref = $row["to"];
$vilInfo = $database->getVillageByWorldID($towref);
if($vilInfo['fieldtype'] > 0 && !$vilInfo['occupied']) continue;
$tocoor = $database->getCoor($towref);
if($vilInfo['oasistype'] == 0) $tovname = $database->getVillageField($towref, 'name');
else $tovname = $database->getOasisField($towref, 'name');
if($row["id"] == $_GET['eid']) $selected = 'selected=""';
else $selected = '';
if($vill[$towref] == 0) echo '<option value="'.$towref.'">'.$tovname.' ('.$tocoor['x'].'|'.$tocoor['y'].')</option>';
$vill[$towref] = 1;
}
}
?>
</select>
</div>
@@ -162,10 +153,4 @@ if(mysqli_num_rows(mysqli_query($database->dblink, $getwref)) != 0){
<button type="submit" value="save" name="save" id="save" class="trav_buttons">Save</button>&nbsp;
<button type="button" value="delete" name="delete" id="delete" class="trav_buttons" onclick="window.location.href = '?gid=16&t=99&action=deleteSlot&eid=<?php echo $_GET["eid"]; ?>&lid=<?php echo $eiddata['lid']; ?>';">Delete</button>
</form>
</div>
<?php
}else{
header("Location: build.php?id=39&t=99");
exit;
}
?>
</div>
+29 -140
View File
@@ -1,141 +1,30 @@
<?php
if($session->tribe == 1){
<?php
$start = ($session->tribe - 1) * 10 + 1;
$end = $start + 5;
?>
<div class="troops">
<div class="troopGroup">
<label for="t1"><img class="unit u1" title="<?php echo U1; ?>" src="img/x.gif"></label>
<input class="text troop" id="t1" type="text" name="t1" value="<?php if($t1!=0){ echo $t1; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t2"><img class="unit u2" title="<?php echo U2; ?>" src="img/x.gif"></label>
<input class="text troop" id="t2" type="text" name="t2" value="<?php if($t2!=0){ echo $t2; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t3"><img class="unit u3" title="<?php echo U3; ?>" src="img/x.gif"></label>
<input class="text troop" id="t3" type="text" name="t3" value="<?php if($t3!=0){ echo $t3; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t4"><img class="unit u4" title="<?php echo U4; ?>" src="img/x.gif"></label>
<input class="text troop" id="t4" type="text" value="<?php if($t4!=0){ echo $t4; }else{ echo 0; } ?>" disabled="disabled">
</div>
<div class="troopGroup">
<label for="t5"><img class="unit u5" title="<?php echo U5; ?>" src="img/x.gif"></label>
<input class="text troop" id="t5" type="text" name="t5" value="<?php if($t5!=0){ echo $t5; }else{ echo 0; } ?>">
</div>
<div class="clear"></div>
<div class="troopGroup">
<label for="t6"><img class="unit u6" title="<?php echo U6; ?>" src="img/x.gif"></label>
<input class="text troop" id="t6" type="text" name="t6" value="<?php if($t6!=0){ echo $t6; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t7"><img class="unit u7" title="<?php echo U7; ?>" src="img/x.gif"></label>
<input class="text troop" id="t7" type="text" name="t7" value="<?php if($t7!=0){ echo $t7; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t8"><img class="unit u8" title="<?php echo U8; ?>" src="img/x.gif"></label>
<input class="text troop" id="t8" type="text" name="t8" value="<?php if($t8!=0){ echo $t8; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t9"><img class="unit u9" title="<?php echo U9; ?>" src="img/x.gif"></label>
<input class="text troop" id="t9" type="text" name="t9" value="<?php if($t9!=0){ echo $t9; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t10"><img class="unit u10" title="<?php echo U10; ?>" src="img/x.gif"></label>
<input class="text troop" id="t10" type="text" name="t10" value="<?php if($t10!=0){ echo $t10; }else{ echo 0; } ?>">
</div>
<div class="clear"></div>
</div>
<?php }elseif($session->tribe == 2){ ?>
<div class="troops">
<div class="troopGroup">
<label for="t1"><img class="unit u11" title="<?php echo U11; ?>" src="img/x.gif"></label>
<input class="text troop" id="t1" type="text" name="t1" value="<?php if($t1!=0){ echo $t1; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t2"><img class="unit u12" title="<?php echo U12; ?>" src="img/x.gif"></label>
<input class="text troop" id="t2" type="text" name="t2" value="<?php if($t2!=0){ echo $t2; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t3"><img class="unit u13" title="<?php echo U13; ?>" src="img/x.gif"></label>
<input class="text troop" id="t3" type="text" name="t3" value="<?php if($t3!=0){ echo $t3; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t4"><img class="unit u14" title="<?php echo U14; ?>" src="img/x.gif"></label>
<input class="text troop" id="t4" type="text" value="<?php if($t4!=0){ echo $t4; }else{ echo 0; } ?>" disabled="disabled">
</div>
<div class="troopGroup">
<label for="t5"><img class="unit u15" title="<?php echo U15; ?>" src="img/x.gif"></label>
<input class="text troop" id="t5" type="text" name="t5" value="<?php if($t5!=0){ echo $t5; }else{ echo 0; } ?>">
</div>
<div class="clear"></div>
<div class="troopGroup">
<label for="t6"><img class="unit u16" title="<?php echo U16; ?>" src="img/x.gif"></label>
<input class="text troop" id="t6" type="text" name="t6" value="<?php if($t6!=0){ echo $t6; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t7"><img class="unit u17" title="<?php echo U17; ?>" src="img/x.gif"></label>
<input class="text troop" id="t7" type="text" name="t7" value="<?php if($t7!=0){ echo $t7; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t8"><img class="unit u18" title="<?php echo U18; ?>" src="img/x.gif"></label>
<input class="text troop" id="t8" type="text" name="t8" value="<?php if($t8!=0){ echo $t8; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t9"><img class="unit u19" title="<?php echo U19; ?>" src="img/x.gif"></label>
<input class="text troop" id="t9" type="text" name="t9" value="<?php if($t9!=0){ echo $t9; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t10"><img class="unit u20" title="<?php echo U20; ?>" src="img/x.gif"></label>
<input class="text troop" id="t10" type="text" name="t10" value="<?php if($t10!=0){ echo $t10; }else{ echo 0; } ?>">
</div>
<div class="clear"></div>
</div>
<?php }elseif($session->tribe == 3){ ?>
<div class="troops">
<div class="troopGroup">
<label for="t1"><img class="unit u21" title="<?php echo U21; ?>" src="img/x.gif"></label>
<input class="text troop" id="t1" type="text" name="t1" value="<?php if($t1!=0){ echo $t1; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t2"><img class="unit u22" title="<?php echo U22; ?>" src="img/x.gif"></label>
<input class="text troop" id="t2" type="text" name="t2" value="<?php if($t2!=0){ echo $t2; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t3"><img class="unit u23" title="<?php echo U23; ?>" src="img/x.gif"></label>
<input class="text troop" id="t3" type="text" value="<?php if($t3!=0){ echo $t3; }else{ echo 0; } ?>" disabled="disabled">
</div>
<div class="troopGroup">
<label for="t4"><img class="unit u24" title="<?php echo U24; ?>" src="img/x.gif"></label>
<input class="text troop" id="t4" type="text" name="t4" value="<?php if($t4!=0){ echo $t4; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t5"><img class="unit u25" title="<?php echo U25; ?>" src="img/x.gif"></label>
<input class="text troop" id="t5" type="text" name="t5" value="<?php if($t5!=0){ echo $t5; }else{ echo 0; } ?>">
</div>
<div class="clear"></div>
<div class="troopGroup">
<label for="t6"><img class="unit u26" title="<?php echo U26; ?>" src="img/x.gif"></label>
<input class="text troop" id="t6" type="text" name="t6" value="<?php if($t6!=0){ echo $t6; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t7"><img class="unit u27" title="<?php echo U27; ?>" src="img/x.gif"></label>
<input class="text troop" id="t7" type="text" name="t7" value="<?php if($t7!=0){ echo $t7; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t8"><img class="unit u28" title="<?php echo U28; ?>" src="img/x.gif"></label>
<input class="text troop" id="t8" type="text" name="t8" value="<?php if($t8!=0){ echo $t8; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t9"><img class="unit u29" title="<?php echo U29; ?>" src="img/x.gif"></label>
<input class="text troop" id="t9" type="text" name="t9" value="<?php if($t9!=0){ echo $t9; }else{ echo 0; } ?>">
</div>
<div class="troopGroup">
<label for="t10"><img class="unit u30" title="<?php echo U30; ?>" src="img/x.gif"></label>
<input class="text troop" id="t10" type="text" name="t10" value="<?php if($t10!=0){ echo $t10; }else{ echo 0; } ?>">
</div>
<div class="clear"></div>
</div>
<?php } ?>
<table class="transparent" id="raidList" cellspacing="1" cellpadding="1">
<tr>
<?php
for($i = $start; $i <= $end; $i++){
if(in_array($i, [4, 14, 23])) continue;
?>
<td>
<label for="t<?php echo $i - $start + 1; ?>"><img class="unit u<?php echo $i; ?>" title="<?php echo $technology->getUnitName($i) ?>" src="img/x.gif"></label>
</td>
<?php
}
?>
</tr>
<tr>
<?php
for($i = $start; $i <= $end; $i++){
if(in_array($i, [4, 14, 23])) continue;
?>
<td>
<input class="text" id="t<?php echo $i - $start + 1; ?>" type="text" name="t<?php echo $i - $start + 1; ?>" value="<?php echo (${'t'.($i - $start + 1)} > 0) ? ${'t'.($i - $start + 1)} : 0; ?>">
</td>
<?php
}
?>
</tr>
</table>
-141
View File
@@ -1,141 +0,0 @@
<?php
if($session->tribe == 1){
?>
<div class="troops">
<div class="troopGroup">
<label for="t1"><img class="unit u1" title="<?php echo U1; ?>" src="img/x.gif"></label>
<input class="text troop" id="t1" type="text" name="t1" value="0">
</div>
<div class="troopGroup">
<label for="t2"><img class="unit u2" title="<?php echo U2; ?>" src="img/x.gif"></label>
<input class="text troop" id="t2" type="text" name="t2" value="0">
</div>
<div class="troopGroup">
<label for="t3"><img class="unit u3" title="<?php echo U3; ?>" src="img/x.gif"></label>
<input class="text troop" id="t3" type="text" name="t3" value="0">
</div>
<div class="troopGroup">
<label for="t4"><img class="unit u4" title="<?php echo U4; ?>" src="img/x.gif"></label>
<input class="text troop" id="t4" type="text" value="0" disabled="disabled">
</div>
<div class="troopGroup">
<label for="t5"><img class="unit u5" title="<?php echo U5; ?>" src="img/x.gif"></label>
<input class="text troop" id="t5" type="text" name="t5" value="0">
</div>
<div class="clear"></div>
<div class="troopGroup">
<label for="t6"><img class="unit u6" title="<?php echo U6; ?>" src="img/x.gif"></label>
<input class="text troop" id="t6" type="text" name="t6" value="0">
</div>
<div class="troopGroup">
<label for="t7"><img class="unit u7" title="<?php echo U7; ?>" src="img/x.gif"></label>
<input class="text troop" id="t7" type="text" name="t7" value="0">
</div>
<div class="troopGroup">
<label for="t8"><img class="unit u8" title="<?php echo U8; ?>" src="img/x.gif"></label>
<input class="text troop" id="t8" type="text" name="t8" value="0">
</div>
<div class="troopGroup">
<label for="t9"><img class="unit u9" title="<?php echo U9; ?>" src="img/x.gif"></label>
<input class="text troop" id="t9" type="text" name="t9" value="0">
</div>
<div class="troopGroup">
<label for="t10"><img class="unit u10" title="<?php echo U10; ?>" src="img/x.gif"></label>
<input class="text troop" id="t10" type="text" name="t10" value="0">
</div>
<div class="clear"></div>
</div>
<?php }elseif($session->tribe == 2){ ?>
<div class="troops">
<div class="troopGroup">
<label for="t1"><img class="unit u11" title="<?php echo U11; ?>" src="img/x.gif"></label>
<input class="text troop" id="t1" type="text" name="t1" value="0">
</div>
<div class="troopGroup">
<label for="t2"><img class="unit u12" title="<?php echo U12; ?>" src="img/x.gif"></label>
<input class="text troop" id="t2" type="text" name="t2" value="0">
</div>
<div class="troopGroup">
<label for="t3"><img class="unit u13" title="<?php echo U13; ?>" src="img/x.gif"></label>
<input class="text troop" id="t3" type="text" name="t3" value="0">
</div>
<div class="troopGroup">
<label for="t4"><img class="unit u14" title="<?php echo U14; ?>" src="img/x.gif"></label>
<input class="text troop" id="t4" type="text" value="0" disabled="disabled">
</div>
<div class="troopGroup">
<label for="t5"><img class="unit u15" title="<?php echo U15; ?>" src="img/x.gif"></label>
<input class="text troop" id="t5" type="text" name="t5" value="0">
</div>
<div class="clear"></div>
<div class="troopGroup">
<label for="t6"><img class="unit u16" title="<?php echo U16; ?>" src="img/x.gif"></label>
<input class="text troop" id="t6" type="text" name="t6" value="0">
</div>
<div class="troopGroup">
<label for="t7"><img class="unit u17" title="<?php echo U17; ?>" src="img/x.gif"></label>
<input class="text troop" id="t7" type="text" name="t7" value="0">
</div>
<div class="troopGroup">
<label for="t8"><img class="unit u18" title="<?php echo U18; ?>" src="img/x.gif"></label>
<input class="text troop" id="t8" type="text" name="t8" value="0">
</div>
<div class="troopGroup">
<label for="t9"><img class="unit u19" title="<?php echo U19; ?>" src="img/x.gif"></label>
<input class="text troop" id="t9" type="text" name="t9" value="0">
</div>
<div class="troopGroup">
<label for="t10"><img class="unit u20" title="<?php echo U20; ?>" src="img/x.gif"></label>
<input class="text troop" id="t10" type="text" name="t10" value="0">
</div>
<div class="clear"></div>
</div>
<?php }elseif($session->tribe == 3){ ?>
<div class="troops">
<div class="troopGroup">
<label for="t1"><img class="unit u21" title="<?php echo U21; ?>" src="img/x.gif"></label>
<input class="text troop" id="t1" type="text" name="t1" value="0">
</div>
<div class="troopGroup">
<label for="t2"><img class="unit u22" title="<?php echo U22; ?>" src="img/x.gif"></label>
<input class="text troop" id="t2" type="text" name="t2" value="0">
</div>
<div class="troopGroup">
<label for="t3"><img class="unit u23" title="<?php echo U23; ?>" src="img/x.gif"></label>
<input class="text troop" id="t3" type="text" value="0" disabled="disabled">
</div>
<div class="troopGroup">
<label for="t4"><img class="unit u24" title="<?php echo U24; ?>" src="img/x.gif"></label>
<input class="text troop" id="t4" type="text" name="t4" value="0">
</div>
<div class="troopGroup">
<label for="t5"><img class="unit u25" title="<?php echo U25; ?>" src="img/x.gif"></label>
<input class="text troop" id="t5" type="text" name="t5" value="0">
</div>
<div class="clear"></div>
<div class="troopGroup">
<label for="t6"><img class="unit u26" title="<?php echo U26; ?>" src="img/x.gif"></label>
<input class="text troop" id="t6" type="text" name="t6" value="0">
</div>
<div class="troopGroup">
<label for="t7"><img class="unit u27" title="<?php echo U27; ?>" src="img/x.gif"></label>
<input class="text troop" id="t7" type="text" name="t7" value="0">
</div>
<div class="troopGroup">
<label for="t8"><img class="unit u28" title="<?php echo U28; ?>" src="img/x.gif"></label>
<input class="text troop" id="t8" type="text" name="t8" value="0">
</div>
<div class="troopGroup">
<label for="t9"><img class="unit u29" title="<?php echo U29; ?>" src="img/x.gif"></label>
<input class="text troop" id="t9" type="text" name="t9" value="0">
</div>
<div class="troopGroup">
<label for="t10"><img class="unit u30" title="<?php echo U30; ?>" src="img/x.gif"></label>
<input class="text troop" id="t10" type="text" name="t10" value="0">
</div>
<div class="clear"></div>
</div>
<?php } ?>
+42 -172
View File
@@ -92,17 +92,14 @@ $start_timer = $generator->pageLoadTimeStart();
?>
<div id="mid">
<?php
include ("Templates/menu.tpl");
if(is_numeric($_GET['x']) AND is_numeric($_GET['y'])) {
$coor2['x'] = preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['x']);
$coor2['y'] = preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['y']);
} else {
$wref2 = $village->wid;
$coor2 = $database->getCoor($wref2);
}
include ("Templates/menu.tpl");
if(is_numeric($_GET['x']) && is_numeric($_GET['y'])) {
$coor2['x'] = preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['x']);
$coor2['y'] = preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['y']);
} else {
$wref2 = $village->wid;
$coor2 = $database->getCoor($wref2);
}
?>
<div id="content" class="player">
@@ -117,9 +114,9 @@ $start_timer = $generator->pageLoadTimeStart();
<tr>
<td width="100">Search for:</td>
<td width="250">
<input type="radio" class="radio" name="type" value="15" <?php if($_GET['s'] == 1) { print 'checked="checked"'; } ?> /> 15 crop
<input type="radio" class="radio" name="type" value="9" <?php if($_GET['s'] == 2) { print 'checked="checked"'; } ?> /> 9 crop
<input type="radio" class="radio" name="type" value="both" <?php if($_GET['s'] == 3) { print 'checked="checked"'; } ?> /> both<br />
<input type="radio" class="radio" name="type" value="15" <?php if($_GET['s'] == 1) echo 'checked="checked"'; ?> /> 15 crop
<input type="radio" class="radio" name="type" value="9" <?php if($_GET['s'] == 2) echo 'checked="checked"'; ?> /> 9 crop
<input type="radio" class="radio" name="type" value="both" <?php if($_GET['s'] == 3) echo 'checked="checked"'; ?> /> both<br />
</td>
</tr>
<tr>
@@ -127,140 +124,24 @@ $start_timer = $generator->pageLoadTimeStart();
<td>x: <input type="text" name="x" value="<?php print $coor2['x']; ?>" size="3" /> y: <input type="text" name="y" value="<?php print $coor2['y']; ?>" size="3" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Search" /></td>
<td colspan="2"><button type="submit" class="trav_buttons" value="Search">Search</button></td>
</tr>
</table>
</form>
<?php
$fieldType = ($_GET['s'] == 1) ? "fieldtype = 6" : (($_GET['s'] == 2) ? "fieldtype = 1" : "fieldtype = 1 OR fieldtype = 6");
$type = mysqli_query($database->dblink,"SELECT id, x, y, occupied, fieldtype FROM ".TB_PREFIX."wdata WHERE $fieldType");
define('PREFIX', TB_PREFIX);
$type15 = mysqli_query($database->dblink,"SELECT id,x,y,occupied FROM ".PREFIX."wdata WHERE fieldtype = 6");
$type9 = mysqli_query($database->dblink,"SELECT id,x,y,occupied FROM ".PREFIX."wdata WHERE fieldtype = 1");
$type_both = mysqli_query($database->dblink,"SELECT id,x,y,occupied,fieldtype FROM ".PREFIX."wdata WHERE fieldtype = 1 OR fieldtype = 6");
if(is_numeric($_GET['x']) AND is_numeric($_GET['y'])) {
$coor['x'] = $_GET['x'];
$coor['y'] = $_GET['y'];
} else {
$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);
}
if($_GET['s'] == 1) {
?>
<table id="member">
<thead>
<tr>
<th colspan='5'>Crop Finder - 15c</th>
</tr>
<tr>
<td>Type</td>
<td>Coordinates</td>
<td>Owner</td>
<td>Occupied</td>
<td>Distance</td>
</tr>
</thead><tbody>
<?php
while($row = mysqli_fetch_array($type15)) {
$dist = getDistance($coor['x'], $coor['y'], $row['x'], $row['y']);
$rows[$dist] = $row;
}
ksort($rows);
foreach($rows as $dist => $row) {
echo "<tr>";
echo "<td>15c</td>";
if($row['occupied'] == 0) {
echo "<td><a href=\"karte.php?d=".$row['id']."&c=".$generator->getMapCheck($row['id'])."\">".$database->getVillageField($row['id'], "name")." (".$row['x']."|".$row['y'].")</td>";
echo "<td>-</td>";
echo "<td><b><font color=\"green\">Unoccupied</b></font></td>";
} else {
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>";
echo "<td><a href=\"spieler.php?uid=".$database->getVillageField($row['id'], "owner")."\">".$database->getUserField($database->getVillageField($row['id'], "owner"), "username", 0)."</a></td>";
echo "<td><b><font color=\"red\">Occupied</b></font></td>";
}
echo "<td><div style=\"text-align: center\">".getDistance($coor['x'], $coor['y'], $row['x'], $row['y'])."</div></td>";
}
?>
</tbody></table>
<?php
}
else if($_GET['s'] == 2) {
?>
<table id="member">
<thead>
<tr>
<th colspan='5'>Crop Finder - 9c</th>
</tr>
<tr>
<td>Type</td>
<td>Coordinates</td>
<td>Owner</td>
<td>Occupied</td>
<td>Distance</td>
</tr>
</thead><tbody>
<?php
unset($rows);
while($row = mysqli_fetch_array($type9)) {
$dist = getDistance($coor['x'], $coor['y'], $row['x'], $row['y']);
$rows[$dist] = $row;
}
ksort($rows);
foreach($rows as $dist => $row) {
echo "<tr>";
echo "<td>9c</td>";
if($row['occupied'] == 0) {
echo "<td><a href=\"karte.php?d=".$row['id']."&c=".$generator->getMapCheck($row['id'])."\">".$database->getVillageField($row['id'], "name")." (".$row['x']."|".$row['y'].")</td>";
echo "<td>-</td>";
echo "<td><b><font color=\"green\">Unoccupied</b></font></td>";
} else {
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>";
echo "<td><a href=\"spieler.php?uid=".$database->getVillageField($row['id'], "owner")."\">".$database->getUserField($database->getVillageField($row['id'], "owner"), "username", 0)."</a></td>";
echo "<td><b><font color=\"red\">Occupied</b></font></td>";
}
echo "<td><div style=\"text-align: center\">".getDistance($coor['x'], $coor['y'], $row['x'], $row['y'])."</div></td>";
}
?>
</tbody></table>
<?php
}
else if($_GET['s'] == 3) {
if(is_numeric($_GET['x']) && is_numeric($_GET['y'])) {
$coor['x'] = $_GET['x'];
$coor['y'] = $_GET['y'];
} else {
$wref = $village->wid;
$coor = $database->getCoor($wref);
}
if($_GET['s'] >= 1 && $_GET['s'] <= 3) {
?>
<table id="member">
<thead>
@@ -277,37 +158,26 @@ $start_timer = $generator->pageLoadTimeStart();
</thead><tbody>
<?php
unset($rows);
while($row = mysqli_fetch_array($type_both)) {
$dist = getDistance($coor['x'], $coor['y'], $row['x'], $row['y']);
$rows[$dist] = $row;
}
ksort($rows);
foreach($rows as $dist => $row) {
if($row['fieldtype'] == 1) {
$field = '9c';
} elseif($row['fieldtype'] == 6) {
$field = '15c';
}
echo "<tr>";
echo "<td>" . $field . "</td>";
if($row['occupied'] == 0) {
echo "<td><a href=\"karte.php?d=".$row['id']."&c=".$generator->getMapCheck($row['id'])."\">".$database->getVillageField($row['id'], "name")." (".$row['x']."|".$row['y'].")</td>";
echo "<td>-</td>";
echo "<td><b><font color=\"green\">Unoccupied</b></font></td>";
} else {
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>";
echo "<td><a href=\"spieler.php?uid=".$database->getVillageField($row['id'], "owner")."\">".$database->getUserField($database->getVillageField($row['id'], "owner"), "username", 0)."</a></td>";
echo "<td><b><font color=\"red\">Occupied</b></font></td>";
}
echo "<td><div style=\"text-align: center\">".getDistance($coor['x'], $coor['y'], $row['x'], $row['y'])."</div></td>";
}
while($row = mysqli_fetch_array($type)) {
$dist = $database->getDistance($coor['x'], $coor['y'], $row['x'], $row['y']);
$rows[$dist] = $row;
}
ksort($rows);
foreach($rows as $row) {
$field = $row['fieldtype'] == 1 ? '9c' : '15c';
echo "<tr><td>" . $field . "</td>";
if($row['occupied'] == 0) {
echo "<td><a href=\"karte.php?d=".$row['id']."&c=".$generator->getMapCheck($row['id'])."\">".ABANDVALLEY." (".$row['x']."|".$row['y'].")</td>";
echo "<td>-</td>";
echo "<td><b><font color=\"green\">".UNOCCUPIED."</b></font></td>";
} else {
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>";
echo "<td><a href=\"spieler.php?uid=".$database->getVillageField($row['id'], "owner")."\">".$database->getUserField($database->getVillageField($row['id'], "owner"), "username", 0)."</a></td>";
echo "<td><b><font color=\"red\">".OCCUPIED."</b></font></td>";
}
echo "<td><div style=\"text-align: center\">".$database->getDistance($coor['x'], $coor['y'], $row['x'], $row['y'])."</div></td>";
}
?>
</tbody></table>
+1 -1
View File
@@ -40,7 +40,7 @@ else $building->procBuild($_GET);
<script src="mt-full.js?0faab" type="text/javascript"></script>
<script src="unx.js?f4b7h" type="text/javascript"></script>
<script src="new.js?0faab" type="text/javascript"></script>
<link href="<?php echo GP_LOCATE; ?>lang/en/compact.css?f4b7i" rel="stylesheet" type="text/css" />
<link href="<?php echo GP_LOCATE; ?>lang/en/compact.css?f4b7j" rel="stylesheet" type="text/css" />
<link href="<?php echo GP_LOCATE; ?>lang/en/lang.css?e21d2" rel="stylesheet" type="text/css" />
<?php
if($session->gpack == null || GP_ENABLE == false) {
@@ -6400,6 +6400,9 @@ div#build.gid16 table#raidList thead a {
color: black;
font-weight: normal;
}
div#build.gid16 table#raidList input.text{
width: 75px;
}
div.map table#raidFavs thead a {
color: black;
font-weight: normal;
+3
View File
@@ -1,3 +1,6 @@
-- 16.05.2018 -> dropped four columns
ALTER TABLE `s1_raidlist` DROP `t7`, DROP `t8`, DROP `t9`, DROP `t10`;
-- 23.04.2018 -> new table
CREATE TABLE IF NOT EXISTS `s1_artefacts_chrono` (
`id` int(11) NOT NULL AUTO_INCREMENT,
-4
View File
@@ -1257,10 +1257,6 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%raidlist` (
`t4` int(11) NULL,
`t5` int(11) NULL,
`t6` int(11) NULL,
`t7` int(11) NULL,
`t8` int(11) NULL,
`t9` int(11) NULL,
`t10` int(11) NULL,
PRIMARY KEY (`id`),
KEY `lid-distance` (`lid`, `distance`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;