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) {