fix duplicates when found new village + show returning scouts on rally point

This commit is contained in:
unknown
2012-06-17 11:18:28 +03:00
parent 7cbfd7acc9
commit 1232c8c87e
7 changed files with 103 additions and 13 deletions
+27 -3
View File
@@ -2083,6 +2083,7 @@ class Automation {
$plevel = $i;
}
}
if($palacelevel['f'.$plevel.'t'] == 26){
if($palacelevel['f'.$plevel] < 10){
$canconquer = 0;
}
@@ -2095,6 +2096,17 @@ class Automation {
else{
$canconquer = 3;
}
}else if($palacelevel['f'.$i.'t'] == 25){
if($palacelevel['f'.$plevel] < 10){
$canconquer = 0;
}
elseif($palacelevel['f'.$plevel] < 20){
$canconquer = 1;
}
else{
$canconquer = 2;
}
}
$exp1 = $database->getVillageField($from['wref'],'exp1');
$exp2 = $database->getVillageField($from['wref'],'exp2');
@@ -2105,7 +2117,7 @@ class Automation {
elseif($exp2 == 0){
$villexp = 1;
}
elseif($exp2 == 0){
elseif($exp3 == 0){
$villexp = 2;
}
else{
@@ -2803,6 +2815,17 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
}
$this->pruneResource();
// Settlers
$q = "SELECT * FROM ".TB_PREFIX."movement where ref = 0 and proc = '0' and sort_type = '4' and endtime < $time";
$dataarray = $database->query_return($q);
foreach($dataarray as $data) {
$tribe = $database->getUserField($database->getVillageField($data['to'],"owner"),"tribe",0);
$database->modifyUnit($data['to'],array($tribe."0"),array(3),array(1));
$database->setMovementProc($data['moveid']);
}
if(file_exists("GameEngine/Prevention/returnunits.txt")) {
unlink("GameEngine/Prevention/returnunits.txt");
@@ -2823,7 +2846,7 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
$to = $database->getMInfo($data['from']);
$user = $database->getUserField($to['owner'],'username',0);
$taken = $database->getVillageState($data['to']);
if($taken['occupied'] == 0){
if($taken != 1){
$database->setFieldTaken($data['to']);
$database->addVillage($data['to'],$to['owner'],$user,'0');
$database->addResourceFields($data['to'],$database->getVillageType($data['to']));
@@ -2852,7 +2875,8 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
}
else{
// here must come movement from returning settlers
$database->setMovementProc($data['moveid']);
$database->addMovement(4,$data['to'],$data['from'],$data['ref'],$time,$time+($time-$data['starttime']));
$database->setMovementProc($data['moveid']);
}
}
if(file_exists("GameEngine/Prevention/settlers.txt")) {
+3
View File
@@ -2058,6 +2058,9 @@
case 6:
$q = "SELECT * FROM " . TB_PREFIX . "movement," . TB_PREFIX . "odata, " . TB_PREFIX . "attacks where " . TB_PREFIX . "odata.conqured = $village and " . TB_PREFIX . "movement.to = " . TB_PREFIX . "odata.wref and " . TB_PREFIX . "movement.ref = " . TB_PREFIX . "attacks.id and " . TB_PREFIX . "movement.proc = 0 and " . TB_PREFIX . "movement.sort_type = 3 ORDER BY endtime ASC";
break;
case 7:
$q = "SELECT * FROM " . TB_PREFIX . "movement where " . TB_PREFIX . "movement." . $where . " = $village and sort_type = 4 and ref = 0 and proc = 0 ORDER BY endtime ASC";
break;
case 34:
$q = "SELECT * FROM " . TB_PREFIX . "movement, " . TB_PREFIX . "attacks where " . TB_PREFIX . "movement." . $where . " = $village and " . TB_PREFIX . "movement.ref = " . TB_PREFIX . "attacks.id and " . TB_PREFIX . "movement.proc = 0 and " . TB_PREFIX . "movement.sort_type = 3 or " . TB_PREFIX . "movement." . $where . " = $village and " . TB_PREFIX . "movement.ref = " . TB_PREFIX . "attacks.id and " . TB_PREFIX . "movement.proc = 0 and " . TB_PREFIX . "movement.sort_type = 4 ORDER BY endtime ASC";
break;
+1 -1
View File
@@ -481,7 +481,7 @@ class Units {
$unit = ($session->tribe*10);
$database->modifyResource($village->wid,750,750,750,750,0);
$database->modifyUnit($village->wid,array($unit),array(3),array(0));
$database->addMovement(5,$village->wid,$post['s'],0,time(),$post['timestamp']);
$database->addMovement(5,$village->wid,$post['s'],0,time(),time()+$post['timestamp']);
header("Location: build.php?id=39");
if($form->returnErrors() > 0) {
+4 -3
View File
@@ -13,13 +13,14 @@
</div>
<?php
$units_type = $database->getMovement("34",$village->wid,1);
$settlers = $database->getMovement("7",$village->wid,1);
$units_incoming = count($units_type);
$settlers_incoming = count($settlers);
for($i=0;$i<$units_incoming;$i++){
if($units_type[$i]['attack_type'] == 1)
if($units_type[$i]['attack_type'] == 1 && $units_type[$i]['sort_type'] == 3)
$units_incoming -= 1;
}
if($units_incoming >= 1){
if($units_incoming > 0 or $settlers_incoming > 0){
?>
<h4>Incoming troops (<?php echo $units_incoming; ?>)</h4>
<?php include("16_incomming.tpl");
+61 -2
View File
@@ -276,7 +276,66 @@ if($units[$y]['from'] != 0){
<?php
}
}
}
?>
$settlers = $database->getMovement("7",$village->wid,1);
$total_for3 = count($settlers);
for($x=0;$x < $total_for3;$x++){
$timer = $x+1;
$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 $to['wref']."&c=".$generator->getMapCheck($to['wref']); ?>"><?php echo "Returning to ".$to['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>";
}
?>
</tr>
<tr><th>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>";
}
}
?>
</tr>
<tbody class="infos">
<tr>
<th>Arrival</th>
<td colspan="10">
<?php
echo "<div class=\"in small\"><span id=timer".$timer.">".$generator->getTimeFormat($settlers[$x]['endtime']-time())."</span> h</div>";
$datetime = $generator->procMtime($settlers[$x]['endtime']);
echo "<div class=\"at small\">";
if($datetime[0] != "today") {
echo "on ".$datetime[0]." ";
}
echo "at ".$datetime[1]."</div>";
?>
</div>
</td>
</tr>
</tbody>
</table>
<?php } ?>
+6 -3
View File
@@ -97,7 +97,7 @@ $timer += 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 $settlers[$y]['to']."&c=".$generator->getMapCheck($settlers[$y]['to']); ?>">Found new village.</a></td>
<td colspan="10"><a href="karte.php?d=<?php echo $settlers[$y]['to']."&c=".$generator->getMapCheck($settlers[$y]['to']); ?>">Found new village</a></td>
</tr>
</thead>
<tbody class="units">
@@ -113,15 +113,18 @@ $timer += 1;
</tr>
<tr><th>Troops</th>
<?php
for($x=1;$x<=9;$x++) {
$units[$y]['t'.$x]=0;
}
$units[$y]['t10']=3;
for($i=1;$i<=10;$i++) {
if($units[$y]['t'.$i] == 0) {
echo "<td class=\"none\">";
echo "<td class=\"none\">0</td>";
}
else {
echo "<td>";
}
echo $units[$y]['t'.$i]."</td>";
}
}
?>
</tr></tbody>
+1 -1
View File
@@ -28,7 +28,7 @@ echo '</pre>';
<input type="hidden" name="c" value="5" />
<input type="hidden" name="s" value="<?php echo $_GET['id']; ?>" />
<input type="hidden" name="id" value="39" />
<input type="hidden" name="timestamp" value="<?php echo time()+$time ?>" />
<input type="hidden" name="timestamp" value="<?php echo $time; ?>" />
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead>
<tr>