diff --git a/Templates/goldClub/farmlist.tpl b/Templates/goldClub/farmlist.tpl index 0010f1fb..3f29c95f 100644 --- a/Templates/goldClub/farmlist.tpl +++ b/Templates/goldClub/farmlist.tpl @@ -2,13 +2,15 @@ if(isset($_GET['t'])==99 && isset($_GET['action'])==0) { -if(isset($_GET['t'])==99 && isset($_POST['action'])=='addList'){ +if(isset($_GET['t'])==99 && isset($_POST['action'])=='addList' && $_POST['did']!="" && $_POST['name']!=""){ $database->createFarmList($_POST['did'], $session->uid, $_POST['name']); +}else if(isset($_GET['t'])==99 && isset($_POST['action'])=='addList'){ + header("Location: build.php?gid=16&t=99&action=addList"); } $sql = mysql_query("SELECT * FROM ".TB_PREFIX."farmlist WHERE owner = $session->uid ORDER BY wref = $village->wid DESC"); $query = mysql_num_rows($sql); -while($row = mysql_fetch_array($sql)){ +while($row = mysql_fetch_array($sql)){ $lid = $row["id"]; $lname = $row["name"]; $lowner = $row["owner"]; @@ -68,9 +70,12 @@ $vdata = $database->getVillage($towref); ?> - + - + + + + getVillage($towref); Oasis - ) + ( | - ( + ) @@ -109,7 +114,7 @@ $vdata = $database->getVillage($towref); - + -"; }; ?> @@ -187,9 +192,9 @@ $vdata = $database->getVillage($towref); 0){ while($row2 = mysql_fetch_array($getnotice)){ $dataarray = explode(",",$row2['data']); $type2 = $row2['ntype']; @@ -211,11 +216,12 @@ while($row2 = mysql_fetch_array($getnotice)){ $date = $generator->procMtime($row2['time']); echo "".$date[0]." ".date('H:i',$row2['time'])." "; } +} ?>
- edit + edit
- + + + + +
-Add Raid +Add Raid
@@ -253,7 +263,7 @@ for($i=$start;$i<=$end;$i++){ - +
@@ -349,222 +359,10 @@ $NUM1++; -getVilWref($_POST['y'], $_POST['x']); - $type = $database->getVillageType2($Wref); - $oasistype = $type['oasistype']; - $vdata = $database->getVillage($Wref); - } - if(!$_POST['x'] && !$_POST['y']){ - $errormsg .= "Enter coordinates."; - }elseif(!$_POST['x'] || !$_POST['y']){ - $errormsg .= "Enter the correct coordinates."; - }elseif($oasistype == 0 && $vdata == 0){ - $errormsg .= "In this village there are no coordinates."; - }elseif($troops == 0){ - $errormsg .= "No troops has been selected."; - }else{ - - $Wref = $database->getVilWref($_POST['y'], $_POST['x']); - $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'], $_POST['y'], $_POST['x']); - - $database->addSlotFarm($_POST['lid'], $Wref, $_POST['x'], $_POST['y'], $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"); -} -} -?> - - 1){ ?> -
-

Add Raid

- - - - -
-
- - - - - - - - - - - - - - -
From List - -
Coordinates: - -
-
- - -
-
- - -
-
-
-
- - -
-
-
-
-
- - - - - -
-
- \ No newline at end of file +}else if($create == 2){ +include("Templates/goldClub/farmlist_addraid.tpl"); +}else if($create == 3){ +include("Templates/goldClub/farmlist_editraid.tpl"); +} \ No newline at end of file diff --git a/Templates/goldClub/farmlist_addraid.tpl b/Templates/goldClub/farmlist_addraid.tpl index 67f2d961..28515ea4 100644 --- a/Templates/goldClub/farmlist_addraid.tpl +++ b/Templates/goldClub/farmlist_addraid.tpl @@ -1,18 +1,29 @@ getFLData($_GET['lid']); +if($FLData['owner'] == $session->uid){ if(isset($_POST['action']) == 'addSlot' && $_POST['lid']) { $troops = "".$_POST['t1']."+".$_POST['t2']."+".$_POST['t3']."+".$_POST['t4']."+".$_POST['t5']."+".$_POST['t6']."+".$_POST['t7']."+".$_POST['t8']."+".$_POST['t9']."+".$_POST['t10'].""; - if($_POST['x'] && $_POST['y']){ - $Wref = $database->getVilWref($_POST['y'], $_POST['x']); - $type = $database->getVillageType2($Wref); - $oasistype = $type['oasistype']; - $vdata = $database->getVillage($Wref); - } - if(!$_POST['x'] && !$_POST['y']){ +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']){ +$Wref = $database->getVilWref($_POST['x'], $_POST['y']); +$WrefX = $_POST['x']; +$WrefY = $_POST['y']; +$type = $database->getVillageType2($Wref); +$oasistype = $type['oasistype']; +$vdata = $database->getVillage($Wref); +} + if(!$_POST['x'] && !$_POST['y'] && $_POST['target_id'] == ""){ $errormsg .= "Enter coordinates."; - }elseif(!$_POST['x'] || !$_POST['y']){ + }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."; @@ -20,7 +31,16 @@ $troops = "".$_POST['t1']."+".$_POST['t2']."+".$_POST['t3']."+".$_POST['t4']."+" $errormsg .= "No troops has been selected."; }else{ - $Wref = $database->getVilWref($_POST['y'], $_POST['x']); + if($_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) { @@ -35,119 +55,32 @@ $troops = "".$_POST['t1']."+".$_POST['t2']."+".$_POST['t3']."+".$_POST['t4']."+" return round($dist, 1); } - $distance = getDistance($coor['x'], $coor['y'], $_POST['y'], $_POST['x']); + $distance = getDistance($coor['x'], $coor['y'], $WrefX, $WrefY); - $database->addSlotFarm($_POST['lid'], $Wref, $_POST['x'], $_POST['y'], $distance, $_POST['t1'], $_POST['t2'], $_POST['t3'], $_POST['t4'], $_POST['t5'], $_POST['t6'], $_POST['t7'], $_POST['t8'], $_POST['t9'], $_POST['t10']); + $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"); } } ?> - -

Add Slot

-
+
- @@ -199,4 +153,9 @@ $lvname = $database->getVillageField($row["wref"], 'name'); - \ No newline at end of file + + \ No newline at end of file diff --git a/Templates/goldClub/farmlist_editraid.tpl b/Templates/goldClub/farmlist_editraid.tpl index 071615dc..baf96f79 100644 --- a/Templates/goldClub/farmlist_editraid.tpl +++ b/Templates/goldClub/farmlist_editraid.tpl @@ -4,30 +4,50 @@ $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']); } if(isset($_POST['action']) == 'editSlot' && $_POST['eid']) { - -$Wref = $database->getVilWref($_POST['y'], $_POST['x']); +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']){ +$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(!$_POST['x'] && !$_POST['y']){ + if(!$_POST['x'] && !$_POST['y'] && $_POST['target_id'] == ""){ $errormsg .= "Enter coordinates."; - }elseif(!$_POST['x'] || !$_POST['y']){ + }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{ - - $Wref = $database->getVilWref($_POST['y'], $_POST['x']); + + if($_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); @@ -39,103 +59,17 @@ $troops = "".$_POST['t1']."+".$_POST['t2']."+".$_POST['t3']."+".$_POST['t4']."+" $dist = sqrt(pow($distanceX, 2) + pow($distanceY, 2)); return round($dist, 1); } - $distance = getDistance($coor['x'], $coor['y'], $_POST['y'], $_POST['x']); + $distance = getDistance($coor['x'], $coor['y'], $WrefX, $WrefY); - $database->editSlotFarm($_GET['eid'], $_POST['lid'], $Wref, $_POST['x'], $_POST['y'], $distance, $_POST['t1'], $_POST['t2'], $_POST['t3'], $_POST['t4'], $_POST['t5'], $_POST['t6'], $_POST['t7'], $_POST['t8'], $_POST['t9'], $_POST['t10']); + $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']); header("Location: build.php?id=39&t=99"); } } - +if($FLData['owner'] == $session->uid){ ?> - -

Add Slot

@@ -190,9 +124,31 @@ $lvname = $database->getVillageField($row["wref"], 'name');
- - +query_return($getwref); + echo ''; +if(mysql_num_rows(mysql_query($getwref)) != 0){ +foreach($arraywref as $row){ +$towref = $row["towref"]; +$tocoor = $database->getCoor($towref); +$totype = $database->getVillageType2($towref); +$tooasistype = $totype['oasistype']; +if($tooasistype == 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 ''; +} +$vill[$towref] = 1; +} +} +?>
@@ -205,15 +161,11 @@ $lvname = $database->getVillageField($row["wref"], 'name');   - + - \ No newline at end of file + + \ No newline at end of file diff --git a/build.php b/build.php index add7b357..3c50364f 100644 --- a/build.php +++ b/build.php @@ -165,19 +165,24 @@ if($routeaccess = 1){ } if($session->goldclub == 1 && $session->access != BANNED){ if(isset($_GET['t'])==99) { - + if($_GET['action'] == 'addList') { $create = 1; - }else{ - $create = 0; + }else if($_GET['action'] == 'addraid') { + $create = 2; + }else if($_GET['action'] == 'showSlot' && $_GET['eid']) { + $create = 3; + }else{ + $create = 0; + } + + if($_GET['slid']) { + $FLData = $database->getFLData($_GET['slid']); + if($FLData['owner'] == $session->uid){ + $checked[$_GET['slid']] = 1; } - - if($_GET['action'] == 'addraid') { - include("Templates/goldClub/farmlist_addraid.tpl"); - } - }elseif($_GET['action'] == 'showSlot' && $_GET['eid']) { - include("Templates/goldClub/farmlist_editraid.tpl"); } + if($_GET['action'] == 'deleteList') { $database->delFarmList($_GET['lid'], $session->uid); header("Location: build.php?id=39&t=99"); @@ -185,6 +190,7 @@ if($session->goldclub == 1 && $session->access != BANNED){ $database->delSlotFarm($_GET['eid']); header("Location: build.php?id=39&t=99"); } + } }else{ $create = 0; if($session->access == BANNED){ diff --git a/startRaid.php b/startRaid.php index d2d932ac..e61d7711 100644 --- a/startRaid.php +++ b/startRaid.php @@ -43,16 +43,17 @@ if($session->access != BANNED){ $getFLData = $database->getFLData($lid); $unitslist = $database->getFLData($lid); $sql = mysql_query("SELECT * FROM ".TB_PREFIX."raidlist WHERE lid = ".$lid.""); - $sql1 = mysql_query("SELECT * FROM ".TB_PREFIX."units WHERE vref = ".$getFLData['wref']); + $sql1 = mysql_fetch_array(mysql_query("SELECT * FROM ".TB_PREFIX."units WHERE vref = ".$getFLData['wref'])); while($row = mysql_fetch_array($sql)){ $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']; $t11 = 0; - if($tribe == 1){ $u = ""; } elseif($tribe == 2){ $u = "1"; } elseif($tribe == 3){ $u = "2"; }elseif($tribe == 4){ $u = "3"; }else {$u = "4"; } - if($sql[$u.'1']>=$t1 && $sql[$u.'2']>=$t2 && $sql[$u.'3']>=$t3 && $sql[$u.'4']>=$t4 && $sql[$u.'5']>=$t5 && $sql[$u.'6']>=$t6 && $sql[$u.'7']>=$t7 && $sql[$u.'8']>=$t8 && $sql[$u.'9']>=$t9 && $sql[$u.'10']>=$t10 && $sql['hero']>=$t11){ - if($slots[$sid]=='on'){ + if($tribe == 1){ $u = "u"; } elseif($tribe == 2){ $u = "u1"; } elseif($tribe == 3){ $u = "u2"; }elseif($tribe == 4){ $u = "u3"; }else {$u = "u4"; } + if($tribe == 1){ $u1 = "u1"; } elseif($tribe == 2){ $u1 = "u2"; } elseif($tribe == 3){ $u1 = "u3"; }elseif($tribe == 4){ $u1 = "u4"; }else {$u1 = "u5"; } + if($tribe == 1){ $u2 = ""; } elseif($tribe == 2){ $u2 = "1"; } elseif($tribe == 3){ $u2 = "2"; }elseif($tribe == 4){ $u2 = "3"; }else {$u2 = "4"; } + if($sql1[$u.'1']>=$t1 && $sql1[$u.'2']>=$t2 && $sql1[$u.'3']>=$t3 && $sql1[$u.'4']>=$t4 && $sql1[$u.'5']>=$t5 && $sql1[$u.'6']>=$t6 && $sql1[$u.'7']>=$t7 && $sql1[$u.'8']>=$t8 && $sql1[$u.'9']>=$t9 && $sql1[$u1.'0']>=$t10 && $sql1['hero']>=$t11){ if($slots[$sid]=='on'){ $ckey = $generator->generateRandStr(6); $id = $database->addA2b($ckey,time(),$wref,$t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$t10,$t11,4); @@ -99,19 +100,19 @@ if($session->access != BANNED){ $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']); $totalunits = $data['u1']+$data['u2']+$data['u3']+$data['u4']+$data['u5']+$data['u6']+$data['u7']+$data['u8']+$data['u9']+$data['u10']+$data['u11']; - $database->modifyUnit($getFLData['wref'], array($u.'1'), array($data['u1']), array(0)); - $database->modifyUnit($getFLData['wref'], array($u.'2'), array($data['u2']), array(0)); - $database->modifyUnit($getFLData['wref'], array($u.'3'), array($data['u3']), array(0)); - $database->modifyUnit($getFLData['wref'], array($u.'4'), array($data['u4']), array(0)); - $database->modifyUnit($getFLData['wref'], array($u.'5'), array($data['u5']), array(0)); - $database->modifyUnit($getFLData['wref'], array($u.'6'), array($data['u6']), array(0)); - $database->modifyUnit($getFLData['wref'], array($u.'7'), array($data['u7']), array(0)); - $database->modifyUnit($getFLData['wref'], array($u.'8'), array($data['u8']), array(0)); - $database->modifyUnit($getFLData['wref'], array($u.'9'), array($data['u9']), array(0)); - $database->modifyUnit($getFLData['wref'], array($u.'10'), array($data['u10']), array(0)); + $database->modifyUnit($getFLData['wref'], array($u2.'1'), array($data['u1']), array(0)); + $database->modifyUnit($getFLData['wref'], array($u2.'2'), array($data['u2']), array(0)); + $database->modifyUnit($getFLData['wref'], array($u2.'3'), array($data['u3']), array(0)); + $database->modifyUnit($getFLData['wref'], array($u2.'4'), array($data['u4']), array(0)); + $database->modifyUnit($getFLData['wref'], array($u2.'5'), array($data['u5']), array(0)); + $database->modifyUnit($getFLData['wref'], array($u2.'6'), array($data['u6']), array(0)); + $database->modifyUnit($getFLData['wref'], array($u2.'7'), array($data['u7']), array(0)); + $database->modifyUnit($getFLData['wref'], array($u2.'8'), array($data['u8']), array(0)); + $database->modifyUnit($getFLData['wref'], array($u2.'9'), array($data['u9']), array(0)); + $database->modifyUnit($getFLData['wref'], array($u2.'10'), array($data['u10']), array(0)); $database->modifyUnit($getFLData['wref'], array('hero'), array($data['u11']), array(0)); - $database->addMovement(3,$getFLData['wref'],$data['to_vid'],$reference,0,($time+time())); + $database->addMovement(3,$getFLData['wref'],$data['to_vid'],$reference,time(),($time+time())); } } }
Farm Name: - uid ORDER BY name ASC"); @@ -182,10 +115,31 @@ $lvname = $database->getVillageField($row["wref"], 'name');
- - + +