Reports refactor #1

-Removed 29 files from the "Templates/Notice" folder, there were a lot
of duplicated/very similar kinds of report. Now, there are only 6 kinds
of report (9.tpl isn't counted)
+Changed a lot of codes in some .tpl reports, into a foreach

Automation.php:

+Modified report data, for the refactored report system
+Some clean-up

Battle.php:

+Fixed catapults and rams, they weren't able to destroy completely a building
+Fixed a possible division by 0 error
This commit is contained in:
iopietro
2018-04-19 20:14:54 +02:00
parent 06fc62752a
commit 882215cd2a
41 changed files with 426 additions and 9017 deletions
+34
View File
@@ -363,6 +363,40 @@ class Message {
}
}
/**
* Not all notices have a corresponding .tpl file but with this function it's like they had it
*
* @param int $type The type of the report (notice)
* @return int Returns the new report type
*/
public function getReportType($type)
{
switch($type)
{
case 2:
case 4:
case 5:
case 6:
case 7:
case 18:
case 20:
case 21: return 1;
case 11:
case 12:
case 13:
case 14: return 10;
case 16:
case 17: return 15;
case 19: return 3;
}
return $type;
}
public function loadNotes() {
global $session;
if(file_exists("GameEngine/Notes/" . md5($session->username) . ".txt")) {