General fixes

+Fixed an exploit that permitted to starts other players' farm lists
+Fixed an exploit that permitted to save our raids to other players'
farm lists
+Fixed an exploit that permitted to edit other players' farm lists
+Fixed a rounding upkeep bug
+Moved the whole startRaid.tpl to a new method in Units.php
+A lot of clean-up
+Improoved indentation
+In the raid list, the "carry" image will now show to the left of an
attack
+Fixed a bug that displayed the wrong loot to returning troops released
by traps
+General minor bug fixing and improovements
-Deleted a lot of redundant code
This commit is contained in:
iopietro
2018-05-04 22:12:18 +02:00
parent 49bc3c5073
commit cf74514451
17 changed files with 762 additions and 1274 deletions
+258 -283
View File
@@ -1,364 +1,339 @@
<?php
include_once("GameEngine/Data/unitdata.php");
include_once ("GameEngine/Data/unitdata.php");
$units = $database->getMovement("34",$village->wid,1);
$units = $database->getMovement(34, $village->wid, 1);
$total_for = count($units);
$send = $database->getMovement("1",$village->wid,1);
$send = $database->getMovement(1, $village->wid, 1);
$total_for2 = count($send);
$artifactsSum = $database->getArtifactsSumByKind($session->uid, $village->wid, 3);
for($y=0;$y < $total_for;$y++){
for($i=0;$i < $total_for2;$i++){
if($units[$y]['ref'] == $send[$i]['ref2']){
$res1 = mysqli_query($database->dblink,"SELECT wood, clay, iron, crop FROM " . TB_PREFIX . "send where id = ".(int) $send[$i]['ref']."");
$res = mysqli_fetch_array($res1);
}
}
$session->timer++;
if ($units[$y]['sort_type']==3){
if ($units[$y]['attack_type']==3){
$actionType = ATTACK_ON;
} else if ($units[$y]['attack_type']==4){
$actionType = RAID_ON;
} else if ($units[$y]['attack_type']==2){
$actionType = REINFORCEMENTFOR;
for($y = 0; $y < $total_for; $y++){
for($i = 0; $i < $total_for2; $i++){
if($units[$y]['ref'] == $send[$i]['ref2']){
$res1 = mysqli_query($database->dblink, "SELECT wood, clay, iron, crop FROM ".TB_PREFIX."send where id = ".(int)$send[$i]['ref']."");
$res = mysqli_fetch_array($res1);
}
}
$reinfowner = $database->getVillageField($units[$y]['from'],"owner");
if($units[$y]['attack_type'] != 1){
if($units[$y]['from'] != 0){
if($units[$y]['t11'] > 0 && $reinfowner == $session->uid) {
$colspan = 11;
}else{
$colspan = 10;
}
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a href=\"karte.php?d=".$units[$y]['from']."&c=".$generator->getMapCheck($units[$y]['from'])."\">".$database->getVillageField($units[$y]['from'],"name")."</a></td>
$session->timer++;
if($units[$y]['sort_type'] == 3){
if($units[$y]['attack_type'] == 2) $actionType = REINFORCEMENTFOR;
elseif($units[$y]['attack_type'] == 3) $actionType = ATTACK_ON;
elseif($units[$y]['attack_type'] == 4) $actionType = RAID_ON;
$reinfowner = $database->getVillageField($units[$y]['from'], "owner");
if($units[$y]['attack_type'] != 1){
if($units[$y]['from'] != 0){
if($units[$y]['t11'] > 0 && $reinfowner == $session->uid) $colspan = 11;
else $colspan = 10;
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a href=\"karte.php?d=".$units[$y]['from']."&c=".$generator->getMapCheck($units[$y]['from'])."\">".$database->getVillageField($units[$y]['from'], "name")."</a></td>
<td colspan=\"$colspan\">";
echo "<a href=\"karte.php?d=".$units[$y]['to']."&c=".$generator->getMapCheck($units[$y]['to'])."\">".$actionType." ".$database->getVillageField($units[$y]['to'],"name")."</a>";
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = $database->getUserField($database->getVillageField($units[$y]['from'],"owner"),"tribe",0);
$start = ($tribe-1)*10+1;
$end = ($tribe*10);
echo "<tr><th>&nbsp;</th>";
for($i=$start;$i<=($end);$i++) {
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($units[$y]['t11'] != 0 && $reinfowner == $session->uid) {
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i=1;$i<=$colspan;$i++) {
$totalunits = $units[$y]['t1']+$units[$y]['t2']+$units[$y]['t3']+$units[$y]['t4']+$units[$y]['t5']+$units[$y]['t6']+$units[$y]['t7']+$units[$y]['t8']+$units[$y]['t9']+$units[$y]['t10']+$units[$y]['t11'];
if($units[$y]['attack_type'] == 2){
if($reinfowner != $session->uid){
echo "<td class=\"none\">?</td>";
}else{
if($units[$y]['t'.$i] == 0) {
echo "<td class=\"none\">0</td>";
}
else {
echo "<td>";
echo $units[$y]['t'.$i]."</td>";
echo "<a href=\"karte.php?d=".$units[$y]['to']."&c=".$generator->getMapCheck($units[$y]['to'])."\">".$actionType." ".$database->getVillageField($units[$y]['to'], "name")."</a>";
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = $database->getUserField($database->getVillageField($units[$y]['from'], "owner"), "tribe", 0);
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
}}else{
if($artifactsSum['totals'] == 0){
echo "<td class=\"none\">?</td>";
}else{
if($units[$y]['t'.$i] == 0) {
echo "<td class=\"none\">0</td>";
}else{
echo "<td>?</td>";
}
}
}
}
echo "</tr></tbody>";
echo '
if($units[$y]['t11'] != 0 && $reinfowner == $session->uid){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = 1; $i <= $colspan; $i++){
$totalunits = $units[$y]['t1'] + $units[$y]['t2'] + $units[$y]['t3'] + $units[$y]['t4'] + $units[$y]['t5'] + $units[$y]['t6'] + $units[$y]['t7'] + $units[$y]['t8'] + $units[$y]['t9'] + $units[$y]['t10'] + $units[$y]['t11'];
if($units[$y]['attack_type'] == 2){
if($reinfowner != $session->uid) echo "<td class=\"none\">?</td>";
else
{
if($units[$y]['t'.$i] == 0) echo "<td class=\"none\">0</td>";
else
{
echo "<td>";
echo $units[$y]['t'.$i]."</td>";
}
}
}else{
if($artifactsSum['totals'] == 0) echo "<td class=\"none\">?</td>";
else
{
if($units[$y]['t'.$i] == 0) echo "<td class=\"none\">0</td>";
else echo "<td>?</td>";
}
}
}
echo "</tr></tbody>";
echo '
<tbody class="infos">
<tr>
<th>'.ARRIVAL.'</th>
<td colspan='.$colspan.'>
<div class="in small"><span id=timer'.$session->timer.'>'.$generator->getTimeFormat($units[$y]['endtime']-time()).'</span> h</div>';
$datetime = $generator->procMtime($units[$y]['endtime']);
echo "<div class=\"at small\">";
if($datetime[0] != "today") {
echo "".ON." ".$datetime[0]." ";
}
echo "".AT." ".$datetime[1]." ".HRS."</div>
<div class="in small"><span id=timer'.$session->timer.'>'.$generator->getTimeFormat($units[$y]['endtime'] - time()).'</span> h</div>';
$datetime = $generator->procMtime($units[$y]['endtime']);
echo "<div class=\"at small\">";
if($datetime[0] != "today") echo "".ON." ".$datetime[0]." ";
echo "".AT." ".$datetime[1]." ".HRS."</div>
</div>
</td>
</tr>
</tbody>";
echo "</table>";
}else{
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
echo "</table>";
}else{
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a>village of the elders</a></td>
<td colspan=\"10\">";
echo "<a>".VILLAGE_OF_THE_ELDERS_TROOPS."</a>";
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = 4;
$start = ($tribe-1)*10+1;
$end = ($tribe*10);
echo "<tr><th>&nbsp;</th>";
for($i=$start;$i<=($end);$i++) {
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i=1;$i<=10;$i++) {
echo "<td class=\"none\">?</td>";
}
echo "</tr></tbody>";
echo '
echo "<a>".VILLAGE_OF_THE_ELDERS_TROOPS."</a>";
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = 4;
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = 1; $i <= 10; $i++){
echo "<td class=\"none\">?</td>";
}
echo "</tr></tbody>";
echo '
<tbody class="infos">
<tr>
<th>'.ARRIVAL.'</th>
<td colspan="10">
<div class="in small"><span id=timer'.$session->timer.'>'.$generator->getTimeFormat($units[$y]['endtime']-time()).'</span> h</div>';
$datetime = $generator->procMtime($units[$y]['endtime']);
echo "<div class=\"at small\">";
if($datetime[0] != "today") {
echo "".ON." ".$datetime[0]." ";
}
echo "".AT." ".$datetime[1]."</div>
<div class="in small"><span id=timer'.$session->timer.'>'.$generator->getTimeFormat($units[$y]['endtime'] - time()).'</span> h</div>';
$datetime = $generator->procMtime($units[$y]['endtime']);
echo "<div class=\"at small\">";
if($datetime[0] != "today") echo "".ON." ".$datetime[0]." ";
echo "".AT." ".$datetime[1]."</div>
</div>
</td>
</tr>
</tbody>";
echo "</table>";
echo "</table>";
}
}
}
}else if ($units[$y]['sort_type']==4){
if ($units[$y]['attack_type']==1){
}else if($units[$y]['sort_type'] == 4){
$actionType = RETURNFROM;
} else if ($units[$y]['attack_type']==2){
$actionType = RETURNFROM;
} else if ($units[$y]['attack_type']==3){
$actionType = RETURNFROM;
} else if ($units[$y]['attack_type']==4){
$actionType = RETURNFROM;
}
$isoasis = $database->isVillageOases($units[$y]['from']);
if ($isoasis ==0){
$from = $database->getMInfo($units[$y]['from']);
} else {
$from = $database->getOMInfo($units[$y]['from']);}
$to = $database->getMInfo($units[$y]['vref']);
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
$isoasis = $database->isVillageOases($units[$y]['from']);
if($isoasis == 0) $from = $database->getMInfo($units[$y]['from']);
else $from = $database->getOMInfo($units[$y]['from']);
$to = $database->getMInfo($units[$y]['vref']);
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead>
<tr>
<td class="role"><a href="karte.php?d=<?php echo $village->wid."&c=".$generator->getMapCheck($village->wid); ?>"><?php echo $village->vname; ?></a></td>
<td colspan="<?php echo $units[$y]['t11'] > 0 ? 11 : 10 ?>"><a href="karte.php?d=<?php echo $from['wref']."&c=".$generator->getMapCheck($from['wref']); ?>"><?php echo $actionType." ".$from['name']; ?></a></td>
<td class="role"><a
href="karte.php?d=<?php echo $village->wid."&c=".$generator->getMapCheck($village->wid); ?>"><?php echo $village->vname; ?></a></td>
<td colspan="<?php echo $units[$y]['t11'] > 0 ? 11 : 10 ?>"><a
href="karte.php?d=<?php echo $from['wref']."&c=".$generator->getMapCheck($from['wref']); ?>"><?php echo $actionType." ".$from['name']; ?></a></td>
</tr>
</thead>
<tbody class="units"><tr>
<tbody class="units">
<tr>
<?php
$tribe = $session->tribe;
$start = ($tribe-1)*10+1;
$end = ($tribe*10);
echo "<th>&nbsp;</th>";
for($i=$start;$i<=($end);$i++) {
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($units[$y]['t11'] != 0) {
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
?>
$tribe = $session->tribe;
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($units[$y]['t11'] != 0){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
?>
</tr>
<tr><th><?php echo TROOPS;?></th>
<tr>
<th><?php echo TROOPS;?></th>
<?php
for($i=1;$i<($units[$y]['t11'] != 0?12:11);$i++) {
if($units[$y]['t'.$i] == 0) {
echo "<td class=\"none\">0</td>";
}
else {
echo "<td>";
echo $units[$y]['t'.$i]."</td>";
}
for($i = 1; $i < ($units[$y]['t11'] != 0 ? 12 : 11); $i++){
if($units[$y]['t'.$i] == 0) echo "<td class=\"none\">0</td>";
else
{
echo "<td>";
echo $units[$y]['t'.$i]."</td>";
}
?>
</tr></tbody>
}
?>
</tr>
</tbody>
<?php
if (isset($res)) $totalres = $res['wood'] + $res['clay'] + $res['iron'] + $res['crop'];
else $totalres = 0;
if($units[$y]['attack_type'] != 2 && $units[$y]['attack_type'] != 1 && !empty($totalres)){?>
<tbody class="goods"><tr><th><?php echo BOUNTY;?></th>
if(isset($res)) $totalres = $res['wood'] + $res['clay'] + $res['iron'] + $res['crop'];
else $totalres = 0;
if($units[$y]['attack_type'] != 2 && $units[$y]['attack_type'] != 1 && !empty($totalres)){
?>
<tbody class="goods">
<tr>
<th><?php echo BOUNTY;?></th>
<td colspan="<?php echo $units[$y]['t11'] == 0 ? 10 : 11; ?>">
<?php
$totalcarry = $units[$y]['t1']*${'u'.$start.''}['cap']+$units[$y]['t2']*${'u'.($start+1).''}['cap']+$units[$y]['t3']*${'u'.($start+2).''}['cap']+$units[$y]['t4']*${'u'.($start+3).''}['cap']+$units[$y]['t5']*${'u'.($start+4).''}['cap']+$units[$y]['t6']*${'u'.($start+5).''}['cap']+$units[$y]['t7']*${'u'.($start+6).''}['cap']+$units[$y]['t8']*${'u'.($start+7).''}['cap']+$units[$y]['t9']*${'u'.($start+8).''}['cap']+$units[$y]['t10']*${'u'.($start+9).''}['cap'];
$totalcarry = 0;
for($i = 0; $i <= 9; $i++) $totalcarry += $units[$y]['t'.($i + 1)] * ${'u'.($start + $i)}['cap'];
echo "<div class=\"res\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"Lumber\" />".$res['wood']." | <img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"Clay\" />".$res['clay']." | <img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"Iron\" />".$res['iron']." | <img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"Crop\" />".$res['crop']."</div>";
echo "<div class=\"carry\"><img class=\"car\" src=\"img/x.gif\" alt=\"carry\" title=\"carry\"/>".$totalres."/".$totalcarry."</div>";
?>
</tr></tbody>
</tr>
</tbody>
<?php } ?>
<tbody class="infos">
<tr>
<th><?php echo ARRIVAL;?></th>
<td colspan="<?php echo $units[$y]['t11'] == 0 ? 10 : 11 ?>">
<tr>
<th><?php echo ARRIVAL;?></th>
<td colspan="<?php echo $units[$y]['t11'] == 0 ? 10 : 11 ?>">
<?php
echo "<div class=\"in small\"><span id=timer".$session->timer.">".$generator->getTimeFormat($units[$y]['endtime']-time())."</span> h</div>";
$datetime = $generator->procMtime($units[$y]['endtime']);
echo "<div class=\"at\">";
if($datetime[0] != "today") {
echo "".ON." ".$datetime[0]." ";
}
echo "".AT." ".$datetime[1]."</div>";
?>
echo "<div class=\"in small\"><span id=timer".$session->timer.">".$generator->getTimeFormat($units[$y]['endtime'] - time())."</span> h</div>";
$datetime = $generator->procMtime($units[$y]['endtime']);
echo "<div class=\"at\">";
if($datetime[0] != "today") echo "".ON." ".$datetime[0]." ";
echo "".AT." ".$datetime[1]."</div>";
?>
</div>
</td>
</tr>
</tbody>
</td>
</tr>
</tbody>
</table>
<?php
}
}
unset($res, $res1);
}
$array = $database->getOasis($village->wid);
foreach($array as $conqured){
$oasis = $database->getMovement("6",$conqured['wref'],0);
$total_for = count($oasis);
for($y=0;$y < $total_for;$y++){
$session->timer++;
$to = $database->getOMInfo($oasis[$y]['to']);
if ($oasis[$y]['attack_type']==2){
$actionType = REINFORCEMENTFOR;
} else if ($oasis[$y]['attack_type']==3){
$actionType = ATTACK_ON;
} else if ($oasis[$y]['attack_type']==4){
$actionType = RAID_ON;
}
$reinfowner = $database->getVillageField($oasis[$y]['from'],"owner");
if($oasis[$y]['t11'] != 0 && $reinfowner == $session->uid) {
$colspan = 11;
}else{
$colspan = 10;
}
$oasis = $database->getMovement("6", $conqured['wref'], 0);
$total_for = count($oasis);
for($y = 0; $y < $total_for; $y++){
$session->timer++;
$to = $database->getOMInfo($oasis[$y]['to']);
if($oasis[$y]['attack_type'] == 2) $actionType = REINFORCEMENTFOR;
else if($oasis[$y]['attack_type'] == 3) $actionType = ATTACK_ON;
else if($oasis[$y]['attack_type'] == 4) $actionType = RAID_ON;
$reinfowner = $database->getVillageField($oasis[$y]['from'], "owner");
if($oasis[$y]['t11'] != 0 && $reinfowner == $session->uid) $colspan = 11;
else $colspan = 10;
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a href=\"karte.php?d=".$oasis[$y]['from']."&c=".$generator->getMapCheck($oasis[$y]['from'])."\">".$database->getVillageField($oasis[$y]['from'],"name")."</a></td>
<a href=\"karte.php?d=".$oasis[$y]['from']."&c=".$generator->getMapCheck($oasis[$y]['from'])."\">".$database->getVillageField($oasis[$y]['from'], "name")."</a></td>
<td colspan=\"$colspan\">";
echo "<a href=\"karte.php?d=".$oasis[$y]['to']."&c=".$generator->getMapCheck($oasis[$y]['to'])."\">".$actionType." ".$to['name']."</a>";
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = $database->getUserField($reinfowner,"tribe",0);
$start = ($tribe-1)*10+1;
$end = ($tribe*10);
echo "<tr><th>&nbsp;</th>";
for($i=$start;$i<=($end);$i++) {
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($oasis[$y]['t11'] != 0 && $reinfowner == $session->uid) {
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i=1;$i<=$colspan;$i++) {
$totalunits = $oasis[$y]['t1']+$oasis[$y]['t2']+$oasis[$y]['t3']+$oasis[$y]['t4']+$oasis[$y]['t5']+$oasis[$y]['t6']+$oasis[$y]['t7']+$oasis[$y]['t8']+$oasis[$y]['t9']+$oasis[$y]['t10']+$oasis[$y]['t11'];
if($oasis[$y]['attack_type'] == 2){
if($reinfowner != $session->uid){
echo "<td class=\"none\">?</td>";
}else{
if($oasis[$y]['t'.$i] == 0) {
echo "<td class=\"none\">0</td>";
}
else {
echo "<td>";
echo $oasis[$y]['t'.$i]."</td>";
echo "<a href=\"karte.php?d=".$oasis[$y]['to']."&c=".$generator->getMapCheck($oasis[$y]['to'])."\">".$actionType." ".$to['name']."</a>";
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = $database->getUserField($reinfowner, "tribe", 0);
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($oasis[$y]['t11'] != 0 && $reinfowner == $session->uid){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = 1; $i <= $colspan; $i++){
$totalunits = $oasis[$y]['t1'] + $oasis[$y]['t2'] + $oasis[$y]['t3'] + $oasis[$y]['t4'] + $oasis[$y]['t5'] + $oasis[$y]['t6'] + $oasis[$y]['t7'] + $oasis[$y]['t8'] + $oasis[$y]['t9'] + $oasis[$y]['t10'] + $oasis[$y]['t11'];
if($oasis[$y]['attack_type'] == 2){
if($reinfowner != $session->uid) echo "<td class=\"none\">?</td>";
else
{
if($oasis[$y]['t'.$i] == 0) echo "<td class=\"none\">0</td>";
else
{
echo "<td>";
echo $oasis[$y]['t'.$i]."</td>";
}
}
}}else{
if($artifactsSum['totals'] == 0){
echo "<td class=\"none\">?</td>";
}else{
if($oasis[$y]['t'.$i] == 0) {
echo "<td class=\"none\">0</td>";
}else{
echo "<td>?</td>";
}
}
}
}
echo "</tr></tbody>";
echo '
}else{
if($artifactsSum['totals'] == 0) echo "<td class=\"none\">?</td>";
else
{
if($oasis[$y]['t'.$i] == 0) echo "<td class=\"none\">0</td>";
else echo "<td>?</td>";
}
}
}
echo "</tr></tbody>";
echo '
<tbody class="infos">
<tr>
<th>'.ARRIVAL.'</th>
<td colspan="'.$colspan.'">
<div class="in small"><span id=timer'.$session->timer.'>'.$generator->getTimeFormat($oasis[$y]['endtime']-time()).'</span> h</div>';
$datetime = $generator->procMtime($oasis[$y]['endtime']);
echo "<div class=\"at\">";
if($datetime[0] != "today") {
echo "".ON." ".$datetime[0]." ";
}
echo "".AT." ".$datetime[1]." ".HRS."</div>
<div class="in small"><span id=timer'.$session->timer.'>'.$generator->getTimeFormat($oasis[$y]['endtime'] - time()).'</span> h</div>';
$datetime = $generator->procMtime($oasis[$y]['endtime']);
echo "<div class=\"at\">";
if($datetime[0] != "today") echo "".ON." ".$datetime[0]." ";
echo "".AT." ".$datetime[1]." ".HRS."</div>
</div>
</td>
</tr>
</tbody>";
echo "</table>";
}
}
}
$settlers = $database->getMovement("7",$village->wid,1);
$settlers = $database->getMovement(7, $village->wid, 1);
$total_for3 = count($settlers);
for($x=0;$x < $total_for3;$x++){
$session->timer++;
$to = $database->getMInfo($settlers[$x]['to']);
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
for($x = 0; $x < $total_for3; $x++){
$session->timer++;
$to = $database->getMInfo($settlers[$x]['to']);
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead>
<tr>
<td class="role"><a href="karte.php?d=<?php echo $village->wid."&c=".$generator->getMapCheck($village->wid); ?>"><?php echo $village->vname; ?></a></td>
<td colspan="10"><a href="karte.php?d=<?php echo $from['wref']."&c=".$generator->getMapCheck($from['wref']); ?>"><?php echo $actionType." ".$from['name']; ?></a></td>
<td class="role"><a
href="karte.php?d=<?php echo $village->wid."&c=".$generator->getMapCheck($village->wid); ?>"><?php echo $village->vname; ?></a></td>
<td colspan="10"><a
href="karte.php?d=<?php echo $from['wref']."&c=".$generator->getMapCheck($from['wref']); ?>"><?php echo $actionType." ".$from['name']; ?></a></td>
</tr>
</thead>
<tbody class="units">
<?php
$tribe = $session->tribe;
$start = ($tribe-1)*10+1;
$end = ($tribe*10);
echo "<tr><th>&nbsp;</th>";
for($i=$start;$i<=($end);$i++) {
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
?>
$tribe = $session->tribe;
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
?>
</tr>
<tr><th><?php echo TROOPS;?></th>
<tr>
<th><?php echo TROOPS;?></th>
<?php
for($z=1;$z<=9;$z++) {
$settlers[$x]['t'.$z]=0;
}
$settlers[$x]['t10']=3;
for($i=1;$i<11;$i++) {
if($settlers[$x]['t'.$i] == 0) {
echo "<td class=\"none\">0</td>";
}
else {
echo "<td>";
echo $settlers[$x]['t'.$i]."</td>";
}
}
?>
for($z = 1; $z <= 9; $z++) $settlers[$x]['t'.$z] = 0;
$settlers[$x]['t10'] = 3;
for($i = 1; $i < 11; $i++){
if($settlers[$x]['t'.$i] == 0) echo "<td class=\"none\">0</td>";
else
{
echo "<td>";
echo $settlers[$x]['t'.$i]."</td>";
}
}
?>
</tr>
<tbody class="infos">
<tr>
<th><?php echo ARRIVAL;?></th>
<td colspan="10">
<tbody class="infos">
<tr>
<th><?php echo ARRIVAL;?></th>
<td colspan="10">
<?php
echo "<div class=\"in small\"><span id=timer".$session->timer.">".$generator->getTimeFormat($settlers[$x]['endtime']-time())."</span> h</div>";
$datetime = $generator->procMtime($settlers[$x]['endtime']);
echo "<div class=\"at\">";
if($datetime[0] != "today") {
echo "".ON." ".$datetime[0]." ";
}
echo "".AT." ".$datetime[1]."</div>";
?>
echo "<div class=\"in small\"><span id=timer".$session->timer.">".$generator->getTimeFormat($settlers[$x]['endtime'] - time())."</span> h</div>";
$datetime = $generator->procMtime($settlers[$x]['endtime']);
echo "<div class=\"at\">";
if($datetime[0] != "today") echo "".ON." ".$datetime[0]." ";
echo "".AT." ".$datetime[1]."</div>";
?>
</div>
</td>
</tr>
</tbody>
</td>
</tr>
</tbody>
</table>
<?php } ?>
+1 -1
View File
@@ -89,7 +89,7 @@ if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $villa
echo "<span class=\"none\">".UPGRADE_GRANARY.".</span>";
}
else if($bindicate == 7) {
if($village->allcrop - $village->pop - $automation->getUpkeep($village->unitall, 0) > 0){
if($village->allcrop - $village->pop - $technology->getUpkeep($village->unitall, 0) > 0){
$neededtime = $building->calculateAvaliable($id,$village->resarray['f'.$id.'t'],1+$loopsame+$doublebuild+$master);
echo "<span class=\"none\">".ENOUGH_RESOURCES." ".$neededtime[0]." at ".$neededtime[1]."</span>";
}else{
-102
View File
@@ -1,102 +0,0 @@
<?php
$slots = $_POST['slot'];
$lid = $_POST['lid'];
$tribe = $_POST['tribe'];
$getFLData = $database->getFLData($lid);
$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];
$t11 = 0;
$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 = $units->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'] );
$totalunits = $data['u1'] + $data['u2'] + $data['u3'] + $data['u4'] + $data['u5'] + $data['u6'] + $data['u7'] + $data['u8'] + $data['u9'] + $data['u10'] + $data['u11'];
$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 );
}
}
}
}
header("Location: build.php?id=39&t=99");
exit;
?>
+40 -110
View File
@@ -2,7 +2,7 @@
if(isset($_GET['t']) == 99 && isset($_GET['action']) == 0) {
if(isset($_GET['t']) == 99 && isset($_POST['action']) == 'addList' && !empty($_POST['did']) && !empty($_POST['name'])){
if(isset($_GET['t']) == 99 && isset($_POST['action']) == 'addList' && !empty($_POST['did']) && !empty($_POST['name']) && $database->getVillageField($_POST['did'], 'owner') == $session->uid){
$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");
@@ -23,7 +23,6 @@ while($row = mysqli_fetch_array($sql)){
<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="tribe" value="<?php echo $session->tribe; ?>">
<input type="hidden" name="direction" value="asc">
<input type="hidden" name="lid" value="<?php echo $lid; ?>">
<div class="listTitleText">
@@ -53,19 +52,21 @@ 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 == 0) {
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'];
}
$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];
$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'];
$vdata = $database->getVillage($towref);
?>
@@ -80,29 +81,21 @@ $vdata = $database->getVillage($towref);
<td class="village">
<?php
$incoming_attacks = $database->getMovement(3,$towref,1);
$att = '';
if (count($incoming_attacks) > 0) {
$inc_atts = count($incoming_attacks);
if($incoming_attacks[$i]['attack_type'] == 2) {
$inc_atts -= 1;
}
if($inc_atts > 0) {
echo '<img class="att2" src="img/x.gif" title="Incoming Attacker" />';
$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;
}
if($inc_atts > 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 = 'Oasis';
}
else
{
$thisVillageName = $vdata["name"];
$thisVillageName = $database->getOasisField($towref, 'conqured') ? OCCUOASIS : UNOCCUOASIS;
}
else $thisVillageName = $vdata["name"];
?>
<span class="coordinates coordinatesWithText">
<span class="coordText"><?php echo $thisVillageName; ?></span>
@@ -119,70 +112,13 @@ $vdata = $database->getVillage($towref);
<td class="troops">
<?php
if($session->tribe == 1){
if($t1 != 0){
echo '<div class="troopIcon"><img class="unit u1" title="'.U1.'" src="img/x.gif"><span class="troopIconAmount">'.$t1.'</span></div>'; }
if($t2 != 0){
echo '<div class="troopIcon"><img class="unit u2" title="'.U2.'" src="img/x.gif"><span class="troopIconAmount">'.$t2.'</span></div>'; }
if($t3 != 0){
echo '<div class="troopIcon"><img class="unit u3" title="'.U3.'" src="img/x.gif"><span class="troopIconAmount">'.$t3.'</span></div>'; }
if($t4 != 0){
echo '<div class="troopIcon"><img class="unit u4" title="'.U4.'" src="img/x.gif"><span class="troopIconAmount">'.$t4.'</span></div>'; }
if($t5 != 0){
echo '<div class="troopIcon"><img class="unit u5" title="'.U5.'" src="img/x.gif"><span class="troopIconAmount">'.$t5.'</span></div>'; }
if($t6 != 0){
echo '<div class="troopIcon"><img class="unit u6" title="'.U6.'" src="img/x.gif"><span class="troopIconAmount">'.$t6.'</span></div>'; }
if($t7 != 0){
echo '<div class="troopIcon"><img class="unit u7" title="'.U7.'" src="img/x.gif"><span class="troopIconAmount">'.$t7.'</span></div>'; }
if($t8 != 0){
echo '<div class="troopIcon"><img class="unit u8" title="'.U8.'" src="img/x.gif"><span class="troopIconAmount">'.$t8.'</span></div>'; }
if($t9 != 0){
echo '<div class="troopIcon"><img class="unit u9" title="'.U9.'" src="img/x.gif"><span class="troopIconAmount">'.$t9.'</span></div>'; }
if($t10 != 0){
echo '<div class="troopIcon"><img class="unit u10" title="'.U10.'" src="img/x.gif"><span class="troopIconAmount">'.$t10.'</span></div>'; }
}elseif($session->tribe == 2){
if($t1 != 0){
echo '<div class="troopIcon"><img class="unit u11" title="'.U11.'" src="img/x.gif"><span class="troopIconAmount">'.$t1.'</span></div>'; }
if($t2 != 0){
echo '<div class="troopIcon"><img class="unit u12" title="'.U12.'" src="img/x.gif"><span class="troopIconAmount">'.$t2.'</span></div>'; }
if($t3 != 0){
echo '<div class="troopIcon"><img class="unit u13" title="'.U13.'" src="img/x.gif"><span class="troopIconAmount">'.$t3.'</span></div>'; }
if($t4 != 0){
echo '<div class="troopIcon"><img class="unit u14" title="'.U14.'" src="img/x.gif"><span class="troopIconAmount">'.$t4.'</span></div>'; }
if($t5 != 0){
echo '<div class="troopIcon"><img class="unit u15" title="'.U15.'" src="img/x.gif"><span class="troopIconAmount">'.$t5.'</span></div>'; }
if($t6 != 0){
echo '<div class="troopIcon"><img class="unit u16" title="'.U16.'" src="img/x.gif"><span class="troopIconAmount">'.$t6.'</span></div>'; }
if($t7 != 0){
echo '<div class="troopIcon"><img class="unit u17" title="'.U17.'" src="img/x.gif"><span class="troopIconAmount">'.$t7.'</span></div>'; }
if($t8 != 0){
echo '<div class="troopIcon"><img class="unit u18" title="'.U18.'" src="img/x.gif"><span class="troopIconAmount">'.$t8.'</span></div>'; }
if($t9 != 0){
echo '<div class="troopIcon"><img class="unit u19" title="'.U19.'" src="img/x.gif"><span class="troopIconAmount">'.$t9.'</span></div>'; }
if($t10 != 0){
echo '<div class="troopIcon"><img class="unit u20" title="'.U20.'" src="img/x.gif"><span class="troopIconAmount">'.$t10.'</span></div>'; }
}elseif($session->tribe == 3){
if($t1 != 0){
echo '<div class="troopIcon"><img class="unit u21" title="'.U21.'" src="img/x.gif"><span class="troopIconAmount">'.$t1.'</span></div>'; }
if($t2 != 0){
echo '<div class="troopIcon"><img class="unit u22" title="'.U22.'" src="img/x.gif"><span class="troopIconAmount">'.$t2.'</span></div>'; }
if($t3 != 0){
echo '<div class="troopIcon"><img class="unit u23" title="'.U23.'" src="img/x.gif"><span class="troopIconAmount">'.$t3.'</span></div>'; }
if($t4 != 0){
echo '<div class="troopIcon"><img class="unit u24" title="'.U24.'" src="img/x.gif"><span class="troopIconAmount">'.$t4.'</span></div>'; }
if($t5 != 0){
echo '<div class="troopIcon"><img class="unit u25" title="'.U25.'" src="img/x.gif"><span class="troopIconAmount">'.$t5.'</span></div>'; }
if($t6 != 0){
echo '<div class="troopIcon"><img class="unit u26" title="'.U26.'" src="img/x.gif"><span class="troopIconAmount">'.$t6.'</span></div>'; }
if($t7 != 0){
echo '<div class="troopIcon"><img class="unit u27" title="'.U27.'" src="img/x.gif"><span class="troopIconAmount">'.$t7.'</span></div>'; }
if($t8 != 0){
echo '<div class="troopIcon"><img class="unit u28" title="'.U28.'" src="img/x.gif"><span class="troopIconAmount">'.$t8.'</span></div>'; }
if($t9 != 0){
echo '<div class="troopIcon"><img class="unit u29" title="'.U29.'" src="img/x.gif"><span class="troopIconAmount">'.$t9.'</span></div>'; }
if($t10 != 0){
echo '<div class="troopIcon"><img class="unit u30" title="'.U30.'" src="img/x.gif"><span class="troopIconAmount">'.$t10.'</span></div>'; }
$start = ($session->tribe - 1) * 10 + 1;
$end = $session->tribe * 10;
for($i = $start; $i <= $end; $i++){
if(${'t'.($i - $start + 1)} > 0){
echo '<div class="troopIcon"><img class="unit u'.$i.'" title="'.$technology->getUnitName($i).'" src="img/x.gif"><span class="troopIconAmount">'.${'t'.($i - $start + 1)}.'</span></div>';
}
}
?>
@@ -200,18 +136,10 @@ 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]);
$allres = $dataarray[25] + $dataarray[26] + $dataarray[27] + $dataarray[28];
$carry = $dataarray[29];
if ($dataarray[25]+$dataarray[26]+$dataarray[27]+$dataarray[28] == 0) {
echo "<img title=\"bounty: ".$allres." resouces max carry: ".$carry." resouces.\" src=\"img/x.gif\" class=\"carry empty\">";
} elseif ($dataarray[25]+$dataarray[26]+$dataarray[27]+$dataarray[28] != $dataarray[29]) {
echo "<img title=\"bounty: ".$allres." resouces. max carry: ".$carry." resouces.\" src=\"img/x.gif\" class=\"carry half\">";
} else {
echo "<img title=\"bounty: ".$allres." resouces. max carry: ".$carry." resouces.\" src=\"img/x.gif\" class=\"carry full\">";
}
echo "<img title=\"$allres/$carry\" src=\"img/x.gif\" class=\"carry\"/>";
$date = $generator->procMtime($row2['time']);
echo "<a href=\"berichte.php?id=".$row2['id']."\">".$date[0]." ".date('H:i',$row2['time'])."</a> ";
@@ -361,13 +289,15 @@ $NUM1++;
</script>
<?php } ?>
<?php if($create == 1){
$hideevasion = 1;
include("Templates/goldClub/farmlist_add.tpl");
<?php
if($create == 1){
$hideevasion = 1;
include("Templates/goldClub/farmlist_add.tpl");
}else if($create == 2){
$hideevasion = 1;
include("Templates/goldClub/farmlist_addraid.tpl");
$hideevasion = 1;
include("Templates/goldClub/farmlist_addraid.tpl");
}else if($create == 3){
$hideevasion = 1;
include("Templates/goldClub/farmlist_editraid.tpl");
}
$hideevasion = 1;
include("Templates/goldClub/farmlist_editraid.tpl");
}
?>
+5 -8
View File
@@ -3,7 +3,7 @@
<form action="build.php?gid=16&t=99" method="post">
<div class="boxes boxesColor gray"><div class="boxes-tl"></div><div class="boxes-tr"></div><div class="boxes-tc"></div><div class="boxes-ml"></div><div class="boxes-mr"></div><div class="boxes-mc"></div><div class="boxes-bl"></div><div class="boxes-br"></div><div class="boxes-bc"></div><div class="boxes-contents cf">
<input type="hidden" name="action" value="addList">
<table cellpadding="1" cellspacing="1" class="transparent">
<table cellpadding="1" cellspacing="1" class="transparent" id="raidList">
<tbody><tr>
<th>
Name: </th>
@@ -18,12 +18,9 @@
<select id="did" name="did">
<?php
for($i=1;$i<=count($session->villages);$i++) {
if($session->villages[$i-1] == $village->wid){
$select = 'selected="selected"';
}else{
$select = '';
}
for($i = 1; $i <= count($session->villages); $i++){
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>";
}
@@ -35,6 +32,6 @@
</div>
</div>
<button type="submit" value="create"><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">Create</div></div></button>
<button class="trav_buttons" type="submit" value="create">Create</button>
</form>
</div>
+3 -7
View File
@@ -30,8 +30,7 @@ if(isset($_POST['action']) == 'addSlot' && $_POST['lid']) {
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);
@@ -58,7 +57,7 @@ if(isset($_POST['action']) == 'addSlot' && $_POST['lid']) {
}
$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']);
$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;
@@ -73,11 +72,8 @@ if(isset($_POST['action']) == 'addSlot' && $_POST['lid']) {
</b></font>
<form action="build.php?id=39&t=99&action=addraid&lid=<?php echo $_GET['lid']; ?>" method="post">
<div class="boxes boxesColor gray"><div class="boxes-tl"></div><div class="boxes-tr"></div><div class="boxes-tc"></div><div class="boxes-ml"></div><div class="boxes-mr"></div><div class="boxes-mc"></div><div class="boxes-bl"></div><div class="boxes-br"></div><div class="boxes-bc"></div><div class="boxes-contents cf">
<div class="boxes boxesColor gray"><div class="boxes-tl"></div><div class="boxes-tr"></div><div class="boxes-tc"></div><div class="boxes-ml"></div><div class="boxes-mr"></div><div class="boxes-mc"></div><div class="boxes-bl"></div><div class="boxes-br"></div><div class="boxes-bc"></div><div class="boxes-contents cf">
<input type="hidden" name="action" value="addSlot">
<table cellpadding="1" cellspacing="1" class="transparent" id="raidList">
<tbody><tr>
<th>List name:</th>
+26 -30
View File
@@ -7,7 +7,7 @@ if(isset($_GET['action']) == 'editSlot' && $_GET['eid']) {
$FLData = $database->getFLData($eiddata['lid']);
}
if(isset($_POST['action']) == 'editSlot' && $_POST['eid']) {
if(isset($_POST['action']) == 'editSlot' && isset($_GET['eid']) && !empty($_GET['eid']) && isset($_POST['lid']) && !empty($_POST['lid'])) {
if(!empty($_POST['target_id'])){
$Wref = $_POST['target_id'];
$WrefCoor = $database->getCoor($Wref);
@@ -61,9 +61,8 @@ if(isset($_POST['action']) == 'editSlot' && $_POST['eid']) {
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']);
$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']);
header("Location: build.php?id=39&t=99");
exit;
@@ -73,7 +72,7 @@ if($FLData['owner'] == $session->uid){
?>
<div id="raidListSlot">
<h4>Add Slot</h4>
<h4>Edit Slot</h4>
<font color="#FF0000"><b>
<?php echo $errormsg; ?>
</b></font>
@@ -85,13 +84,10 @@ if($FLData['owner'] == $session->uid){
$getlid = $database->getRaidList($database->escape($_GET["eid"]));
$lid2 = $getlid['lid'];
?>
<input type="hidden" name="action" value="editSlot">
<input type="hidden" name="eid" value="<?php echo $_GET['eid']; ?>">
<input type="hidden" name="lid" value="<?php echo $lid2; ?>">
<input type="hidden" name="action" value="editSlot">
<table cellpadding="1" cellspacing="1" class="transparent" id="raidList">
<tbody><tr>
<th>Farm Name:</th><?php echo $_GET["lid"]; ?>
<th>List name:</th><?php echo $_GET["lid"]; ?>
<td>
<select onchange="getTargetsByLid();" id="lid" name="lid">
<?php
@@ -103,7 +99,8 @@ $lowner = $row["owner"];
$lwref = $row["wref"];
$lvname = $database->getVillageField($row["wref"], 'name');
if($lid==$lid2){ $selected = 'selected=""'; }else{ $selected = ''; }
if($lid == $lid2) $selected = 'selected=""';
else $selected = '';
echo '<option value="'.$lid.'" '.$selected.'>'.$lvname.' - '.$lname.'</option>';
}
?>
@@ -111,7 +108,7 @@ $lvname = $database->getVillageField($row["wref"], 'name');
</td>
</tr>
<tr>
<th>Select target:</th>
<th>Target village:</th>
<td class="target">
<div class="coordinatesInput">
@@ -133,24 +130,23 @@ $lvname = $database->getVillageField($row["wref"], 'name');
$getwref = "SELECT id, towref FROM ".TB_PREFIX."raidlist WHERE lid = ".(int) $lid2;
$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);
$tooasistype = $type['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 '<option value="'.$towref.'" '.$selected.'>'.$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["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($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;
}
}
?>
</select>
</div>
+1 -1
View File
@@ -98,7 +98,7 @@ div.c1 {text-align: center}
</div>
</div>
<div id="side_info">
<br /><br /><br /><br /><div id="side_info">
<?php
include("Templates/multivillage.tpl");
include("Templates/quest.tpl");