mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
Fixed some bugs
+Fixed a "division by zero" error, in Battle.php +Reworked spied informations, now they're shown only if the building is at least at level 1. Splitted residence/palace information in two distinct informations. Now the total crannies capacity is displayed (even if the capacity is 0) instead of the level of the greatest cranny +Fixed "getFieldLevelInVillage" function in Database.php -Removed an useless control in Units.php
This commit is contained in:
+14
-15
@@ -2767,22 +2767,21 @@ class Automation {
|
||||
";
|
||||
}else if($data['spy'] == 2){
|
||||
if ($isoasis == 0){
|
||||
$crannylevel = $database->getFieldLevelInVillage($data['to'], 23);
|
||||
$walllevel = $database->getFieldLevelInVillage($data['to'], '31, 32, 33');
|
||||
$rplevel = $database->getFieldLevelInVillage($data['to'], '25, 26');
|
||||
} else {
|
||||
$crannylevel =0;
|
||||
$walllevel =0;
|
||||
$rplevel =0;
|
||||
}
|
||||
|
||||
$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\" />";
|
||||
$wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"20\" width=\"15\" alt=\"Wall\" title=\"Wall\" />";
|
||||
$info_spy = "".$spy_pic.",".$palaceimg." Residance/Palace Level : ".$rplevel."
|
||||
$walllevel = $database->getFieldLevelInVillage($data['to'], 31);
|
||||
$residencelevel = $database->getFieldLevelInVillage($data['to'], 25);
|
||||
$palacelevel = $database->getFieldLevelInVillage($data['to'], 26);
|
||||
$residenceimg = "<img src=\"".GP_LOCATE."img/g/g25.gif\" height=\"20\" width=\"15\" alt=\"Residence\" title=\"Residence\" />";
|
||||
$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\" />";
|
||||
$wallimg = "<img src=\"".GP_LOCATE."img/g/g3".$targettribe."Icon.gif\" height=\"20\" width=\"15\" alt=\"Wall\" title=\"Wall\" />";
|
||||
$info_spy = "".$spy_pic.",";
|
||||
if($residencelevel > 0) $info_spy .= $residenceimg." Residence level:<b>".$residencelevel."</b><br />";
|
||||
elseif($palacelevel > 0) $info_spy .= $palaceimg." Palace level: <b>".$palacelevel."</b><br />";
|
||||
|
||||
<br>".$crannyimg." Cranny level: ".$crannylevel."<br>".$wallimg." Wall level : ".$walllevel."";
|
||||
|
||||
if($walllevel > 0) $info_spy .= $wallimg." Wall level: <b>".$walllevel."</b><br />";
|
||||
$info_spy .= $crannyimg." Total crannies capacity: <b>".$cranny."</b>";
|
||||
}
|
||||
else $info_spy = "".$spy_pic.", There are no informations to show";
|
||||
}
|
||||
|
||||
$data2 = ''.$from['owner'].','.$from['wref'].','.$owntribe.','.$unitssend_att.','.$unitsdead_att.',0,0,0,0,0,'.$to['owner'].','.$to['wref'].','.addslashes($to['name']).','.$targettribe.',,,'.$rom.','.$unitssend_def[1].','.$unitsdead_def[1].','.$ger.','.$unitssend_def[2].','.$unitsdead_def[2].','.$gal.','.$unitssend_def[3].','.$unitsdead_def[3].','.$nat.','.$unitssend_def[4].','.$unitsdead_def[4].','.$natar.','.$unitssend_def[5].','.$unitsdead_def[5].','.$info_ram.','.$info_cat.','.$info_chief.','.$info_spy.',,'.$data['t11'].','.$dead11.','.$herosend_def.','.$deadhero.','.$unitstraped_att;
|
||||
|
||||
@@ -524,7 +524,7 @@ class Battle {
|
||||
|
||||
// Formula for calculating the Moral
|
||||
if($attpop > $defpop) {
|
||||
$moralbonus = 1 / round(max(0.667, pow($defpop / $attpop, 0.2 * min(1, $rap / $rdp))), 3);
|
||||
$moralbonus = 1 / round(max(0.667, pow($defpop / $attpop, 0.2 * min(1, $rap / ($rdp > 0 ? $rdp : 1)))), 3);
|
||||
}else{
|
||||
$moralbonus = 1.0;
|
||||
}
|
||||
|
||||
@@ -3560,7 +3560,7 @@ class MYSQLi_DB implements IDbConnection {
|
||||
)
|
||||
) as level
|
||||
FROM
|
||||
".TB_PREFIX."fdata`
|
||||
".TB_PREFIX."fdata
|
||||
WHERE
|
||||
vref = $vid
|
||||
AND
|
||||
|
||||
@@ -367,8 +367,6 @@ class Units {
|
||||
if ( $data['u11'] < 0 ) {
|
||||
$form->addError( "error", "You can't send negative units." );
|
||||
}
|
||||
|
||||
if($data['type'] < 1 || $data['type'] > 4) $form->addError("error", "Invalid attack type.");
|
||||
|
||||
if($data['type'] != 1 && $post['spy'] != 0) $post['spy'] = 0;
|
||||
|
||||
|
||||
@@ -333,14 +333,14 @@ $end = ($tribe*10);
|
||||
?><tbody class="infos">
|
||||
<tr>
|
||||
<th>Destination:</th>
|
||||
<td> colspan="<?php if(!empty($process['t11'])){ echo"11"; }else{ echo"10"; } ?>">
|
||||
<?PHP
|
||||
<td colspan="<?php echo !empty($process['t11']) ? 11 : 10; ?>">
|
||||
<?php
|
||||
|
||||
echo"Warning: Catapult will <b>ONLY</b> shoot with a normal attack (they dont shoot with raids!)";
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?PHP
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -317,15 +317,15 @@ $actionType = "Raid";
|
||||
?><tbody class="infos">
|
||||
<tr>
|
||||
<th>Destination:</th>
|
||||
<td> colspan="<?php if($process['t11'] != ''){ echo"11"; }else{ echo"10"; } ?>">
|
||||
<?PHP
|
||||
<td colspan="<?php echo !empty($process['t11']) ? 11 : 10; ?>">
|
||||
<?php
|
||||
|
||||
echo"Warning: Catapult will <b>ONLY</b> shoot with a normal attack (they dont shoot with raids!)";
|
||||
?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?PHP
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user