General fixes

+Fixed a bug that didn't permit to show to the defender "None of your
soldiers returned." under certain circumnstances
+Fixed a bug that showed a wrong report icon if the defender had 0
defences and all attacker's units were trapped/killed during the battle
+Fixed a bug that counted a wrong percentage bonus for the horse
drinking trough
This commit is contained in:
iopietro
2018-06-01 16:24:36 +02:00
parent b12f4d4497
commit b717c0cdf4
3 changed files with 20 additions and 22 deletions
+8 -5
View File
@@ -2234,9 +2234,13 @@ class Automation {
}
$data2 = ''.$from['owner'].','.$from['wref'].','.$owntribe.','.$unitssend_att.','.$unitsdead_att.','.$steal[0].','.$steal[1].','.$steal[2].','.$steal[3].','.$battlepart['bounty'].','.$to['owner'].','.$to['wref'].','.addslashes($to['name']).',,,,'.$targettribe.','.$unitssend_def[0].','.$unitsdead_def[0].','.$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].','.$DefenderHeroesTot.','.$DefenderHeroesDead.','.$info_ram.','.$info_cat.','.$info_chief.','.(isset($info_spy) ? $info_spy : '').',,'.$data['t11'].','.$dead11.','.$herosend_def.','.$deadhero.','.$unitstraped_att;
}
// When all troops die, sends no info...send info
$info_troop = "None of your soldiers have returned";
if($totalsend_att - ($totaldead_att + (isset($totaltraped_att) ? $totaltraped_att : 0)) <= 0){
$info_troop = "None of your soldiers returned.";
}
else $info_troop = "";
//When all of the attacker's troops die, send no informations
$data_fail = ''.$from['owner'].','.$from['wref'].','.$owntribe.','.$unitssend_att.','.$unitsdead_att.','.$steal[0].','.$steal[1].','.$steal[2].','.$steal[3].','.$battlepart['bounty'].','.$to['owner'].','.$to['wref'].','.addslashes($to['name']).',,,,'.$targettribe.','.$unitssend_deff[0].','.$unitsdead_deff[0].','.$rom.','.$unitssend_deff[1].','.$unitsdead_deff[1].','.$ger.','.$unitssend_deff[2].','.$unitsdead_deff[2].','.$gal.','.$unitssend_deff[3].','.$unitsdead_deff[3].','.$nat.','.$unitssend_deff[4].','.$unitsdead_deff[4].','.$natar.','.$unitssend_deff[5].','.$unitsdead_deff[5].','.$DefenderHeroesTot.','.$DefenderHeroesDead.',,,'.$data['t11'].','.$dead11.','.$unitstraped_att.',,'.$info_ram.','.$info_cat.','.$info_chief.','.$info_troop.','.$info_hero;
//Undetected and detected in here.
@@ -2361,10 +2365,9 @@ class Automation {
}
}
$info_troop = "";
$data2 = $data2.','.(isset($info_trap) ? addslashes($info_trap) : '').',,'.$info_troop.','.$info_hero;
if($totalsend_alldef == 0){
if($totalsend_alldef == 0 && $totalsend_att - ($totaldead_att + (isset($totaltraped_att) ? $totaltraped_att : 0)) > 0){
$database->addNotice($to['owner'],$to['wref'],$targetally,7,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,$AttackArrivalTime);
}else if($totaldead_alldef == 0){
$database->addNotice($to['owner'],$to['wref'],$targetally,4,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,$AttackArrivalTime);
File diff suppressed because one or more lines are too long
+11 -16
View File
@@ -316,7 +316,7 @@ class Message {
}
/**
* Not all notices have a corresponding .tpl file but with this function it's like they had it
* Not all notices have a corresponding .tpl file but with this method it's like they have it
*
* @param int $type The type of the report (notice)
* @return int Returns the new report type
@@ -333,19 +333,19 @@ class Message {
case 7:
case 18:
case 20:
case 21: return 1;
case 21: return 1; //General attacking reports
case 11:
case 12:
case 13:
case 14: return 10;
case 14: return 10; //Merchants reports
case 16:
case 17: return 15;
case 17: return 15; //Reinforcements attacked
case 19: return 3;
case 19: return 3; //No troops have returned
case 23: return 22;
case 23: return 22; //Festive reports
}
return $type;
@@ -397,10 +397,9 @@ class Message {
// Vulnerability closed by Shadow
$q = "SELECT Count(*) as Total FROM ".TB_PREFIX."mdata WHERE owner='".$session->uid."' AND time > ".(time() - 60);
$res = mysqli_fetch_array(mysqli_query($database->dblink,$q) or die(mysqli_error($database->dblink). " query ".$q), MYSQLI_ASSOC);
$flood = $res['Total'];
if($flood > 5)
return; //flood
$res = mysqli_fetch_array(mysqli_query($database->dblink,$q), MYSQLI_ASSOC);
if($res['Total'] > 5) return; //flooding prevention
// Vulnerability closed by Shadow
@@ -413,9 +412,7 @@ class Message {
$text = $this->wordCensor($text);
}
if($topic == "") {
$topic = "No subject";
}
if($topic == "") $topic = "No subject";
if(!preg_match('/\[message\]/',$text) && !preg_match('/\[\/message\]/',$text)){
$text = "[message]".$text."[/message]";
@@ -495,9 +492,7 @@ class Message {
if ($security_check) {
$q = "SELECT Count(*) as Total FROM ".TB_PREFIX."mdata WHERE owner='".$session->uid."' AND time > ".(time() - 60);
$res = mysqli_fetch_array(mysqli_query($database->dblink,$q), MYSQLI_ASSOC);
$flood = $res['Total'];
if($flood > 5) return; //flood
if($res['Total'] > 5) return; //flooding prevention
}
// Vulnerability closed by Shadow