Update Automation.php

This commit is contained in:
Shadow
2013-12-14 18:56:42 +02:00
parent 06d5668acd
commit 1aa28856ff
+17 -11
View File
@@ -2494,13 +2494,15 @@ class Automation {
} }
}elseif($data['t11']>0) { }elseif($data['t11']>0) {
if ($heroxp == 0) { if ($heroxp == 0) {
$xp=" and no XP from the battle"; $xp="";
} else { } else {
$xp=" but gained ".$heroxp." XP from the battle"; $xp=" but gained ".$heroxp." XP from the battle";
} }
$info_hero = $hero_pic.",Your hero die ".$xp; $info_hero = $hero_pic.",Your hero die".$xp;
}
if ($DefenderID==0) {
$natar=0;
} }
if($scout){ if($scout){
if ($data['spy'] == 1){ if ($data['spy'] == 1){
$info_spy = "".$spy_pic.",<div class=\"res\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"Lumber\" />".round($totwood)." | $info_spy = "".$spy_pic.",<div class=\"res\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"Lumber\" />".round($totwood)." |
@@ -2757,17 +2759,18 @@ $wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"
$database->setMovementProc($data['moveid']); $database->setMovementProc($data['moveid']);
if($chiefing_village != 1){ if($chiefing_village != 1){
$database->addMovement(4,$to['wref'],$from['wref'],$data['ref'],$AttackArrivalTime,$endtime); $database->addMovement(4,$DefenderWref,$AttackerWref,$data['ref'],$AttackArrivalTime,$endtime);
// send the bounty on type 6. // send the bounty on type 6.
if($type !== 1) if($type !== 1){
{
$reference = $database->sendResource($steal[0],$steal[1],$steal[2],$steal[3],0,0); $reference = $database->sendResource($steal[0],$steal[1],$steal[2],$steal[3],0,0);
if ($isoasis == 0){ if ($isoasis == 0){
$database->modifyResource($to['wref'],$steal[0],$steal[1],$steal[2],$steal[3],0); $database->modifyResource($DefenderWref,$steal[0],$steal[1],$steal[2],$steal[3],0);
}else{ }else{
$database->modifyOasisResource($to['wref'],$steal[0],$steal[1],$steal[2],$steal[3],0); $database->modifyOasisResource($DefenderWref,$steal[0],$steal[1],$steal[2],$steal[3],0);
} }
$database->addMovement(6,$to['wref'],$from['wref'],$reference,$AttackArrivalTime,$endtime,1,0,0,0,0,$data['ref']); $database->addMovement(6,$DefenderWref,$AttackerWref,$reference,$AttackArrivalTime,$endtime,1,0,0,0,0,$data['ref']);
$totalstolengain=$steal[0]+$steal[1]+$steal[2]+$steal[3]; $totalstolengain=$steal[0]+$steal[1]+$steal[2]+$steal[3];
$totalstolentaken=($totalstolentaken-($steal[0]+$steal[1]+$steal[2]+$steal[3])); $totalstolentaken=($totalstolentaken-($steal[0]+$steal[1]+$steal[2]+$steal[3]));
$database->modifyPoints($from['owner'],'RR',$totalstolengain); $database->modifyPoints($from['owner'],'RR',$totalstolengain);
@@ -2775,9 +2778,11 @@ $wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"
$database->modifyPointsAlly($targetally,'RR',$totalstolentaken ); $database->modifyPointsAlly($targetally,'RR',$totalstolentaken );
$database->modifyPointsAlly($ownally,'RR',$totalstolengain); $database->modifyPointsAlly($ownally,'RR',$totalstolengain);
} }
}else{ }else{ //fix by ronix if only 1 chief left to conqured - don't add with zero enforces
if($totalsend_att - ($totaldead_att+$totaltraped_att) > 0) {
$database->addEnforce2($data,$owntribe,$troopsdead1,$troopsdead2,$troopsdead3,$troopsdead4,$troopsdead5,$troopsdead6,$troopsdead7,$troopsdead8,$troopsdead9,$troopsdead10,$troopsdead11); $database->addEnforce2($data,$owntribe,$troopsdead1,$troopsdead2,$troopsdead3,$troopsdead4,$troopsdead5,$troopsdead6,$troopsdead7,$troopsdead8,$troopsdead9,$troopsdead10,$troopsdead11);
} }
}
} }
else //else they die and don't return or report. else //else they die and don't return or report.
{ {
@@ -3254,7 +3259,7 @@ $wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"
$database->setVillageField($data['to'], 'starvupdate', $time); $database->setVillageField($data['to'], 'starvupdate', $time);
} }
} }
}
//check empty reinforcement in rally point //check empty reinforcement in rally point
$e_units=''; $e_units='';
for ($i=1;$i<=50;$i++) { for ($i=1;$i<=50;$i++) {
@@ -3263,6 +3268,7 @@ $wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"
$e_units.='hero=0'; $e_units.='hero=0';
$q="DELETE FROM ".TB_PREFIX."enforcement WHERE ".$e_units." AND (vref=".$data['to']." OR `from`=".$data['to'].")"; $q="DELETE FROM ".TB_PREFIX."enforcement WHERE ".$e_units." AND (vref=".$data['to']." OR `from`=".$data['to'].")";
$database->query($q); $database->query($q);
}
if(file_exists("GameEngine/Prevention/sendreinfunits.txt")) { if(file_exists("GameEngine/Prevention/sendreinfunits.txt")) {
unlink("GameEngine/Prevention/sendreinfunits.txt"); unlink("GameEngine/Prevention/sendreinfunits.txt");