@@ -196,6 +196,9 @@ |
||
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | + /** |
|
| 200 | + * @param V2FleetContainer $cFleet |
|
| 201 | + */ |
|
| 199 | 202 | public function dbSave($cFleet) { |
| 200 | 203 | |
| 201 | 204 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | 'isReturning' => array(), |
| 79 | 79 | )); |
| 80 | 80 | |
| 81 | - $this->accessors->setAccessor('location', P_CONTAINER_GET, function (V2FleetContainer $that) { |
|
| 81 | + $this->accessors->setAccessor('location', P_CONTAINER_GET, function(V2FleetContainer $that) { |
|
| 82 | 82 | if (is_null($location = $that->getDirect('location'))) { |
| 83 | 83 | $location = new V2Location(LOC_FLEET); |
| 84 | 84 | $that->setDirect('location', $location); |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | return $location; |
| 88 | 88 | }); |
| 89 | 89 | |
| 90 | - $this->accessors->setAccessor('dbId', P_CONTAINER_SET, function (V2FleetContainer $that, $value) { |
|
| 90 | + $this->accessors->setAccessor('dbId', P_CONTAINER_SET, function(V2FleetContainer $that, $value) { |
|
| 91 | 91 | $that->setDirect('dbId', $value); |
| 92 | 92 | $that->location->setLocationId($value); |
| 93 | 93 | }); |
| 94 | 94 | |
| 95 | - $this->accessors->setAccessor('ownerId', P_CONTAINER_SET, function (V2FleetContainer $that, $value) { |
|
| 95 | + $this->accessors->setAccessor('ownerId', P_CONTAINER_SET, function(V2FleetContainer $that, $value) { |
|
| 96 | 96 | $that->setDirect('ownerId', $value); |
| 97 | 97 | $that->location->setLocationPlayerId($value); |
| 98 | 98 | }); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $this->accessors->setAccessor('vectorArrive', P_CONTAINER_EXPORT, array($this, 'exportVector')); |
| 104 | 104 | |
| 105 | 105 | |
| 106 | - $this->accessors->setAccessor('units', P_CONTAINER_GET, function (V2FleetContainer $that) { |
|
| 106 | + $this->accessors->setAccessor('units', P_CONTAINER_GET, function(V2FleetContainer $that) { |
|
| 107 | 107 | if (is_null($units = $that->getDirect('units'))) { |
| 108 | 108 | $units = new V2UnitList(); |
| 109 | 109 | $that->setDirect('units', $units); |
@@ -112,14 +112,14 @@ discard block |
||
| 112 | 112 | return $units; |
| 113 | 113 | }); |
| 114 | 114 | |
| 115 | - $this->accessors->setAccessor('isReturning', P_CONTAINER_GET, function (V2FleetContainer $that) { |
|
| 115 | + $this->accessors->setAccessor('isReturning', P_CONTAINER_GET, function(V2FleetContainer $that) { |
|
| 116 | 116 | return $that->status == FLEET_FLAG_RETURNING; |
| 117 | 117 | }); |
| 118 | 118 | |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public function importVector(V2FleetContainer $that, $propertyName) { |
| 122 | - if($propertyName == 'vectorDeparture') { |
|
| 122 | + if ($propertyName == 'vectorDeparture') { |
|
| 123 | 123 | $that->vectorDeparture = Vector::convertToVector($that->row, FLEET_START_PREFIX); |
| 124 | 124 | } else { |
| 125 | 125 | $that->vectorArrive = Vector::convertToVector($that->row, FLEET_END_PREFIX); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | public function exportVector(V2FleetContainer $that, $propertyName) { |
| 130 | - if($propertyName == 'vectorDeparture') { |
|
| 130 | + if ($propertyName == 'vectorDeparture') { |
|
| 131 | 131 | $that->row += $that->vectorDeparture->toArray(FLEET_START_PREFIX); |
| 132 | 132 | } else { |
| 133 | 133 | $that->row += $that->vectorArrive->toArray(FLEET_END_PREFIX); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * Forcibly returns fleet before time outs |
| 163 | 163 | */ |
| 164 | 164 | public function commandReturn(V2FleetContainer $cFleet) { |
| 165 | - if($cFleet->isReturning) { |
|
| 165 | + if ($cFleet->isReturning) { |
|
| 166 | 166 | return; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $cFleet->status = FLEET_FLAG_RETURNING; |
| 171 | 171 | |
| 172 | 172 | // If fleet not yet arrived - return time is equal already fled time |
| 173 | - if($cFleet->timeArrive <= SN_TIME_NOW) { |
|
| 173 | + if ($cFleet->timeArrive <= SN_TIME_NOW) { |
|
| 174 | 174 | $returnTime = SN_TIME_NOW - $cFleet->timeDeparture; |
| 175 | 175 | } else { |
| 176 | 176 | // Arrived fleet on mission will return in same time as it takes to get to the destination |
@@ -31,6 +31,9 @@ |
||
| 31 | 31 | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | + /** |
|
| 35 | + * @param integer $snId |
|
| 36 | + */ |
|
| 34 | 37 | public function unitAdd($snId, $level) { |
| 35 | 38 | if($this->indexIsSet($snId)) { |
| 36 | 39 | $this->indexGetObject($snId)->$level += $level; |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public function unitAdd($snId, $level) { |
| 35 | - if($this->indexIsSet($snId)) { |
|
| 35 | + if ($this->indexIsSet($snId)) { |
|
| 36 | 36 | $this->indexGetObject($snId)->$level += $level; |
| 37 | 37 | } else { |
| 38 | 38 | $unit = \classSupernova::$gc->unitModel->buildContainer(); |
@@ -120,12 +120,12 @@ discard block |
||
| 120 | 120 | * @return static |
| 121 | 121 | */ |
| 122 | 122 | public static function convertToVector($coordinates, $prefix = '') { |
| 123 | - $galaxy = !empty($coordinates[$prefix . 'galaxy']) ? intval($coordinates[$prefix . 'galaxy']) : 0; |
|
| 124 | - $system = !empty($coordinates[$prefix . 'system']) ? intval($coordinates[$prefix . 'system']) : 0; |
|
| 125 | - $planet = !empty($coordinates[$prefix . 'planet']) ? intval($coordinates[$prefix . 'planet']) : 0; |
|
| 126 | - $type = !empty($coordinates[$prefix . 'type']) |
|
| 127 | - ? intval($coordinates[$prefix . 'type']) |
|
| 128 | - : (!empty($coordinates[$prefix . 'planet_type']) ? intval($coordinates[$prefix . 'planet_type']) : 0); |
|
| 123 | + $galaxy = !empty($coordinates[$prefix.'galaxy']) ? intval($coordinates[$prefix.'galaxy']) : 0; |
|
| 124 | + $system = !empty($coordinates[$prefix.'system']) ? intval($coordinates[$prefix.'system']) : 0; |
|
| 125 | + $planet = !empty($coordinates[$prefix.'planet']) ? intval($coordinates[$prefix.'planet']) : 0; |
|
| 126 | + $type = !empty($coordinates[$prefix.'type']) |
|
| 127 | + ? intval($coordinates[$prefix.'type']) |
|
| 128 | + : (!empty($coordinates[$prefix.'planet_type']) ? intval($coordinates[$prefix.'planet_type']) : 0); |
|
| 129 | 129 | |
| 130 | 130 | return new static($galaxy, $system, $planet, $type); |
| 131 | 131 | } |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function toArray($prefix = '') { |
| 139 | 139 | $array = array( |
| 140 | - $prefix . 'galaxy' => $this->galaxy, |
|
| 141 | - $prefix . 'system' => $this->system, |
|
| 142 | - $prefix . 'planet' => $this->planet, |
|
| 143 | - $prefix . 'type' => $this->type, |
|
| 140 | + $prefix.'galaxy' => $this->galaxy, |
|
| 141 | + $prefix.'system' => $this->system, |
|
| 142 | + $prefix.'planet' => $this->planet, |
|
| 143 | + $prefix.'type' => $this->type, |
|
| 144 | 144 | ); |
| 145 | 145 | |
| 146 | 146 | return $array; |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 3 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 4 | 4 | |
| 5 | 5 | $template = gettemplate('viewreport', true); |
| 6 | 6 | $template->assign_var('PAGE_HINT', classLocale::$lang['cr_view_hint']); |