mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-14 07:11:02 +00:00
General fixes
+Fixed a bug in the farm list that permitted to attack the same village troops were sent +Fixed a bug that permitted to delete others raid lists +Fixed a bug that permitted to view broken reports +Fixed a bug that permitted to insert 0 troops in the raid list +Fixed the broken graphic of the raid/farm list +Fixed a bug that didn't permit to send more than 2 raids at a time (in the raid list) +General improovements and bug fixing +Some clean-up
This commit is contained in:
@@ -8,14 +8,8 @@
|
||||
<h1><?php echo RALLYPOINT;?> <span class="level"><?php echo LEVEL;?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
|
||||
<p class="build_desc"><?php echo RALLYPOINT_DESC;?></p>
|
||||
|
||||
<div id="textmenu">
|
||||
<a href="build.php?id=<?php echo $id; ?>"><?php echo OVERVIEW;?></a> |
|
||||
<a href="a2b.php"><?php echo SEND_TROOPS;?></a> |
|
||||
<a href="warsim.php"><?php echo Q20_RESP1;?></a> <?php if($session->goldclub==1){ ?>|
|
||||
<a href="build.php?id=<?php echo $id; ?>&t=99">Gold Club</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
include_once("16_menu.tpl");
|
||||
$units_type = $database->getMovement("34",$village->wid,1);
|
||||
$settlers = $database->getMovement("7",$village->wid,1);
|
||||
$oasis_incoming = 0;
|
||||
|
||||
+23
-41
@@ -1,78 +1,60 @@
|
||||
<?php
|
||||
if(!$session->goldclub) {
|
||||
include "Templates/Build/16.tpl";
|
||||
}else{
|
||||
if(!$session->goldclub) include("Templates/Build/16.tpl");
|
||||
else
|
||||
{
|
||||
?>
|
||||
<div id="build" class="gid16"><a href="#" onClick="return Popup(16,4);" class="build_logo">
|
||||
<img class="g16" src="img/x.gif" alt="Rally point" title="<?php echo RALLYPOINT;?>" />
|
||||
</a>
|
||||
<h1><?php echo RALLYPOINT;?> <span class="level"><?php echo LEVEL;?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
|
||||
<p class="build_desc"><?php echo RALLYPOINT_DESC;?></p>
|
||||
<?php include("16_menu.tpl")?>
|
||||
|
||||
<div id="textmenu">
|
||||
<a href="build.php?id=<?php echo $id; ?>"><?php echo OVERVIEW;?></a> |
|
||||
<a href="a2b.php"><?php echo SEND_TROOPS;?></a> |
|
||||
<a href="warsim.php"><?php echo Q20_RESP1;?></a> <?php if($session->goldclub==1){ ?>|
|
||||
<a href="build.php?id=<?php echo $id; ?>&t=99">Gold Club</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div id="raidList">
|
||||
<?php include "Templates/goldClub/farmlist.tpl"; ?>
|
||||
</div>
|
||||
<div id="raidList">
|
||||
<?php include("Templates/goldClub/farmlist.tpl"); ?>
|
||||
</div>
|
||||
<br />
|
||||
<?php if($hideevasion == 0){ ?>
|
||||
<table cellpadding="1" cellspacing="1">
|
||||
<table id="raidList" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="4"><?php echo EVASION_SETTINGS;?></th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
<td><?php echo MULTI_V_HEADER; ?></td>
|
||||
|
||||
<td><?php echo VILLAGE; ?></td>
|
||||
<td><?php echo OWN_TROOPS; ?></td>
|
||||
|
||||
<td><?php echo REINFORCEMENT;?></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for($i=0;$i<=count($session->villages)-1;$i++) {
|
||||
$wref = $session->villages[$i];
|
||||
$vname = $database->getVillageField($wref,"name");
|
||||
$vchecked = $database->getVillageField($wref,"evasion");
|
||||
$reinf = $database->getEnforceVillage($wref,0);
|
||||
if($vchecked == 1){ $checked = 'checked'; }else{ $checked = ''; }
|
||||
for($i = 0; $i <= count($session->villages) - 1; $i++) {
|
||||
$wref = $session->villages[$i];
|
||||
$vname = $database->getVillageField($wref, "name");
|
||||
$vchecked = $database->getVillageField($wref, "evasion");
|
||||
$reinf = $database->getEnforceVillage($wref, 0);
|
||||
|
||||
if($vchecked == 1) $checked = 'checked';
|
||||
else $checked = '';
|
||||
?>
|
||||
<tr>
|
||||
<td><input type="checkbox" class="check" name="hideShow" onclick="window.location.href = '?gid=16&t=99&evasion=<?php echo $wref;?>';" <?php echo $checked; ?>></td>
|
||||
|
||||
<td><?php echo $vname; ?></td>
|
||||
|
||||
<td><?php echo $database->getUnitsNumber($wref); ?></td>
|
||||
|
||||
<td><?php echo count($reinf); ?></td>
|
||||
<td><div style="text-align: center"><?php echo $database->getUnitsNumber($wref); ?></div></td>
|
||||
<td><div style="text-align: center"><?php echo count($reinf); ?></div></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
$user = $database->getUserArray($session->uid, 1);
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
<form action="build.php?id=39&t=99" method="POST">
|
||||
<br />
|
||||
<tr>
|
||||
<?php echo SEND_TROOPS_AWAY_MAX;?> <input class="text" type="text" name="maxevasion" value="<?php echo $user['maxevasion']; ?>" maxlength="3" style="width:50px;"> <?php echo TIMES;?>
|
||||
<span class="none">(<?php echo COSTS;?>: <img src="<?php echo GP_LOCATE; ?>img/a/gold_g.gif" alt="Gold" title="<?php echo GOLD;?>"/><b>2</b> <?php echo PER_EVASION;?>)</span>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<div class="clear"></div><p><input type="image" value="ok" name="s1" id="btn_ok" class="dynamic_img" src="img/x.gif" tabindex="8" alt="OK"/></p></form>
|
||||
</tr>
|
||||
</form>
|
||||
<?php echo SEND_TROOPS_AWAY_MAX;?> <input class="text" type="text" name="maxevasion" value="<?php echo $user['maxevasion']; ?>" maxlength="3" style="width:50px;"> <?php echo TIMES;?>
|
||||
<span class="none">(<?php echo COSTS;?>: <img src="<?php echo GP_LOCATE; ?>img/a/gold_g.gif" alt="Gold" title="<?php echo GOLD;?>"/><b>2</b> <?php echo PER_EVASION;?>)</span>
|
||||
<div class="clear"></div><p><button value="ok" name="s1" id="btn_ok" class="trav_buttons" tabindex="8">OK</button></p></form>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
@@ -0,0 +1,8 @@
|
||||
<div id="textmenu">
|
||||
<a href="build.php?id=<?php echo $id; ?>" <?php if(!isset($_GET['t']) || (isset($_GET['t']) && $_GET['t'] == 99 && !$session->goldclub)) echo "class=\"selected\""; ?> ><?php echo OVERVIEW;?></a> |
|
||||
<a href="a2b.php"><?php echo SEND_TROOPS;?></a> |
|
||||
<a href="warsim.php"><?php echo Q20_RESP1;?></a>
|
||||
<?php if($session->goldclub == 1){ ?>|
|
||||
<a href="build.php?id=<?php echo $id; ?>&t=99" <?php if(isset($_GET['t']) && $_GET['t'] == 99) echo "class=\"selected\""; ?> >Gold Club</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
<div id="textmenu">
|
||||
<a href="build.php?id=<?php echo $id; ?>" <?php if(!isset($_GET['s'])) { echo "class=\"selected\""; } ?>><?php echo TRAIN; ?></a>
|
||||
| <a href="build.php?id=<?php echo $id; ?>&s=2" <?php if(isset($_GET['s']) && $_GET['s'] == 2) { echo "class=\"selected\""; } ?>><?php echo CULTURE_POINTS; ?></a>
|
||||
| <a href="build.php?id=<?php echo $id; ?>&s=3" <?php if(isset($_GET['s']) && $_GET['s'] == 3) { echo "class=\"selected\""; } ?>><?php echo LOYALTY; ?></a>
|
||||
| <a href="build.php?id=<?php echo $id; ?>&s=4" <?php if(isset($_GET['s']) && $_GET['s'] == 4) { echo "class=\"selected\""; } ?>><?php echo EXPANSION; ?></a>
|
||||
<a href="build.php?id=<?php echo $id; ?>" <?php if(!isset($_GET['s']))echo "class=\"selected\""; ?>><?php echo TRAIN; ?></a>
|
||||
| <a href="build.php?id=<?php echo $id; ?>&s=2" <?php if(isset($_GET['s']) && $_GET['s'] == 2) echo "class=\"selected\""; ?>><?php echo CULTURE_POINTS; ?></a>
|
||||
| <a href="build.php?id=<?php echo $id; ?>&s=3" <?php if(isset($_GET['s']) && $_GET['s'] == 3) echo "class=\"selected\""; ?>><?php echo LOYALTY; ?></a>
|
||||
| <a href="build.php?id=<?php echo $id; ?>&s=4" <?php if(isset($_GET['s']) && $_GET['s'] == 4) echo "class=\"selected\""; ?>><?php echo EXPANSION; ?></a>
|
||||
</div>
|
||||
@@ -10,8 +10,7 @@
|
||||
$sql1 = mysqli_fetch_array(mysqli_query($database->dblink,"SELECT * FROM ".TB_PREFIX."units WHERE vref = ".(int) $getFLData['wref']));
|
||||
$sid = $row['id'];
|
||||
$wref = $row['towref'];
|
||||
$t1 = $row['t1'];$t2 = $row['t2'];$t3 = $row['t3'];$t4 = $row['t4'];$t5 = $row['t5'];
|
||||
$t6 = $row['t6'];$t7 = $row['t7'];$t8 = $row['t8'];$t9 = $row['t9'];$t10 = $row['t10'];
|
||||
for($i = 1; $i <= 10; $i++) ${'t'.$i} = $row['t'.$i];
|
||||
$t11 = 0;
|
||||
$villageOwner = $database->getVillageField($wref,'owner');
|
||||
$userAccess = $database->getUserField($villageOwner,'access',0);
|
||||
@@ -60,7 +59,7 @@
|
||||
$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 = $units->getWalkingTroopsTime($getFLData['wref'], $data['to_vid'], $session->uid, $session->tribe, $data, 1, 'u');
|
||||
$time = $database->getArtifactsValueInfluence($getFLData['owner'], $getFLData['wref'], 2, $troopsTime);
|
||||
|
||||
@@ -69,7 +68,7 @@
|
||||
$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'] );
|
||||
$totalunits = $data['u1'] + $data['u2'] + $data['u3'] + $data['u4'] + $data['u5'] + $data['u6'] + $data['u7'] + $data['u8'] + $data['u9'] + $data['u10'] + $data['u11'];
|
||||
|
||||
$units = [];
|
||||
$troops = [];
|
||||
$amounts = [];
|
||||
$modes = [];
|
||||
|
||||
@@ -80,16 +79,16 @@
|
||||
$unitKey = $uname2 . ($u < 10 ? $u : 0);
|
||||
}
|
||||
|
||||
$units[] = $unitKey;
|
||||
$troops[] = $unitKey;
|
||||
$amounts[] = $data[ 'u' . $u];
|
||||
$modes[] = 0;
|
||||
}
|
||||
|
||||
$units[] = 'hero';
|
||||
$troops[] = 'hero';
|
||||
$amounts[] = $data['u11'];
|
||||
$modes[] = 0;
|
||||
|
||||
$database->modifyUnit($getFLData['wref'], $units, $amounts, $modes);
|
||||
$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
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
if(isset($_GET['t'])==99 && isset($_GET['action'])==0) {
|
||||
if(isset($_GET['t']) == 99 && isset($_GET['action']) == 0) {
|
||||
|
||||
if(isset($_GET['t'])==99 && isset($_POST['action'])=='addList' && $_POST['did']!="" && $_POST['name']!=""){
|
||||
if(isset($_GET['t']) == 99 && isset($_POST['action']) == 'addList' && !empty($_POST['did']) && !empty($_POST['name'])){
|
||||
$database->createFarmList($_POST['did'], $session->uid, $_POST['name']);
|
||||
}else if(isset($_GET['t'])==99 && isset($_POST['action'])=='addList'){
|
||||
}else if(isset($_GET['t']) == 99 && isset($_POST['action']) == 'addList'){
|
||||
header("Location: build.php?gid=16&t=99&action=addList");
|
||||
exit;
|
||||
}
|
||||
@@ -31,12 +31,12 @@ while($row = mysqli_fetch_array($sql)){
|
||||
<?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="openedClosedSwitch switchOpened"></div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="listContent ">
|
||||
<div class="detail">
|
||||
<table class="list" cellpadding="1" cellspacing="1">
|
||||
<div class="listContent ">
|
||||
<div class="detail">
|
||||
<table id="raidList" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="checkbox edit"></td>
|
||||
@@ -44,7 +44,7 @@ while($row = mysqli_fetch_array($sql)){
|
||||
<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');">LastRaid</td>
|
||||
<td class="lastRaid sortable" onclick="Travian.Game.RaidList.sort(<?php echo $lid; ?>, 'lastRaid');">Last raid</td>
|
||||
<td class="action"></td>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -54,7 +54,7 @@ while($row = mysqli_fetch_array($sql)){
|
||||
$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 == 0) {
|
||||
echo '<td class="noData" colspan="7">There is not any raid list.</td>';
|
||||
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'];
|
||||
@@ -240,11 +240,12 @@ while($row2 = mysqli_fetch_array($getnotice)){
|
||||
<label for="raidListMarkAll<?php echo $lid; ?>">Select All</label>
|
||||
</div>
|
||||
|
||||
<div class="addSlot">
|
||||
<a href="build.php?id=39&t=99&action=addraid&lid=<?php echo $lid; ?>">Add Raid</a>
|
||||
<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>
|
||||
|
||||
<div class="clear"></div><br /><br />
|
||||
<div class="troopSelection">
|
||||
<?php
|
||||
/*
|
||||
@@ -261,8 +262,7 @@ for($i=$start;$i<=$end;$i++){
|
||||
?>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<button type="submit" value="Start Raid"><div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">Start Raid</div></div></button> </div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
@@ -2,63 +2,62 @@
|
||||
$FLData = $database->getFLData($_GET['lid']);
|
||||
if($FLData['owner'] == $session->uid){
|
||||
if(isset($_POST['action']) == 'addSlot' && $_POST['lid']) {
|
||||
|
||||
$troops = 0;
|
||||
for($i = 1; $i <= 10; $i++) $troops += $_POST['t'.$i];
|
||||
|
||||
if(!empty($_POST['target_id'])){
|
||||
$Wref = $_POST['target_id'];
|
||||
$WrefCoor = $database->getCoor($Wref);
|
||||
$WrefX = $WrefCoor['x'];
|
||||
$WrefY = $WrefCoor['y'];
|
||||
$type = $database->getVillageType2($Wref);
|
||||
$oasistype = $type;
|
||||
$vdata = $database->getVillage($Wref);
|
||||
}elseif(!empty($_POST['x']) && !empty($_POST['y']) && is_numeric($_POST['x']) && is_numeric($_POST['y']) && $_POST['x'] <= WORLD_MAX && $_POST['y'] <= WORLD_MAX){
|
||||
$Wref = $database->getVilWref($_POST['x'], $_POST['y']);
|
||||
$WrefX = $_POST['x'];
|
||||
$WrefY = $_POST['y'];
|
||||
$type = $database->getVillageType2($Wref);
|
||||
$oasistype = $type;
|
||||
$vdata = $database->getVillage($Wref);
|
||||
}
|
||||
|
||||
$troops = "".$_POST['t1']."+".$_POST['t2']."+".$_POST['t3']."+".$_POST['t4']."+".$_POST['t5']."+".$_POST['t6']."+".$_POST['t7']."+".$_POST['t8']."+".$_POST['t9']."+".$_POST['t10']."";
|
||||
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.";
|
||||
elseif($oasistype == 0 && $vdata == 0) $errormsg = "There is no village on those coordinates.";
|
||||
elseif($troops == 0) $errormsg = "No troops has been selected.";
|
||||
elseif($database->hasBeginnerProtection($Wref) == 1) $errormsg = "Player under protection.";
|
||||
elseif($_POST['target_id'] == $village->wid || $vdata['wref'] == $village->wid) $errormsg = "You can't attack the same village you send troops from.";
|
||||
else
|
||||
{
|
||||
|
||||
if($_POST['target_id'] != ""){
|
||||
$Wref = $_POST['target_id'];
|
||||
$WrefCoor = $database->getCoor($Wref);
|
||||
$WrefX = $WrefCoor['x'];
|
||||
$WrefY = $WrefCoor['y'];
|
||||
$type = $database->getVillageType2($Wref);
|
||||
$oasistype = $type['oasistype'];
|
||||
$vdata = $database->getVillage($Wref);
|
||||
}elseif($_POST['x']!="" && $_POST['y']!="" && is_numeric($_POST['x']) && is_numeric($_POST['y']) && $_POST['x']<= WORLD_MAX && $_POST['y']<= WORLD_MAX){
|
||||
$Wref = $database->getVilWref($_POST['x'], $_POST['y']);
|
||||
$WrefX = $_POST['x'];
|
||||
$WrefY = $_POST['y'];
|
||||
$type = $database->getVillageType2($Wref);
|
||||
$oasistype = $type;
|
||||
$vdata = $database->getVillage($Wref);
|
||||
}
|
||||
if($_POST['x']=="" && $_POST['y']=="" && $_POST['target_id'] == ""){
|
||||
$errormsg .= "Enter coordinates.";
|
||||
}elseif(($_POST['x']=="" || $_POST['y']=="") && $_POST['target_id'] == ""){
|
||||
$errormsg .= "Enter the correct coordinates.";
|
||||
}elseif($oasistype == 0 && $vdata == 0){
|
||||
$errormsg .= "There is no village on those coordinates.";
|
||||
}elseif($troops == "0"){
|
||||
$errormsg .= "No troops has been selected.";
|
||||
}elseif($database->hasBeginnerProtection($Wref)==1){
|
||||
$errormsg .= "Player under protection.";
|
||||
}else{
|
||||
|
||||
if($_POST['target_id'] != ""){
|
||||
$Wref = $_POST['target_id'];
|
||||
$WrefCoor = $database->getCoor($Wref);
|
||||
$WrefX = $WrefCoor['x'];
|
||||
$WrefY = $WrefCoor['y'];
|
||||
if(!empty($_POST['target_id'])){
|
||||
$Wref = $_POST['target_id'];
|
||||
$WrefCoor = $database->getCoor($Wref);
|
||||
$WrefX = $WrefCoor['x'];
|
||||
$WrefY = $WrefCoor['y'];
|
||||
}else{
|
||||
$Wref = $database->getVilWref($_POST['x'], $_POST['y']);
|
||||
$WrefX = $_POST['x'];
|
||||
$WrefY = $_POST['y'];
|
||||
$Wref = $database->getVilWref($_POST['x'], $_POST['y']);
|
||||
$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);
|
||||
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'], $Wref, $WrefX, $WrefY, $distance, $_POST['t1'], $_POST['t2'], $_POST['t3'], $_POST['t4'], $_POST['t5'], $_POST['t6'], $_POST['t7'], $_POST['t8'], $_POST['t9'], $_POST['t10']);
|
||||
|
||||
header("Location: build.php?id=39&t=99");
|
||||
@@ -79,9 +78,9 @@ $vdata = $database->getVillage($Wref);
|
||||
<input type="hidden" name="action" value="addSlot">
|
||||
|
||||
|
||||
<table cellpadding="1" cellspacing="1" class="transparent">
|
||||
<table cellpadding="1" cellspacing="1" class="transparent" id="raidList">
|
||||
<tbody><tr>
|
||||
<th>Farm Name:</th>
|
||||
<th>List name:</th>
|
||||
<td>
|
||||
<select name="lid">
|
||||
<?php
|
||||
@@ -103,7 +102,7 @@ $lvname = $database->getVillageField($row["wref"], 'name');
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Select target:</th>
|
||||
<th>Target village:</th>
|
||||
<td class="target">
|
||||
|
||||
<div class="coordinatesInput">
|
||||
@@ -111,35 +110,35 @@ $lvname = $database->getVillageField($row["wref"], 'name');
|
||||
<label for="xCoordInput">X:</label>
|
||||
<input value="<?php echo $_POST['x']; ?>" name="x" id="xCoordInput" class="text coordinates x ">
|
||||
</div>
|
||||
<br />
|
||||
<div class="yCoord">
|
||||
<label for="yCoordInput">Y:</label>
|
||||
<input value="<?php echo $_POST['y']; ?>" name="y" id="yCoordInput" class="text coordinates y ">
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="targetSelect">
|
||||
<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'])."";
|
||||
$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);
|
||||
$tooasistype = $type['oasistype'];
|
||||
if($tooasistype == 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;
|
||||
}
|
||||
foreach($arraywref as $row){
|
||||
$towref = $row["towref"];
|
||||
$tocoor = $database->getCoor($towref);
|
||||
$totype = $database->getVillageType2($towref);
|
||||
$tooasistype = $type['oasistype'];
|
||||
if($tooasistype == 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>
|
||||
@@ -150,10 +149,9 @@ $vill[$towref] = 1;
|
||||
</tbody></table>
|
||||
</div>
|
||||
</div>
|
||||
<?php include "Templates/goldClub/trooplist2.tpl"; ?>
|
||||
|
||||
|
||||
<button type="submit" value="save" name="save" id="save"><div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">save</div></div></button>
|
||||
<?php include("Templates/goldClub/trooplist2.tpl"); ?>
|
||||
<br />
|
||||
<button type="submit" value="save" name="save" id="save" class="trav_buttons">Save</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -1,65 +1,67 @@
|
||||
<?php
|
||||
if(isset($_GET['action']) == 'editSlot' && $_GET['eid']) {
|
||||
$eiddata = $database->getRaidList($_GET['eid']);
|
||||
$x = $eiddata['x'];
|
||||
$y = $eiddata['y'];
|
||||
$t1 = $eiddata['t1'];$t2 = $eiddata['t2'];$t3 = $eiddata['t3'];$t4 = $eiddata['t4'];$t5 = $eiddata['t5'];$t6 = $eiddata['t6'];$t7 = $eiddata['t7'];$t8 = $eiddata['t8'];$t9 = $eiddata['t9'];$t10 = $eiddata['t10'];
|
||||
$FLData = $database->getFLData($eiddata['lid']);
|
||||
$eiddata = $database->getRaidList($_GET['eid']);
|
||||
$x = $eiddata['x'];
|
||||
$y = $eiddata['y'];
|
||||
for($i = 1; $i <= 10; $i++) ${'t'.$i} = $eiddata['t'.$i];
|
||||
$FLData = $database->getFLData($eiddata['lid']);
|
||||
}
|
||||
|
||||
if(isset($_POST['action']) == 'editSlot' && $_POST['eid']) {
|
||||
if($_POST['target_id'] != ""){
|
||||
$Wref = $_POST['target_id'];
|
||||
$WrefCoor = $database->getCoor($Wref);
|
||||
$WrefX = $WrefCoor['x'];
|
||||
$WrefY = $WrefCoor['y'];
|
||||
$type = $database->getVillageType2($Wref);
|
||||
$oasistype = $type['oasistype'];
|
||||
$vdata = $database->getVillage($Wref);
|
||||
}elseif($_POST['x']!="" && $_POST['y']!="" && is_numeric($_POST['x']) && is_numeric($_POST['y'])){
|
||||
$Wref = $database->getVilWref($_POST['x'], $_POST['y']);
|
||||
$WrefX = $_POST['x'];
|
||||
$WrefY = $_POST['y'];
|
||||
$type = $database->getVillageType2($Wref);
|
||||
$oasistype = $type['oasistype'];
|
||||
$vdata = $database->getVillage($Wref);
|
||||
}
|
||||
$troops = "".$_POST['t1']."+".$_POST['t2']."+".$_POST['t3']."+".$_POST['t4']."+".$_POST['t5']."+".$_POST['t6']."+".$_POST['t7']."+".$_POST['t8']."+".$_POST['t9']."+".$_POST['t10']."";
|
||||
if(!empty($_POST['target_id'])){
|
||||
$Wref = $_POST['target_id'];
|
||||
$WrefCoor = $database->getCoor($Wref);
|
||||
$WrefX = $WrefCoor['x'];
|
||||
$WrefY = $WrefCoor['y'];
|
||||
$type = $database->getVillageType2($Wref);
|
||||
$oasistype = $type;
|
||||
$vdata = $database->getVillage($Wref);
|
||||
}elseif(!empty($_POST['x']) && !empty($_POST['y']) && is_numeric($_POST['x']) && is_numeric($_POST['y'])){
|
||||
$Wref = $database->getVilWref($_POST['x'], $_POST['y']);
|
||||
$WrefX = $_POST['x'];
|
||||
$WrefY = $_POST['y'];
|
||||
$type = $database->getVillageType2($Wref);
|
||||
$oasistype = $type;
|
||||
$vdata = $database->getVillage($Wref);
|
||||
}
|
||||
|
||||
if($_POST['x']=="" && $_POST['y']=="" && $_POST['target_id'] == ""){
|
||||
$errormsg .= "Enter coordinates.";
|
||||
}elseif(($_POST['x']=="" || $_POST['y']=="") && $_POST['target_id'] == ""){
|
||||
$errormsg .= "Enter the correct coordinates.";
|
||||
}elseif($oasistype == 0 && $vdata == 0){
|
||||
$errormsg .= "There is no village on those coordinates.";
|
||||
}elseif($troops == "0"){
|
||||
$errormsg .= "No troops has been selected.";
|
||||
}else{
|
||||
$troops = 0;
|
||||
for($i = 1; $i <= 10; $i++) $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.";
|
||||
elseif($oasistype == 0 && $vdata == 0) $errormsg = "There is no village on those coordinates.";
|
||||
elseif($troops == 0) $errormsg = "No troops has been selected.";
|
||||
elseif($database->hasBeginnerProtection($Wref) == 1) $errormsg = "Player under protection.";
|
||||
elseif($_POST['target_id'] == $village->wid || $vdata['wref'] == $village->wid) $errormsg = "You can't attack the same village you send troops from.";
|
||||
else
|
||||
{
|
||||
|
||||
if($_POST['target_id'] != ""){
|
||||
$Wref = $_POST['target_id'];
|
||||
$WrefCoor = $database->getCoor($Wref);
|
||||
$WrefX = $WrefCoor['x'];
|
||||
$WrefY = $WrefCoor['y'];
|
||||
if(!empty($_POST['target_id'])){
|
||||
$Wref = $_POST['target_id'];
|
||||
$WrefCoor = $database->getCoor($Wref);
|
||||
$WrefX = $WrefCoor['x'];
|
||||
$WrefY = $WrefCoor['y'];
|
||||
}else{
|
||||
$Wref = $database->getVilWref($_POST['x'], $_POST['y']);
|
||||
$WrefX = $_POST['x'];
|
||||
$WrefY = $_POST['y'];
|
||||
$Wref = $database->getVilWref($_POST['x'], $_POST['y']);
|
||||
$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);
|
||||
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'], $Wref, $WrefX, $WrefY, $distance, $_POST['t1'], $_POST['t2'], $_POST['t3'], $_POST['t4'], $_POST['t5'], $_POST['t6'], $_POST['t7'], $_POST['t8'], $_POST['t9'], $_POST['t10']);
|
||||
|
||||
@@ -87,7 +89,7 @@ $lid2 = $getlid['lid'];
|
||||
<input type="hidden" name="eid" value="<?php echo $_GET['eid']; ?>">
|
||||
<input type="hidden" name="lid" value="<?php echo $lid2; ?>">
|
||||
|
||||
<table cellpadding="1" cellspacing="1" class="transparent">
|
||||
<table cellpadding="1" cellspacing="1" class="transparent" id="raidList">
|
||||
<tbody><tr>
|
||||
<th>Farm Name:</th><?php echo $_GET["lid"]; ?>
|
||||
<td>
|
||||
@@ -117,13 +119,14 @@ $lvname = $database->getVillageField($row["wref"], 'name');
|
||||
<label for="xCoordInput">X:</label>
|
||||
<input value="<?php echo $x; ?>" name="x" id="xCoordInput" class="text coordinates x ">
|
||||
</div>
|
||||
<br />
|
||||
<div class="yCoord">
|
||||
<label for="yCoordInput">Y:</label>
|
||||
<input value="<?php echo $y; ?>" name="y" id="yCoordInput" class="text coordinates y ">
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="targetSelect">
|
||||
<div class="targetSelect"><br />
|
||||
<label class="lastTargets">Last targets:</label>
|
||||
<select name="target_id">
|
||||
<?php
|
||||
@@ -159,9 +162,9 @@ $vill[$towref] = 1;
|
||||
</div>
|
||||
<?php include "Templates/goldClub/trooplist.tpl"; ?>
|
||||
|
||||
|
||||
<button type="submit" value="save" name="save" id="save"><div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">Save</div></div></button>
|
||||
<button type="button" value="delete" name="delete" id="delete" onclick="window.location.href = '?gid=16&t=99&action=deleteSlot&eid=<?php echo $_GET["eid"]; ?>';"><div class="button-container"><div class="button-position"><div class="btl"><div class="btr"><div class="btc"></div></div></div><div class="bml"><div class="bmr"><div class="bmc"></div></div></div><div class="bbl"><div class="bbr"><div class="bbc"></div></div></div></div><div class="button-contents">Delete</div></div></button>
|
||||
<br />
|
||||
<button type="submit" value="save" name="save" id="save" class="trav_buttons">Save</button>
|
||||
<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
|
||||
|
||||
Reference in New Issue
Block a user