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); } 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(!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']; } $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']); header("Location: build.php?id=39&t=99"); exit; } } ?>

Add Slot

List name:
Target village: