mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-30 23:27:14 +00:00
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:
+25
-28
@@ -1,16 +1,16 @@
|
||||
<?php
|
||||
$dataarray = explode(",",$message->readingNotice['data']);
|
||||
if($dataarray[13]!='' or $dataarray!=0){$colspan="11";}else{$colspan="10";}
|
||||
if ($database->getUserField($dataarray[1],'username',0)!="??" || $dataarray[1] == 0) {
|
||||
$user_url="<a href=\"spieler.php?uid=".$database->getUserField($dataarray[1],"id",0)."\">".($dataarray[1] == 0 ? "taskmaster" : $database->getUserField($dataarray[1],'username',0))."</a>";
|
||||
}else{
|
||||
$user_url="<font color=\"grey\"><b>??</b></font>";
|
||||
$colspan = (!empty($dataarray[13]) && $dataarray[13] > 0) ? 11 : 10;
|
||||
|
||||
if ($database->getUserField($dataarray[1], 'username', 0) != "[?]" || $dataarray[1] == 0) {
|
||||
$user_url="<a href=\"spieler.php?uid=".$database->getUserField($dataarray[1], "id", 0)."\">".($dataarray[1] == 0 ? "taskmaster" : $database->getUserField($dataarray[1], 'username', 0))."</a>";
|
||||
}
|
||||
if($database->getVillageField($dataarray[0],'name')!="??" || $dataarray[0] == 0) {
|
||||
$from_url=($dataarray[0] == 0)? "village of the elders" : "<a href=\"karte.php?d=".$dataarray[0]."&c=".$generator->getMapCheck($dataarray[0])."\">".$database->getVillageField($dataarray[0],'name')."</a>";
|
||||
}else{
|
||||
$from_url="<font color=\"grey\"><b>??</b></font>";
|
||||
else $user_url="<font color=\"grey\"><b>[?]</b></font>";
|
||||
|
||||
if($database->getVillageField($dataarray[0],'name') != "[?]" || $dataarray[0] == 0) {
|
||||
$from_url=($dataarray[0] == 0)? "village of the elders" : "<a href=\"karte.php?d=".$dataarray[0]."&c=".$generator->getMapCheck($dataarray[0])."\">".$database->getVillageField($dataarray[0], 'name')."</a>";
|
||||
}
|
||||
else $from_url="<font color=\"grey\"><b>[?]</b></font>";
|
||||
?>
|
||||
<table cellpadding="1" cellspacing="1" id="report_surround">
|
||||
<thead>
|
||||
@@ -23,7 +23,7 @@ if($database->getVillageField($dataarray[0],'name')!="??" || $dataarray[0] == 0)
|
||||
<?php
|
||||
$date = $generator->procMtime($message->readingNotice['time']); ?>
|
||||
<td class="sent">Sent:</td>
|
||||
<td>on <?php echo $date[0]."<span> at ".$date[1]; ?></span><span> </span></td>
|
||||
<td>on <span><?php echo $date[0]." at ".$date[1]; ?></span><span> </span></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -37,30 +37,27 @@ if($database->getVillageField($dataarray[0],'name')!="??" || $dataarray[0] == 0)
|
||||
<td> </td>
|
||||
<?php
|
||||
$tribe = $dataarray[2];
|
||||
$start = ($tribe-1)*10+1;
|
||||
for($i=$start;$i<=($start+9);$i++) {
|
||||
$start = ($tribe - 1) * 10 + 1;
|
||||
for($i = $start; $i <= ($start + 9); $i++) {
|
||||
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
|
||||
}
|
||||
if($dataarray[13]!=0){
|
||||
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" /></td>";
|
||||
}
|
||||
if($dataarray[13] > 0) echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" /></td>";
|
||||
|
||||
echo "</tr><tr><th>Troops</th>";
|
||||
for($i=3;$i<13;$i++) {
|
||||
$unitarray['u'.($i-3+$start).''] = $dataarray[$i];
|
||||
if($dataarray[$i] == 0) {
|
||||
echo "<td class=\"none\">0</td>";
|
||||
}
|
||||
else {
|
||||
echo "<td>".$dataarray[$i]."</td>";
|
||||
}
|
||||
for($i = 3; $i < 13; $i++) {
|
||||
$unitarray['u'.($i - 3 + $start)] = $dataarray[$i];
|
||||
|
||||
if($dataarray[$i] == 0) echo "<td class=\"none\">0</td>";
|
||||
else echo "<td>".$dataarray[$i]."</td>";
|
||||
|
||||
}
|
||||
if($dataarray[13] != 0) {
|
||||
echo "<td>".$dataarray[13]."</td>";
|
||||
$unitarray['hero'] = 1;
|
||||
if($dataarray[13] > 0) {
|
||||
echo "<td>".$dataarray[13]."</td>";
|
||||
$unitarray['hero'] = 1;
|
||||
}
|
||||
|
||||
?></tr></tbody>
|
||||
<tbody class="infos"><tr><th>upkeep</th><td colspan="11">
|
||||
<?php echo $technology->getUpkeep($unitarray,$dataarray[2]); ?><img src="img/x.gif" class="r4" title="Crop" alt="Crop" />per hour</td>
|
||||
<?php echo $technology->getUpkeep($unitarray, $dataarray[2]); ?><img src="img/x.gif" class="r4" title="Crop" alt="Crop" />per hour</td>
|
||||
</tr></tbody>
|
||||
</table></td></tr></tbody></table>
|
||||
</table></td></tr></tbody></table>
|
||||
Reference in New Issue
Block a user