|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Created by Gorlum 12.10.2017 15:54 |
|
4
|
|
|
*/ |
|
5
|
|
|
|
|
6
|
|
|
namespace Pm; |
|
7
|
|
|
|
|
8
|
|
|
use \Fleet\MissionEspionageReport; |
|
|
|
|
|
|
9
|
|
|
use \HelperString; |
|
|
|
|
|
|
10
|
|
|
use SnTemplate; |
|
11
|
|
|
|
|
12
|
|
|
class DecodeEspionage { |
|
13
|
|
|
const ALLOWED_UNITS = [UNIT_RESOURCES, UNIT_SHIPS, UNIT_DEFENCE, UNIT_STRUCTURES, UNIT_TECHNOLOGIES]; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* @param MissionEspionageReport $missionReport |
|
17
|
|
|
*/ |
|
18
|
|
|
public static function decode($missionReport) { |
|
19
|
|
|
$lang = \SN::$lang; |
|
20
|
|
|
$general = \SN::$gc->general; |
|
21
|
|
|
|
|
22
|
|
|
$template = SnTemplate::gettemplate('msg_message_spy'); |
|
23
|
|
|
|
|
24
|
|
|
$groups = []; |
|
25
|
|
|
foreach ($missionReport->spiedUnits as $unitId => $unitAmount) { |
|
26
|
|
|
$groups[get_unit_param($unitId, P_UNIT_TYPE)][$unitId] = $unitAmount; |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
foreach(static::ALLOWED_UNITS as $groupId) { |
|
30
|
|
|
if(empty($groups[$groupId])) { |
|
31
|
|
|
continue; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
$template->assign_block_vars('group', [ |
|
35
|
|
|
'ID' => $groupId, |
|
36
|
|
|
'NAME' => $lang['tech'][$groupId], |
|
37
|
|
|
]); |
|
38
|
|
|
|
|
39
|
|
|
foreach($general->getGroupsById($groupId) as $unitId) { |
|
40
|
|
|
if((!isset($groups[$groupId][$unitId]) || floor($groups[$groupId][$unitId]) < 1) && $unitId != RES_ENERGY) { |
|
41
|
|
|
continue; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
$template->assign_block_vars('group.unit', [ |
|
45
|
|
|
'ID' => $unitId, |
|
46
|
|
|
'NAME' => $lang['tech'][$unitId], |
|
47
|
|
|
'AMOUNT' => HelperString::numberFloorAndFormat($groups[$groupId][$unitId]), |
|
48
|
|
|
]); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
$template->assign_vars([ |
|
53
|
|
|
'REPORT_TIME' => date(FMT_DATE_TIME, $missionReport->fleetTime), |
|
54
|
|
|
|
|
55
|
|
|
'TARGET_PLAYER_ID' => $missionReport->targetPlayerId, |
|
56
|
|
|
'TARGET_PLAYER_NAME' => $missionReport->targetPlayerName, |
|
57
|
|
|
'TARGET_PLAYER_ALLY_TAG' => $missionReport->targetPlayerAllyTag, |
|
58
|
|
|
|
|
59
|
|
|
'TARGET_PLANET_NAME' => $missionReport->targetPlanetName, |
|
60
|
|
|
'TARGET_PLANET_GALAXY' => $missionReport->targetPlanetGalaxy, |
|
61
|
|
|
'TARGET_PLANET_SYSTEM' => $missionReport->targetPlanetSystem, |
|
62
|
|
|
'TARGET_PLANET_PLANET' => $missionReport->targetPlanetPlanet, |
|
63
|
|
|
'TARGET_PLANET_TYPE' => $missionReport->targetPlanetPlanetType, |
|
64
|
|
|
'TARGET_PLANET_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$missionReport->targetPlanetPlanetType], |
|
65
|
|
|
|
|
66
|
|
|
'SPIES_DETECTION_CHANCE' => round($missionReport->getDetectionTrashold()), |
|
67
|
|
|
'SPIES_DESTROYED' => $missionReport->isSpyDetected(), |
|
68
|
|
|
|
|
69
|
|
|
'SIMULATOR_DATA' => $missionReport->getSimulatorLink(), |
|
70
|
|
|
]); |
|
71
|
|
|
|
|
72
|
|
|
return $template->assign_display('msg_message_spy'); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
} |
|
76
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths