@@ -133,12 +133,12 @@ discard block |
||
| 133 | 133 | * @return static |
| 134 | 134 | */ |
| 135 | 135 | public function convertToVectorDynamic($coordinates, $prefix = '') { |
| 136 | - $this->galaxy = isset($coordinates[$prefix . 'galaxy']) ? intval($coordinates[$prefix . 'galaxy']) : 0; |
|
| 137 | - $this->system = isset($coordinates[$prefix . 'system']) ? intval($coordinates[$prefix . 'system']) : 0; |
|
| 138 | - $this->planet = isset($coordinates[$prefix . 'planet']) ? intval($coordinates[$prefix . 'planet']) : 0; |
|
| 139 | - $this->type = isset($coordinates[$prefix . 'type']) |
|
| 140 | - ? isset($coordinates[$prefix . 'type']) |
|
| 141 | - : (isset($coordinates[$prefix . 'planet_type']) ? intval($coordinates[$prefix . 'planet_type']) : 0); |
|
| 136 | + $this->galaxy = isset($coordinates[$prefix.'galaxy']) ? intval($coordinates[$prefix.'galaxy']) : 0; |
|
| 137 | + $this->system = isset($coordinates[$prefix.'system']) ? intval($coordinates[$prefix.'system']) : 0; |
|
| 138 | + $this->planet = isset($coordinates[$prefix.'planet']) ? intval($coordinates[$prefix.'planet']) : 0; |
|
| 139 | + $this->type = isset($coordinates[$prefix.'type']) |
|
| 140 | + ? isset($coordinates[$prefix.'type']) |
|
| 141 | + : (isset($coordinates[$prefix.'planet_type']) ? intval($coordinates[$prefix.'planet_type']) : 0); |
|
| 142 | 142 | |
| 143 | 143 | return $this; |
| 144 | 144 | } |
@@ -150,10 +150,10 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function toArray($prefix = '') { |
| 152 | 152 | $array = array( |
| 153 | - $prefix . 'galaxy' => $this->galaxy, |
|
| 154 | - $prefix . 'system' => $this->system, |
|
| 155 | - $prefix . 'planet' => $this->planet, |
|
| 156 | - $prefix . 'type' => $this->type, |
|
| 153 | + $prefix.'galaxy' => $this->galaxy, |
|
| 154 | + $prefix.'system' => $this->system, |
|
| 155 | + $prefix.'planet' => $this->planet, |
|
| 156 | + $prefix.'type' => $this->type, |
|
| 157 | 157 | ); |
| 158 | 158 | |
| 159 | 159 | return $array; |
@@ -93,28 +93,28 @@ discard block |
||
| 93 | 93 | public function __construct(\Common\GlobalContainer $gc) { |
| 94 | 94 | parent::__construct($gc); |
| 95 | 95 | |
| 96 | - $this->accessors->set(P_CONTAINER_SET, 'dbId', function (V2FleetContainer $that, $value) { |
|
| 96 | + $this->accessors->set(P_CONTAINER_SET, 'dbId', function(V2FleetContainer $that, $value) { |
|
| 97 | 97 | $that->setDirect('dbId', $value); |
| 98 | 98 | $that->location->setLocationId($value); |
| 99 | 99 | }); |
| 100 | 100 | |
| 101 | - $this->accessors->set(P_CONTAINER_SET, 'ownerId', function (V2FleetContainer $that, $value) { |
|
| 101 | + $this->accessors->set(P_CONTAINER_SET, 'ownerId', function(V2FleetContainer $that, $value) { |
|
| 102 | 102 | $that->setDirect('ownerId', $value); |
| 103 | 103 | $that->location->setLocationPlayerId($value); |
| 104 | 104 | }); |
| 105 | 105 | |
| 106 | - $this->accessors->set(P_CONTAINER_SET, 'owner', function (V2FleetContainer $that, $value) { |
|
| 106 | + $this->accessors->set(P_CONTAINER_SET, 'owner', function(V2FleetContainer $that, $value) { |
|
| 107 | 107 | $that->owner = $value; |
| 108 | - if(isset($value['id'])) { |
|
| 108 | + if (isset($value['id'])) { |
|
| 109 | 109 | $that->ownerId = $value['id']; |
| 110 | 110 | } else { |
| 111 | 111 | $that->ownerId = 0; |
| 112 | 112 | } |
| 113 | 113 | }); |
| 114 | 114 | |
| 115 | - $this->accessors->set(P_CONTAINER_SET, 'departure', function (V2FleetContainer $that, $value) { |
|
| 115 | + $this->accessors->set(P_CONTAINER_SET, 'departure', function(V2FleetContainer $that, $value) { |
|
| 116 | 116 | $that->departure = $value; |
| 117 | - if(isset($value['id'])) { |
|
| 117 | + if (isset($value['id'])) { |
|
| 118 | 118 | $that->departurePlanetId = $value['id']; |
| 119 | 119 | $that->vectorDeparture = $value; |
| 120 | 120 | } else { |
@@ -122,20 +122,20 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | }); |
| 124 | 124 | |
| 125 | - $this->accessors->set(P_CONTAINER_GET, 'vectorDeparture', function (V2FleetContainer $that) { |
|
| 125 | + $this->accessors->set(P_CONTAINER_GET, 'vectorDeparture', function(V2FleetContainer $that) { |
|
| 126 | 126 | $vector = new Vector(); |
| 127 | 127 | $that->setDirect('vectorDeparture', $vector); |
| 128 | 128 | |
| 129 | 129 | return $vector; |
| 130 | 130 | }, ACCESSOR_SHARED); |
| 131 | - $this->accessors->set(P_CONTAINER_SET, 'vectorDeparture', function (V2FleetContainer $that, $value) { |
|
| 131 | + $this->accessors->set(P_CONTAINER_SET, 'vectorDeparture', function(V2FleetContainer $that, $value) { |
|
| 132 | 132 | $vector = $that->vectorDeparture; |
| 133 | 133 | |
| 134 | - if(is_array($value)) { |
|
| 134 | + if (is_array($value)) { |
|
| 135 | 135 | $value = Vector::convertToVector($value); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if($value instanceof Vector) { |
|
| 138 | + if ($value instanceof Vector) { |
|
| 139 | 139 | $vector->readFromVector($value); |
| 140 | 140 | } else { |
| 141 | 141 | throw new \Exception('V2Fleet::vectorDeparture setter - value is not a Vector or array!', ERR_ERROR); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $this->accessors->set(P_CONTAINER_EXPORT, 'vectorArrive', array($this, 'exportVector')); |
| 149 | 149 | |
| 150 | 150 | |
| 151 | - $this->accessors->set(P_CONTAINER_GET, 'location', function (V2FleetContainer $that) { |
|
| 151 | + $this->accessors->set(P_CONTAINER_GET, 'location', function(V2FleetContainer $that) { |
|
| 152 | 152 | // if (is_null($location = $that->getDirect('location'))) {} |
| 153 | 153 | $location = new V2Location(LOC_FLEET); |
| 154 | 154 | $that->setDirect('location', $location); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | return $location; |
| 157 | 157 | }, ACCESSOR_SHARED); |
| 158 | 158 | |
| 159 | - $this->accessors->set(P_CONTAINER_GET, 'units', function (V2FleetContainer $that) { |
|
| 159 | + $this->accessors->set(P_CONTAINER_GET, 'units', function(V2FleetContainer $that) { |
|
| 160 | 160 | // if (is_null($units = $that->getDirect('units'))) {} |
| 161 | 161 | $units = \classSupernova::$gc->unitList; |
| 162 | 162 | $that->setDirect('units', $units); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | return $units; |
| 165 | 165 | }, ACCESSOR_SHARED); |
| 166 | 166 | |
| 167 | - $this->accessors->set(P_CONTAINER_GET, 'isReturning', function (V2FleetContainer $that) { |
|
| 167 | + $this->accessors->set(P_CONTAINER_GET, 'isReturning', function(V2FleetContainer $that) { |
|
| 168 | 168 | return $that->status == FLEET_FLAG_RETURNING; |
| 169 | 169 | }); |
| 170 | 170 | |