mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-14 15:21:01 +00:00
fix starvation + wall image in scout report
This commit is contained in:
+55
-12
@@ -695,8 +695,9 @@ class Automation {
|
|||||||
$unitarrays = $this->getAllUnits($indi['wid']);
|
$unitarrays = $this->getAllUnits($indi['wid']);
|
||||||
$village = $database->getVillage($indi['wid']);
|
$village = $database->getVillage($indi['wid']);
|
||||||
$upkeep = $village['pop'] + $this->getUpkeep($unitarrays, 0);
|
$upkeep = $village['pop'] + $this->getUpkeep($unitarrays, 0);
|
||||||
if ($crop < $upkeep){
|
$starv = $database->getVillageField($indi['wid'],"starv");
|
||||||
// add starv data
|
if ($crop < $upkeep && $starv == 0){
|
||||||
|
// add starv data
|
||||||
$database->setVillageField($indi['wid'], 'starv', $upkeep);
|
$database->setVillageField($indi['wid'], 'starv', $upkeep);
|
||||||
$database->setVillageField($indi['wid'], 'starvupdate', $time);
|
$database->setVillageField($indi['wid'], 'starvupdate', $time);
|
||||||
}
|
}
|
||||||
@@ -2456,7 +2457,7 @@ if($data['t11'] > 0){
|
|||||||
}
|
}
|
||||||
$palaceimg = "<img src=\"".GP_LOCATE."img/g/g26.gif\" height=\"20\" width=\"15\" alt=\"Palace\" title=\"Palace\" />";
|
$palaceimg = "<img src=\"".GP_LOCATE."img/g/g26.gif\" height=\"20\" width=\"15\" alt=\"Palace\" title=\"Palace\" />";
|
||||||
$crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\" alt=\"Cranny\" title=\"Cranny\" />";
|
$crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\" alt=\"Cranny\" title=\"Cranny\" />";
|
||||||
$wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"20\" width=\"15\" alt=\"Wall\" title=\"Wall\" />";
|
$wallimg = "<img src=\"".GP_LOCATE."img/g/g33Icon.gif\" height=\"20\" width=\"15\" alt=\"Wall\" title=\"Wall\" />";
|
||||||
$info_spy = "".$spy_pic.",".$palaceimg." Residance/Palace Level : ".$rplevel."
|
$info_spy = "".$spy_pic.",".$palaceimg." Residance/Palace Level : ".$rplevel."
|
||||||
<br>".$crannyimg." Cranny level: ".$crannylevel."<br>".$wallimg." Wall Level : ".$walllevel."";
|
<br>".$crannyimg." Cranny level: ".$crannylevel."<br>".$wallimg." Wall Level : ".$walllevel."";
|
||||||
|
|
||||||
@@ -2801,7 +2802,8 @@ $wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"
|
|||||||
$unitarrays = $this->getAllUnits($to['wref']);
|
$unitarrays = $this->getAllUnits($to['wref']);
|
||||||
$getvillage = $database->getVillage($to['wref']);
|
$getvillage = $database->getVillage($to['wref']);
|
||||||
$village_upkeep = $getvillage['pop'] + $this->getUpkeep($unitarrays, 0);
|
$village_upkeep = $getvillage['pop'] + $this->getUpkeep($unitarrays, 0);
|
||||||
if ($crop < $village_upkeep){
|
$starv = $database->getVillageField($to['wref'],"starv");
|
||||||
|
if ($crop < $village_upkeep && $starv == 0){
|
||||||
// add starv data
|
// add starv data
|
||||||
$database->setVillageField($to['wref'], 'starv', $village_upkeep);
|
$database->setVillageField($to['wref'], 'starv', $village_upkeep);
|
||||||
$database->setVillageField($to['wref'], 'starvupdate', time());
|
$database->setVillageField($to['wref'], 'starvupdate', time());
|
||||||
@@ -3644,7 +3646,8 @@ $wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"
|
|||||||
$unitarrays = $this->getAllUnits($train['vref']);
|
$unitarrays = $this->getAllUnits($train['vref']);
|
||||||
$village = $database->getVillage($train['vref']);
|
$village = $database->getVillage($train['vref']);
|
||||||
$upkeep = $village['pop'] + $this->getUpkeep($unitarrays, 0);
|
$upkeep = $village['pop'] + $this->getUpkeep($unitarrays, 0);
|
||||||
if ($crop < $upkeep){
|
$starv = $database->getVillageField($train['vref'],"starv");
|
||||||
|
if ($crop < $upkeep && $starv == 0){
|
||||||
// add starv data
|
// add starv data
|
||||||
$database->setVillageField($train['vref'], 'starv', $upkeep);
|
$database->setVillageField($train['vref'], 'starv', $upkeep);
|
||||||
$database->setVillageField($train['vref'], 'starvupdate', $time);
|
$database->setVillageField($train['vref'], 'starvupdate', $time);
|
||||||
@@ -3822,7 +3825,14 @@ $wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"
|
|||||||
foreach($harray as $hdata){
|
foreach($harray as $hdata){
|
||||||
if((time()-$hdata['lastupdate'])>=1){
|
if((time()-$hdata['lastupdate'])>=1){
|
||||||
if($hdata['health']<100 and $hdata['health']>0){
|
if($hdata['health']<100 and $hdata['health']>0){
|
||||||
$reg = $hdata['health']+$hdata['regeneration']*5*SPEED/86400*(time()-$hdata['lastupdate']);
|
if(SPEED <= 10){
|
||||||
|
$speed = SPEED;
|
||||||
|
}else if(SPEED <= 100){
|
||||||
|
$speed = ceil(SPEED/10);
|
||||||
|
}else{
|
||||||
|
$speed = ceil(SPEED/100);
|
||||||
|
}
|
||||||
|
$reg = $hdata['health']+$hdata['regeneration']*5*$speed/86400*(time()-$hdata['lastupdate']);
|
||||||
if($reg <= 100){
|
if($reg <= 100){
|
||||||
$database->modifyHero("health",$reg,$hdata['heroid']);
|
$database->modifyHero("health",$reg,$hdata['heroid']);
|
||||||
}else{
|
}else{
|
||||||
@@ -4150,32 +4160,65 @@ $wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"
|
|||||||
}
|
}
|
||||||
if($difcrop > 0){
|
if($difcrop > 0){
|
||||||
$killunits = floor($difcrop/18000);
|
$killunits = floor($difcrop/18000);
|
||||||
if($killunits > 0){
|
while($killunits > 0){
|
||||||
if (isset($enf)){
|
if (isset($enf)){
|
||||||
if($killunits < $maxcount){
|
if($killunits <= $maxcount){
|
||||||
$database->modifyEnforce($enf, $maxtype, $killunits, 0);
|
$database->modifyEnforce($enf, $maxtype, $killunits, 0);
|
||||||
$database->setVillageField($starv['wref'], 'starv', $upkeep);
|
$database->setVillageField($starv['wref'], 'starv', $upkeep);
|
||||||
$database->setVillageField($starv['wref'], 'starvupdate', $time);
|
$database->setVillageField($starv['wref'], 'starvupdate', $time);
|
||||||
}else{
|
}else{
|
||||||
|
$database->modifyUnit($starv['wref'], array($maxtype), array($killunits), array(0));
|
||||||
|
$killunits -= $maxcount;
|
||||||
|
foreach ($enforcearray as $enforce){
|
||||||
|
for($i = 0 ; $i <= 50 ; $i++){
|
||||||
|
$units = $enforce['u'.$i];
|
||||||
|
if($enforce['u'.$i] > $maxcount){
|
||||||
|
$maxcount = $enforce['u'.$i];
|
||||||
|
$maxtype = $i;
|
||||||
|
$enf = $enforce['id'];
|
||||||
|
}
|
||||||
|
$totalunits += $enforce['u'.$i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($totalunits == 0){
|
||||||
|
$maxcount = $enforce['hero'];
|
||||||
|
$maxtype = "hero";
|
||||||
|
if($maxcount <= $killunits){
|
||||||
$database->deleteReinf($enf);
|
$database->deleteReinf($enf);
|
||||||
|
$killunits -= $maxcount;
|
||||||
|
}
|
||||||
|
}
|
||||||
$database->setVillageField($starv['wref'], 'starv', $upkeep);
|
$database->setVillageField($starv['wref'], 'starv', $upkeep);
|
||||||
$database->setVillageField($starv['wref'], 'starvupdate', $time);
|
$database->setVillageField($starv['wref'], 'starvupdate', $time);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if($killunits < $maxcount){
|
if($killunits <= $maxcount){
|
||||||
$database->modifyUnit($starv['wref'], array($maxtype), array($killunits), array(0));
|
$database->modifyUnit($starv['wref'], array($maxtype), array($killunits), array(0));
|
||||||
|
$killunits = 0;
|
||||||
$database->setVillageField($starv['wref'], 'starv', $upkeep);
|
$database->setVillageField($starv['wref'], 'starv', $upkeep);
|
||||||
$database->setVillageField($starv['wref'], 'starvupdate', $time);
|
$database->setVillageField($starv['wref'], 'starvupdate', $time);
|
||||||
}elseif($killunits > $maxcount){
|
}else{
|
||||||
$killunits = $maxcount;
|
|
||||||
$database->modifyUnit($starv['wref'], array($maxtype), array($killunits), array(0));
|
$database->modifyUnit($starv['wref'], array($maxtype), array($killunits), array(0));
|
||||||
|
$killunits -= $maxcount;
|
||||||
|
for($i = 0 ; $i <= 50 ; $i++){
|
||||||
|
$units = $unitarray['u'.$i];
|
||||||
|
if($unitarray['u'.$i] > $maxcount){
|
||||||
|
$maxcount = $unitarray['u'.$i];
|
||||||
|
$maxtype = $i;
|
||||||
|
}
|
||||||
|
$totalunits += $unitarray['u'.$i];
|
||||||
|
}
|
||||||
|
if($totalunits == 0){
|
||||||
|
$maxcount = $unitarray['hero'];
|
||||||
|
$maxtype = "hero";
|
||||||
|
}
|
||||||
$database->setVillageField($starv['wref'], 'starv', $upkeep);
|
$database->setVillageField($starv['wref'], 'starv', $upkeep);
|
||||||
$database->setVillageField($starv['wref'], 'starvupdate', $time);
|
$database->setVillageField($starv['wref'], 'starvupdate', $time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$crop = $database->getCropProdstarv($starv['wref']);
|
$crop = $database->getCropProdstarv($starv['wref']);
|
||||||
if ($crop > $upkeep){
|
if ($crop > $upkeep){
|
||||||
$database->setVillageField($starv['wref'], 'starv', 0);
|
$database->setVillageField($starv['wref'], 'starv', 0);
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 574 B |
Reference in New Issue
Block a user