@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | return $this->eventScripts[$whichScript]; |
105 | 105 | } |
106 | 106 | /// @brief Gets the thumbnail of this agent as would be shown in the Injector |
107 | - /** @return A SpriteFrame of the thumbnail |
|
107 | + /** @return SpriteFrame SpriteFrame of the thumbnail |
|
108 | 108 | */ |
109 | 109 | public function GetThumbnail() { |
110 | 110 | return $this->thumbnail; |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | /// @endcond |
381 | 381 | |
382 | 382 | /// @brief Creates a new COBDependency |
383 | - /** @param $type The type of dependency ('sprite' or 'sound'). |
|
383 | + /** @param string $type The type of dependency ('sprite' or 'sound'). |
|
384 | 384 | * @param $name The name of the dependency (four characters, no file extension) |
385 | 385 | */ |
386 | 386 | public function COBDependency($type,$name) { |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | */ |
13 | 13 | //@{ |
14 | 14 | /** Sprite dependency - 'sprite' */ |
15 | -define('DEPENDENCY_SPRITE','sprite'); |
|
15 | +define('DEPENDENCY_SPRITE', 'sprite'); |
|
16 | 16 | /** Sound dependency - 'sound' */ |
17 | -define('DEPENDENCY_SOUND','sound'); |
|
17 | +define('DEPENDENCY_SOUND', 'sound'); |
|
18 | 18 | //@} |
19 | 19 | |
20 | 20 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param $agentName The name of the agent (as displayed in the C2 injector) |
55 | 55 | * @param $agentDescription The description of the agent (as displayed in the C2 injector) |
56 | 56 | */ |
57 | - public function COBAgentBlock($agentName,$agentDescription) { |
|
57 | + public function COBAgentBlock($agentName, $agentDescription) { |
|
58 | 58 | parent::COBBlock(COB_BLOCK_AGENT); |
59 | 59 | $this->agentName = $agentName; |
60 | 60 | $this->agentDescription = $agentDescription; |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | * above. |
116 | 116 | * @return An array of COBDependency objects |
117 | 117 | */ |
118 | - public function GetDependencies($type=null) { |
|
118 | + public function GetDependencies($type = null) { |
|
119 | 119 | $dependenciesToReturn = array(); |
120 | - foreach($this->dependencies as $dependency) { |
|
121 | - if($type == null || $type == $dependency->GetType()) { |
|
120 | + foreach ($this->dependencies as $dependency) { |
|
121 | + if ($type == null || $type == $dependency->GetType()) { |
|
122 | 122 | $dependenciesToReturn[] = $dependency; |
123 | 123 | } |
124 | 124 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @param $dependency The COBDependency to add. |
154 | 154 | */ |
155 | 155 | public function AddDependency(COBDependency $dependency) { |
156 | - if(!in_array($dependency->GetDependencyName(),$this->dependencies)) { |
|
156 | + if (!in_array($dependency->GetDependencyName(), $this->dependencies)) { |
|
157 | 157 | $this->dependencies[] = $dependency; |
158 | 158 | } |
159 | 159 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @param $time The date this agent was last injected as a UNIX timestamp |
184 | 184 | */ |
185 | 185 | public function SetLastUsageDate($time) { |
186 | - if($time > time()) { |
|
186 | + if ($time > time()) { |
|
187 | 187 | return false; |
188 | 188 | } else { |
189 | 189 | $this->lastUsageDate = $time; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @param $reserved2 The second reserved variable |
218 | 218 | * @param $reserved3 The third reserved variable |
219 | 219 | */ |
220 | - public function SetReserved($reserved1,$reserved2,$reserved3) { |
|
220 | + public function SetReserved($reserved1, $reserved2, $reserved3) { |
|
221 | 221 | $this->reserved1 = $reserved1; |
222 | 222 | $this->reserved2 = $reserved2; |
223 | 223 | $this->reserved3 = $reserved3; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | /** @param $frame The thumbnail as a SpriteFrame |
227 | 227 | */ |
228 | 228 | public function SetThumbnail(SpriteFrame $frame) { |
229 | - if($this->thumbnail != null) { |
|
229 | + if ($this->thumbnail != null) { |
|
230 | 230 | throw new Exception('Thumbnail already added'); |
231 | 231 | } |
232 | 232 | $this->thumbnail = $frame; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @param IReader $reader A StringReader or FileReader for the RCB |
238 | 238 | */ |
239 | 239 | public function AddC1RemoveScriptFromRCB(IReader $reader) { |
240 | - if($this->removeScript != '') { |
|
240 | + if ($this->removeScript != '') { |
|
241 | 241 | throw new Exception('Script already added!'); |
242 | 242 | } |
243 | 243 | $rcb = new COB($reader); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public static function CreateFromReaderC2(IReader $reader) { |
255 | 255 | $quantityAvailable = $reader->ReadInt(2); |
256 | - if($quantityAvailable == 0xffff) { |
|
256 | + if ($quantityAvailable == 0xffff) { |
|
257 | 257 | $quantityAvailable = -1; |
258 | 258 | } |
259 | 259 | $lastUsageDate = $reader->ReadInt(4); |
@@ -262,50 +262,50 @@ discard block |
||
262 | 262 | $expiryDay = $reader->ReadInt(1); |
263 | 263 | $expiryMonth = $reader->ReadInt(1); |
264 | 264 | $expiryYear = $reader->ReadInt(2); |
265 | - $expiryDate = mktime(0,0,0,$expiryMonth,$expiryDay,$expiryYear); |
|
265 | + $expiryDate = mktime(0, 0, 0, $expiryMonth, $expiryDay, $expiryYear); |
|
266 | 266 | |
267 | - $reserved = array($reader->ReadInt(4),$reader->ReadInt(4),$reader->ReadInt(4)); |
|
267 | + $reserved = array($reader->ReadInt(4), $reader->ReadInt(4), $reader->ReadInt(4)); |
|
268 | 268 | |
269 | 269 | $agentName = $reader->ReadCString(); |
270 | 270 | $agentDescription = $reader->ReadCString(); |
271 | 271 | |
272 | - $installScript = str_replace(',',"\n",$reader->ReadCString()); |
|
273 | - $removeScript = str_replace(',',"\n",$reader->ReadCString()); |
|
272 | + $installScript = str_replace(',', "\n", $reader->ReadCString()); |
|
273 | + $removeScript = str_replace(',', "\n", $reader->ReadCString()); |
|
274 | 274 | |
275 | 275 | $numEventScripts = $reader->ReadInt(2); |
276 | 276 | |
277 | 277 | $eventScripts = array(); |
278 | 278 | |
279 | - for($i=0;$i<$numEventScripts;$i++) { |
|
280 | - $eventScripts[] = str_replace(',',"\n",$reader->ReadCString()); |
|
279 | + for ($i = 0; $i < $numEventScripts; $i++) { |
|
280 | + $eventScripts[] = str_replace(',', "\n", $reader->ReadCString()); |
|
281 | 281 | } |
282 | 282 | $numDependencies = $reader->ReadInt(2); |
283 | 283 | $dependencies = array(); |
284 | 284 | |
285 | - for($i=0;$i<$numDependencies;$i++) { |
|
286 | - $type = ($reader->ReadInt(2) == 0)?DEPENDENCY_SPRITE:DEPENDENCY_SOUND; |
|
285 | + for ($i = 0; $i < $numDependencies; $i++) { |
|
286 | + $type = ($reader->ReadInt(2) == 0) ? DEPENDENCY_SPRITE : DEPENDENCY_SOUND; |
|
287 | 287 | $name = $reader->ReadCString(); |
288 | - $dependencies[] = new COBDependency($type,$name); |
|
288 | + $dependencies[] = new COBDependency($type, $name); |
|
289 | 289 | } |
290 | 290 | $thumbWidth = $reader->ReadInt(2); |
291 | 291 | $thumbHeight = $reader->ReadInt(2); |
292 | 292 | |
293 | - $thumbnail = new S16Frame($reader,'565',$thumbWidth,$thumbHeight,$reader->GetPosition()); |
|
293 | + $thumbnail = new S16Frame($reader, '565', $thumbWidth, $thumbHeight, $reader->GetPosition()); |
|
294 | 294 | $reader->Skip($thumbHeight*$thumbWidth*2); |
295 | 295 | |
296 | 296 | //parsing finished, onto making an AgentBlock. |
297 | - $agentBlock = new COBAgentBlock($agentName,$agentDescription); |
|
297 | + $agentBlock = new COBAgentBlock($agentName, $agentDescription); |
|
298 | 298 | $agentBlock->AddQuantityAvailable($quantityAvailable); |
299 | 299 | $agentBlock->AddReuseInterval($reuseInterval); |
300 | 300 | $agentBlock->AddExpiryDate($expiryDate); |
301 | 301 | $agentBlock->AddLastUsageDate($lastUsageDate); |
302 | - $agentBlock->AddReserved($reserved[0],$reserved[1],$reserved[2]); |
|
302 | + $agentBlock->AddReserved($reserved[0], $reserved[1], $reserved[2]); |
|
303 | 303 | $agentBlock->AddInstallScript($installScript); |
304 | 304 | $agentBlock->AddRemoveScript($removeScript); |
305 | - foreach($eventScripts as $eventScript) { |
|
305 | + foreach ($eventScripts as $eventScript) { |
|
306 | 306 | $agentBlock->AddEventScript($eventScript); |
307 | 307 | } |
308 | - foreach($dependencies as $dependency) { |
|
308 | + foreach ($dependencies as $dependency) { |
|
309 | 309 | $agentBlock->AddDependency($dependency); |
310 | 310 | } |
311 | 311 | $agentBlock->AddThumbnail($thumbnail); |
@@ -319,27 +319,27 @@ discard block |
||
319 | 319 | * |
320 | 320 | */ |
321 | 321 | public static function CreateFromReaderC1(IReader $reader) { |
322 | - $quantityAvailable = $reader->ReadInt(2); |
|
322 | + $quantityAvailable = $reader->ReadInt(2); |
|
323 | 323 | $expires_month = $reader->ReadInt(4); |
324 | 324 | $expires_day = $reader->ReadInt(4); |
325 | 325 | $expires_year = $reader->ReadInt(4); |
326 | - $expiryDate = mktime(0,0,0,$expires_month,$expires_day,$expires_year); |
|
326 | + $expiryDate = mktime(0, 0, 0, $expires_month, $expires_day, $expires_year); |
|
327 | 327 | |
328 | 328 | $numObjectScripts = $reader->ReadInt(2); |
329 | 329 | $numInstallScripts = $reader->ReadInt(2); |
330 | 330 | $quantityUsed = $reader->ReadInt(4); |
331 | 331 | $objectScripts = array(); |
332 | - for($i=0;$i<$numObjectScripts;$i++) { |
|
332 | + for ($i = 0; $i < $numObjectScripts; $i++) { |
|
333 | 333 | $scriptsize = $reader->ReadInt(1); |
334 | - if($scriptsize == 255) { |
|
334 | + if ($scriptsize == 255) { |
|
335 | 335 | $scriptsize = $reader->ReadInt(2); |
336 | 336 | } |
337 | 337 | $objectScripts[$i] = $reader->Read($scriptsize); |
338 | 338 | } |
339 | 339 | $installScripts = array(); |
340 | - for($i=0;$i<$numInstallScripts;$i++) { |
|
340 | + for ($i = 0; $i < $numInstallScripts; $i++) { |
|
341 | 341 | $scriptsize = $reader->ReadInt(1); |
342 | - if($scriptsize == 255) { |
|
342 | + if ($scriptsize == 255) { |
|
343 | 343 | $scriptsize = $reader->ReadInt(2); |
344 | 344 | } |
345 | 345 | $installScripts[$i] = $reader->Read($scriptsize); |
@@ -348,23 +348,23 @@ discard block |
||
348 | 348 | $pictureHeight = $reader->ReadInt(4); |
349 | 349 | $unknown = $reader->ReadInt(2); |
350 | 350 | $sprframe = null; |
351 | - if($pictureWidth > 0 || $pictureHeight > 0) { |
|
352 | - $sprframe = new SPRFrame($reader,$pictureWidth,$pictureHeight); |
|
351 | + if ($pictureWidth > 0 || $pictureHeight > 0) { |
|
352 | + $sprframe = new SPRFrame($reader, $pictureWidth, $pictureHeight); |
|
353 | 353 | $sprframe->Flip(); |
354 | 354 | } |
355 | 355 | |
356 | 356 | $agentName = $reader->Read($reader->ReadInt(1)); |
357 | 357 | |
358 | - $agentBlock = new COBAgentBlock($agentName,''); |
|
358 | + $agentBlock = new COBAgentBlock($agentName, ''); |
|
359 | 359 | $agentBlock->AddQuantityAvailable($quantityAvailable); |
360 | 360 | $agentBlock->AddExpiryDate($expiryDate); |
361 | - if($sprframe != null) { |
|
361 | + if ($sprframe != null) { |
|
362 | 362 | $agentBlock->AddThumbnail($sprframe); |
363 | 363 | } |
364 | - foreach($objectScripts as $objectScript) { |
|
364 | + foreach ($objectScripts as $objectScript) { |
|
365 | 365 | $agentBlock->AddEventScript($objectScript); |
366 | 366 | } |
367 | - $agentBlock->AddInstallScript(implode("\n*c2ephp Install script seperator\n",$installScripts)); |
|
367 | + $agentBlock->AddInstallScript(implode("\n*c2ephp Install script seperator\n", $installScripts)); |
|
368 | 368 | return $agentBlock; |
369 | 369 | } |
370 | 370 | /// @endcond |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | /** @param $type The type of dependency ('sprite' or 'sound'). |
384 | 384 | * @param $name The name of the dependency (four characters, no file extension) |
385 | 385 | */ |
386 | - public function COBDependency($type,$name) { |
|
386 | + public function COBDependency($type, $name) { |
|
387 | 387 | $this->type = $type; |
388 | 388 | $this->name = $name; |
389 | 389 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | /// @brief Constructs a new COBFileBlock |
18 | 18 | /** |
19 | - * @param $type The file type |
|
19 | + * @param string $type The file type |
|
20 | 20 | * @param $name The file name (including extension) |
21 | 21 | * @param $contents The contents of the file |
22 | 22 | */ |
@@ -6,38 +6,38 @@ discard block |
||
6 | 6 | |
7 | 7 | /// @cond INTERNAL_DOCS |
8 | 8 | // |
9 | - private $fileType; |
|
10 | - private $fileName; |
|
9 | + private $fileType; |
|
10 | + private $fileName; |
|
11 | 11 | |
12 | - private $reserved; |
|
12 | + private $reserved; |
|
13 | 13 | private $contents; |
14 | 14 | |
15 | 15 | /// @endcond |
16 | 16 | |
17 | - /// @brief Constructs a new COBFileBlock |
|
17 | + /// @brief Constructs a new COBFileBlock |
|
18 | 18 | /** |
19 | 19 | * @param $type The file type |
20 | - * @param $name The file name (including extension) |
|
21 | - * @param $contents The contents of the file |
|
22 | - */ |
|
23 | - public function COBFileBlock($type,$name,$contents) { |
|
24 | - parent::COBBlock(COB_BLOCK_FILE); |
|
25 | - $this->fileType = $type; |
|
26 | - $this->fileName = $name; |
|
27 | - $this->contents = $contents; |
|
20 | + * @param $name The file name (including extension) |
|
21 | + * @param $contents The contents of the file |
|
22 | + */ |
|
23 | + public function COBFileBlock($type,$name,$contents) { |
|
24 | + parent::COBBlock(COB_BLOCK_FILE); |
|
25 | + $this->fileType = $type; |
|
26 | + $this->fileName = $name; |
|
27 | + $this->contents = $contents; |
|
28 | 28 | } |
29 | 29 | |
30 | - /// @brief Add the reserved data associated with this file block |
|
30 | + /// @brief Add the reserved data associated with this file block |
|
31 | 31 | /** |
32 | 32 | * @param $reserved The reserved data |
33 | - */ |
|
34 | - public function AddReserved($reserved) { |
|
35 | - $this->reserved = $reserved; |
|
33 | + */ |
|
34 | + public function AddReserved($reserved) { |
|
35 | + $this->reserved = $reserved; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /// @brief Get the name of the file |
39 | - public function GetName() { |
|
40 | - return $this->fileName; |
|
39 | + public function GetName() { |
|
40 | + return $this->fileName; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /// @brief Get the file's type |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | * @return 'sprite' or 'sound' - i.e. one of the |
46 | 46 | * COB_DEPENDENCY_* constants in COBAgentBlock |
47 | 47 | */ |
48 | - public function GetFileType() { |
|
49 | - return $this->fileType; |
|
48 | + public function GetFileType() { |
|
49 | + return $this->fileType; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /// @brief Get the contents of the file. |
53 | - public function GetContents() { |
|
54 | - return $this->contents; |
|
53 | + public function GetContents() { |
|
54 | + return $this->contents; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /// @brief Get the reserved data |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | * Reserved data was never officially used. |
60 | 60 | * @return A 4-byte integer. |
61 | 61 | */ |
62 | - public function GetReserved() { |
|
63 | - return $this->reserved; |
|
62 | + public function GetReserved() { |
|
63 | + return $this->reserved; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /// @cond INTERNAL_DOCS |
@@ -68,16 +68,16 @@ discard block |
||
68 | 68 | /// @brief Creates a new COBFileBlock from an IReader |
69 | 69 | /** |
70 | 70 | * @param $reader The reader the data's coming from |
71 | - */ |
|
72 | - public static function CreateFromReader(IReader $reader) { |
|
73 | - $type = ($reader->ReadInt(2)==0)?'sprite':'sound'; |
|
74 | - $reserved = $reader->ReadInt(4); |
|
75 | - $size = $reader->ReadInt(4); |
|
76 | - $fileName = $reader->ReadCString(); |
|
77 | - $contents = $reader->Read($size); |
|
78 | - $block = new COBFileBlock($type,$fileName,$contents); |
|
79 | - $block->AddReserved($reserved); |
|
80 | - return $block; |
|
71 | + */ |
|
72 | + public static function CreateFromReader(IReader $reader) { |
|
73 | + $type = ($reader->ReadInt(2)==0)?'sprite':'sound'; |
|
74 | + $reserved = $reader->ReadInt(4); |
|
75 | + $size = $reader->ReadInt(4); |
|
76 | + $fileName = $reader->ReadCString(); |
|
77 | + $contents = $reader->Read($size); |
|
78 | + $block = new COBFileBlock($type,$fileName,$contents); |
|
79 | + $block->AddReserved($reserved); |
|
80 | + return $block; |
|
81 | 81 | } |
82 | 82 | /// @endcond |
83 | 83 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param $name The file name (including extension) |
21 | 21 | * @param $contents The contents of the file |
22 | 22 | */ |
23 | - public function COBFileBlock($type,$name,$contents) { |
|
23 | + public function COBFileBlock($type, $name, $contents) { |
|
24 | 24 | parent::COBBlock(COB_BLOCK_FILE); |
25 | 25 | $this->fileType = $type; |
26 | 26 | $this->fileName = $name; |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | * @param $reader The reader the data's coming from |
71 | 71 | */ |
72 | 72 | public static function CreateFromReader(IReader $reader) { |
73 | - $type = ($reader->ReadInt(2)==0)?'sprite':'sound'; |
|
73 | + $type = ($reader->ReadInt(2) == 0) ? 'sprite' : 'sound'; |
|
74 | 74 | $reserved = $reader->ReadInt(4); |
75 | 75 | $size = $reader->ReadInt(4); |
76 | 76 | $fileName = $reader->ReadCString(); |
77 | 77 | $contents = $reader->Read($size); |
78 | - $block = new COBFileBlock($type,$fileName,$contents); |
|
78 | + $block = new COBFileBlock($type, $fileName, $contents); |
|
79 | 79 | $block->AddReserved($reserved); |
80 | 80 | return $block; |
81 | 81 | } |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | |
44 | 44 | /// @brief Construct a CreatureHistory object. |
45 | 45 | /** |
46 | - * @param $moniker The moniker of the creature |
|
47 | - * @param $name The creature's name |
|
46 | + * @param false|string $moniker The moniker of the creature |
|
47 | + * @param false|string $name The creature's name |
|
48 | 48 | * @param $gender The creature's gender |
49 | 49 | * @param $genus The creature's genus (Grendel, ettin, norn, geat) |
50 | 50 | * @param $species The creature's species (unsure of purpose) |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | /// @brief Compiles the CreatureHistory into CreaturesArchive data. |
61 | 61 | /** |
62 | 62 | * @param $format GLST_FORMAT_C3 or GLST_FORMAT_DS. |
63 | - * @return A binary string ready for archiving and putting in a GLST block. |
|
63 | + * @return string binary string ready for archiving and putting in a GLST block. |
|
64 | 64 | */ |
65 | 65 | public function Compile($format=GLST_FORMAT_C3) { |
66 | 66 | $data = ''; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * This is done by working out whether any DS-specific variables |
95 | 95 | * are set. |
96 | - * @return GLST_FORMAT_DS or GLST_FORMAT_C3. |
|
96 | + * @return integer or GLST_FORMAT_C3. |
|
97 | 97 | */ |
98 | 98 | public function GuessFormat() { |
99 | 99 | return (isset($this->unknown1))?GLST_FORMAT_DS:GLST_FORMAT_C3; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | /** |
113 | 113 | * Simply gets the nth event that happened in this history |
114 | 114 | * @param $n the event number to get |
115 | - * @return the $nth CreatureHistoryEvent |
|
115 | + * @return CreatureHistoryEvent $nth CreatureHistoryEvent |
|
116 | 116 | */ |
117 | 117 | public function GetEvent($n) { |
118 | 118 | return $this->events[$n]; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | /// Gets all the events in this history |
155 | 155 | /** |
156 | - * @return An array of CreatureHistoryEvents |
|
156 | + * @return CreatureHistoryEvent[] array of CreatureHistoryEvents |
|
157 | 157 | */ |
158 | 158 | public function GetEvents() { |
159 | 159 | return $this->events; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | /** |
230 | 230 | * This calls SetC3Unknown |
231 | 231 | * @param $unknown1 First unknown variable |
232 | - * @param $unknown2 Second unknown variable |
|
232 | + * @param false|string $unknown2 Second unknown variable |
|
233 | 233 | */ |
234 | 234 | public function SetDSUnknowns($unknown1,$unknown2) { |
235 | 235 | $this->unknown1 = $unknown1; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | |
239 | 239 | /// @brief Sets whether or not the creature is a veteran of the warp (DS only) |
240 | 240 | /** |
241 | - * @param $warpveteran A boolean (I think!) |
|
241 | + * @param integer $warpveteran A boolean (I think!) |
|
242 | 242 | */ |
243 | 243 | public function SetWarpVeteran($warpveteran) { |
244 | 244 | $this->warpveteran = $warpveteran; |
@@ -124,7 +124,7 @@ |
||
124 | 124 | * @param $n the event number to remove |
125 | 125 | */ |
126 | 126 | public function RemoveEvent($n) { |
127 | - unset($this->events[$n]); |
|
127 | + unset($this->events[$n]); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /// @brief Counts the events in the history |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | */ |
11 | 11 | ///@{ |
12 | 12 | /** Value: 1 */ |
13 | -define('CREATUREHISTORY_GENDER_MALE',1); |
|
13 | +define('CREATUREHISTORY_GENDER_MALE', 1); |
|
14 | 14 | |
15 | 15 | /** Value: 2 */ |
16 | -define('CREATUREHISTORY_GENDER_FEMALE',2); |
|
16 | +define('CREATUREHISTORY_GENDER_FEMALE', 2); |
|
17 | 17 | ///@} |
18 | 18 | |
19 | 19 | /// @brief Class representing a creature's history. |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param $genus The creature's genus (Grendel, ettin, norn, geat) |
50 | 50 | * @param $species The creature's species (unsure of purpose) |
51 | 51 | */ |
52 | - public function CreatureHistory($moniker,$name,$gender,$genus,$species) { |
|
52 | + public function CreatureHistory($moniker, $name, $gender, $genus, $species) { |
|
53 | 53 | $this->moniker = $moniker; |
54 | 54 | $this->name = $name; |
55 | 55 | $this->gender = $gender; |
@@ -62,29 +62,29 @@ discard block |
||
62 | 62 | * @param $format GLST_FORMAT_C3 or GLST_FORMAT_DS. |
63 | 63 | * @return A binary string ready for archiving and putting in a GLST block. |
64 | 64 | */ |
65 | - public function Compile($format=GLST_FORMAT_C3) { |
|
65 | + public function Compile($format = GLST_FORMAT_C3) { |
|
66 | 66 | $data = ''; |
67 | - if($format != GLST_FORMAT_C3 && $format != GLST_FORMAT_DS) { |
|
67 | + if ($format != GLST_FORMAT_C3 && $format != GLST_FORMAT_DS) { |
|
68 | 68 | $format = $this->GuessFormat(); |
69 | 69 | } |
70 | - if($format == GLST_FORMAT_DS) { |
|
71 | - $data = pack('V',0x27); |
|
70 | + if ($format == GLST_FORMAT_DS) { |
|
71 | + $data = pack('V', 0x27); |
|
72 | 72 | } else { |
73 | - $data = pack('V',0x0C); |
|
73 | + $data = pack('V', 0x0C); |
|
74 | 74 | } |
75 | - $data .= pack('V',1); |
|
76 | - $data .= pack('V',32).$this->moniker; |
|
77 | - $data .= pack('V',32).$this->moniker; //yeah, twice. Dunno why, CL are bonkers. |
|
78 | - $data .= pack('V',strlen($this->name)).$this->name; |
|
79 | - $data .= pack('VVVV',$this->gender,$this->genus,$this->species,count($this->events)); |
|
80 | - foreach($this->events as $event) { |
|
75 | + $data .= pack('V', 1); |
|
76 | + $data .= pack('V', 32).$this->moniker; |
|
77 | + $data .= pack('V', 32).$this->moniker; //yeah, twice. Dunno why, CL are bonkers. |
|
78 | + $data .= pack('V', strlen($this->name)).$this->name; |
|
79 | + $data .= pack('VVVV', $this->gender, $this->genus, $this->species, count($this->events)); |
|
80 | + foreach ($this->events as $event) { |
|
81 | 81 | $data .= $event->Compile($format); |
82 | 82 | } |
83 | - $data .= pack('V',$this->mutations); |
|
84 | - $data .= pack('V',$this->crossoverpoints); |
|
85 | - if($format == GLST_FORMAT_DS) { |
|
86 | - $data .= pack('V',$this->unknown1); |
|
87 | - $data .= pack('V',strlen($this->unknown2)).$this->unknown2; |
|
83 | + $data .= pack('V', $this->mutations); |
|
84 | + $data .= pack('V', $this->crossoverpoints); |
|
85 | + if ($format == GLST_FORMAT_DS) { |
|
86 | + $data .= pack('V', $this->unknown1); |
|
87 | + $data .= pack('V', strlen($this->unknown2)).$this->unknown2; |
|
88 | 88 | } |
89 | 89 | return $data; |
90 | 90 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return GLST_FORMAT_DS or GLST_FORMAT_C3. |
97 | 97 | */ |
98 | 98 | public function GuessFormat() { |
99 | - return (isset($this->unknown1))?GLST_FORMAT_DS:GLST_FORMAT_C3; |
|
99 | + return (isset($this->unknown1)) ? GLST_FORMAT_DS : GLST_FORMAT_C3; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /// @brief Adds an event to the end of a history. |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function GetEventsByType($type) { |
145 | 145 | $matchingEvents = array(); |
146 | - foreach($this->events as $event) { |
|
147 | - if($event->GetEventType() == $type) { |
|
146 | + foreach ($this->events as $event) { |
|
147 | + if ($event->GetEventType() == $type) { |
|
148 | 148 | $matchingEvents[] = $event; |
149 | 149 | } |
150 | 150 | } |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | * @return 0 for failure, the generation of the creature otherwise. |
173 | 173 | */ |
174 | 174 | public function GetCreatureGenerationNumber() { |
175 | - if($pos = strpos('_',$this->moniker) == -1) { |
|
175 | + if ($pos = strpos('_', $this->moniker) == -1) { |
|
176 | 176 | return 0; |
177 | 177 | } else { |
178 | - $firstbit = substr($this->moniker,0,$pos); |
|
179 | - if(is_numeric($firstbit)) { |
|
178 | + $firstbit = substr($this->moniker, 0, $pos); |
|
179 | + if (is_numeric($firstbit)) { |
|
180 | 180 | return $firstbit+0; |
181 | 181 | } |
182 | 182 | return 0; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | return $this->crossoverpoints; |
219 | 219 | } |
220 | 220 | |
221 | - public function SetMutationsAndCrossovers($mutations,$crossovers) { |
|
221 | + public function SetMutationsAndCrossovers($mutations, $crossovers) { |
|
222 | 222 | $this->mutations = $mutations; |
223 | 223 | $this->crossoverpoints = $crossovers; |
224 | 224 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @param $unknown1 First unknown variable |
232 | 232 | * @param $unknown2 Second unknown variable |
233 | 233 | */ |
234 | - public function SetDSUnknowns($unknown1,$unknown2) { |
|
234 | + public function SetDSUnknowns($unknown1, $unknown2) { |
|
235 | 235 | $this->unknown1 = $unknown1; |
236 | 236 | $this->unknown2 = $unknown2; |
237 | 237 | } |
@@ -158,7 +158,7 @@ |
||
158 | 158 | * This is called automatically by CreatureHistory, most users |
159 | 159 | * should have no need to use this function themselves. |
160 | 160 | * @param $format Which game to compile it for (a GLST_FORMAT_* constant) |
161 | - * @return A binary string containing GLST data ready to be put into a GLST history. |
|
161 | + * @return string binary string containing GLST data ready to be put into a GLST history. |
|
162 | 162 | */ |
163 | 163 | public function Compile($format) { |
164 | 164 | $data = pack('VVVVV',$this->eventtype,$this->worldtime,$this->creatureage,$this->timestamp,$this->lifestage); |
@@ -15,68 +15,68 @@ discard block |
||
15 | 15 | //@{ |
16 | 16 | /** I was conceived by kisspopping or artificial insemination. \n |
17 | 17 | * Value: 0 */ |
18 | -define('CREATUREHISTORY_EVENT_CONCEIVED',0); |
|
18 | +define('CREATUREHISTORY_EVENT_CONCEIVED', 0); |
|
19 | 19 | /** I was spliced from two other creatures \n |
20 | 20 | * Value: 1 */ |
21 | -define('CREATUREHISTORY_EVENT_SPLICED',1); |
|
21 | +define('CREATUREHISTORY_EVENT_SPLICED', 1); |
|
22 | 22 | /** I was created by someone with a genetics kit \n |
23 | 23 | * Value: 2 */ |
24 | -define('CREATUREHISTORY_EVENT_ENGINEERED',2); |
|
24 | +define('CREATUREHISTORY_EVENT_ENGINEERED', 2); |
|
25 | 25 | /** I hatched out of my egg. \n |
26 | 26 | * Value: 3 */ |
27 | -define('CREATUREHISTORY_EVENT_HATCHED',3); |
|
27 | +define('CREATUREHISTORY_EVENT_HATCHED', 3); |
|
28 | 28 | /** |
29 | 29 | * CreatureHistoryEvent::GetLifestage will tell you what lifestage I |
30 | 30 | * am now. \n\n |
31 | 31 | * Value: 4 |
32 | 32 | */ |
33 | -define('CREATUREHISTORY_EVENT_AGED',4); |
|
33 | +define('CREATUREHISTORY_EVENT_AGED', 4); |
|
34 | 34 | /** I was exported from this world \n |
35 | 35 | * Value: 5 */ |
36 | -define('CREATUREHISTORY_EVENT_EXPORTED',5); |
|
36 | +define('CREATUREHISTORY_EVENT_EXPORTED', 5); |
|
37 | 37 | /** I joined this world \n |
38 | 38 | * Value: 6 */ |
39 | -define('CREATUREHISTORY_EVENT_IMPORTED',6); |
|
39 | +define('CREATUREHISTORY_EVENT_IMPORTED', 6); |
|
40 | 40 | /** My journey through life ended. \n |
41 | 41 | * Value: 7 */ |
42 | -define('CREATUREHISTORY_EVENT_DIED',7); |
|
42 | +define('CREATUREHISTORY_EVENT_DIED', 7); |
|
43 | 43 | /** I became pregnant. \n |
44 | 44 | * Value: 8 */ |
45 | -define('CREATUREHISTORY_EVENT_BECAMEPREGNANT',8); |
|
45 | +define('CREATUREHISTORY_EVENT_BECAMEPREGNANT', 8); |
|
46 | 46 | /** I made someone else pregnant. \n |
47 | 47 | * Value: 9 */ |
48 | -define('CREATUREHISTORY_EVENT_IMPREGNATED',9); |
|
48 | +define('CREATUREHISTORY_EVENT_IMPREGNATED', 9); |
|
49 | 49 | /** My child hatched from its egg! \n |
50 | 50 | * Value: 10 */ |
51 | -define('CREATUREHISTORY_EVENT_CHILDBORN',10); |
|
51 | +define('CREATUREHISTORY_EVENT_CHILDBORN', 10); |
|
52 | 52 | /** My mum laid my egg. \n |
53 | 53 | * Value: 11 */ |
54 | -define('CREATUREHISTORY_EVENT_MUMLAIDMYEGG',11); |
|
54 | +define('CREATUREHISTORY_EVENT_MUMLAIDMYEGG', 11); |
|
55 | 55 | /** I laid an egg I was carrying. \n |
56 | 56 | * Value: 12 */ |
57 | -define('CREATUREHISTORY_EVENT_LAIDEGG',12); |
|
57 | +define('CREATUREHISTORY_EVENT_LAIDEGG', 12); |
|
58 | 58 | /** A photo was taken of me. \n |
59 | 59 | * Value: 13 */ |
60 | -define('CREATUREHISTORY_EVENT_PHOTOTAKEN',13); |
|
60 | +define('CREATUREHISTORY_EVENT_PHOTOTAKEN', 13); |
|
61 | 61 | /** |
62 | 62 | * I was made by cloning another creature \n |
63 | 63 | * This happens when you export a creature then import it more than |
64 | 64 | * once. \n |
65 | 65 | * Value: 14 |
66 | 66 | */ |
67 | -define('CREATUREHISTORY_EVENT_IAMCLONED',14); |
|
67 | +define('CREATUREHISTORY_EVENT_IAMCLONED', 14); |
|
68 | 68 | /** Another creature was made by cloning me. \n |
69 | 69 | * This happens when you export a creature then import it more than |
70 | 70 | * once. \n |
71 | 71 | * Value: 15 |
72 | 72 | */ |
73 | -define('CREATUREHISTORY_EVENT_CLONEDME',15); |
|
73 | +define('CREATUREHISTORY_EVENT_CLONEDME', 15); |
|
74 | 74 | /** I left this world through the warp \n |
75 | 75 | * Value: 16 */ |
76 | -define('CREATUREHISTORY_EVENT_WARPEDOUT',16); |
|
76 | +define('CREATUREHISTORY_EVENT_WARPEDOUT', 16); |
|
77 | 77 | /** I entered this world through the warp \n |
78 | 78 | * Value: 17 */ |
79 | -define('CREATUREHISTORY_EVENT_WARPEDIN',17); |
|
79 | +define('CREATUREHISTORY_EVENT_WARPEDIN', 17); |
|
80 | 80 | //@} |
81 | 81 | |
82 | 82 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param $worldname The name of the world the creature was inhabiting at the time of this event |
127 | 127 | * @param $worldUID The UID of the world the creature was inhabiting at the the time of this event |
128 | 128 | */ |
129 | - public function CreatureHistoryEvent($eventtype,$worldtime,$creatureage,$timestamp,$lifestage,$moniker1,$moniker2,$usertext,$photograph,$worldname,$worldUID) { |
|
129 | + public function CreatureHistoryEvent($eventtype, $worldtime, $creatureage, $timestamp, $lifestage, $moniker1, $moniker2, $usertext, $photograph, $worldname, $worldUID) { |
|
130 | 130 | $this->eventtype = $eventtype; |
131 | 131 | $this->worldtime = $worldtime; |
132 | 132 | $this->creatureage = $creatureage; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param $unknown1 I don't know! But it comes right after the DSUID in the GLST format. |
147 | 147 | * @param $unknown2 I don't know! But it comes right after unknown1. |
148 | 148 | */ |
149 | - public function AddDSInfo($DSUserID,$unknown1,$unknown2) { |
|
149 | + public function AddDSInfo($DSUserID, $unknown1, $unknown2) { |
|
150 | 150 | $this->dockingstationuser = $DSUserID; |
151 | 151 | $this->unknown1 = $unknown1; |
152 | 152 | $this->unknown2 = $unknown2; |
@@ -161,16 +161,16 @@ discard block |
||
161 | 161 | * @return A binary string containing GLST data ready to be put into a GLST history. |
162 | 162 | */ |
163 | 163 | public function Compile($format) { |
164 | - $data = pack('VVVVV',$this->eventtype,$this->worldtime,$this->creatureage,$this->timestamp,$this->lifestage); |
|
165 | - $data .= pack('V',strlen($this->moniker1)).$this->moniker1; |
|
166 | - $data .= pack('V',strlen($this->moniker2)).$this->moniker2; |
|
167 | - $data .= pack('V',strlen($this->usertext)).$this->usertext; |
|
168 | - $data .= pack('V',strlen($this->photograph)).$this->photograph; |
|
169 | - $data .= pack('V',strlen($this->worldname)).$this->worldname; |
|
170 | - $data .= pack('V',strlen($this->worldUID)).$this->worldUID; |
|
171 | - if($format == GLST_FORMAT_DS) { |
|
172 | - $data .= pack('V',strlen($this->dockingstationuser)).$this->dockingstationuser; |
|
173 | - $data .= pack('VV',$this->unknown1,$this->unknown2); |
|
164 | + $data = pack('VVVVV', $this->eventtype, $this->worldtime, $this->creatureage, $this->timestamp, $this->lifestage); |
|
165 | + $data .= pack('V', strlen($this->moniker1)).$this->moniker1; |
|
166 | + $data .= pack('V', strlen($this->moniker2)).$this->moniker2; |
|
167 | + $data .= pack('V', strlen($this->usertext)).$this->usertext; |
|
168 | + $data .= pack('V', strlen($this->photograph)).$this->photograph; |
|
169 | + $data .= pack('V', strlen($this->worldname)).$this->worldname; |
|
170 | + $data .= pack('V', strlen($this->worldUID)).$this->worldUID; |
|
171 | + if ($format == GLST_FORMAT_DS) { |
|
172 | + $data .= pack('V', strlen($this->dockingstationuser)).$this->dockingstationuser; |
|
173 | + $data .= pack('VV', $this->unknown1, $this->unknown2); |
|
174 | 174 | } |
175 | 175 | return $data; |
176 | 176 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * Makes a new AGNTBlock. \n |
12 | 12 | * If $prayfile is not null, all the data about this AGNTBlock |
13 | 13 | * will be read from the PRAYFile. |
14 | - * @param $prayfile The PRAYFile associated with this AGNT block. |
|
14 | + * @param PRAYFile $prayfile The PRAYFile associated with this AGNT block. |
|
15 | 15 | * It is allowed to be null. |
16 | 16 | * @param $name The name of this block. |
17 | 17 | * @param $content This block's content. |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | return $this->GetTag('Dependency Count'); |
76 | 76 | } |
77 | 77 | /// @brief Gets the dependency specified |
78 | - /** @param $dependency The number of the dependency to get. 1-based. |
|
78 | + /** @param integer $dependency The number of the dependency to get. 1-based. |
|
79 | 79 | * return A PrayDependency object describing the file the agent depends on |
80 | 80 | */ |
81 | 81 |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | * @param $flags Any flags this block may have. I think this is a |
19 | 19 | * single byte. Check http://www.creatureswiki.net/wiki/PRAY |
20 | 20 | */ |
21 | - public function AGNTBlock($prayfile,$name,$content,$flags) { |
|
22 | - parent::TagBlock($prayfile,$name,$content,$flags,PRAY_BLOCK_AGNT); |
|
21 | + public function AGNTBlock($prayfile, $name, $content, $flags) { |
|
22 | + parent::TagBlock($prayfile, $name, $content, $flags, PRAY_BLOCK_AGNT); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /// @brief Gets the agent's name. |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | * If the description doesn't exist in the language specified, falls back on English rather than returning nothing. |
37 | 37 | * @param $localisation The two-letter language code (e.g. de, fr) to get. If not specified, english is used. |
38 | 38 | */ |
39 | - public function GetAgentDescription($localisation='') { |
|
40 | - if($localisation == '') { |
|
39 | + public function GetAgentDescription($localisation = '') { |
|
40 | + if ($localisation == '') { |
|
41 | 41 | return $this->GetTag('Agent Description'); |
42 | 42 | } else { |
43 | 43 | $description = $this->GetTag('Agent Description-'.$localisation); |
44 | - if($description == '') { |
|
44 | + if ($description == '') { |
|
45 | 45 | $description = $this->GetTag('Agent Description'); |
46 | 46 | } |
47 | 47 | return $description; |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * Gets the first script, or if you specified which script, that one. |
64 | 64 | * @param $script Which script to get as an integer. The first script is script 1. |
65 | 65 | */ |
66 | - public function GetScript($script=1) { |
|
67 | - if($script > 0 && $script <= $this->GetScriptCount()) { |
|
66 | + public function GetScript($script = 1) { |
|
67 | + if ($script > 0 && $script <= $this->GetScriptCount()) { |
|
68 | 68 | return $this->GetTag('Script '.$script); |
69 | 69 | } |
70 | 70 | throw new Exception('Script doesn\'t exist!'); |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | public function GetDependency($dependency) { |
83 | 83 | $file = $this->GetTag('Dependency '.$dependency); |
84 | 84 | $category = $this->GetTag('Dependency Category '.$dependency); |
85 | - return new PrayDependency($category,$file); |
|
85 | + return new PrayDependency($category, $file); |
|
86 | 86 | } |
87 | 87 | /// @brief Gets all the files this agent depends on. |
88 | 88 | /** return An array of PrayDependency objects. |
89 | 89 | */ |
90 | 90 | public function GetDependencies() { |
91 | 91 | $dependencies = array(); |
92 | - for($i = 1; $i <= $this->GetDependencyCount(); $i++) { |
|
92 | + for ($i = 1; $i <= $this->GetDependencyCount(); $i++) { |
|
93 | 93 | $dependencies[] = $this->GetDependency($i); |
94 | 94 | } |
95 | 95 | return $dependencies; |
@@ -153,40 +153,40 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function GetAgentAnimationAsSpriteFrame() { |
155 | 155 | $animationFile = $this->GetAgentAnimationFile(); |
156 | - if($animationFile == '') { |
|
156 | + if ($animationFile == '') { |
|
157 | 157 | $animationFile = $this->GetAgentAnimationGallery(); |
158 | - if($animationFile == '') { |
|
158 | + if ($animationFile == '') { |
|
159 | 159 | throw new Exception('No animation file!'); |
160 | 160 | } |
161 | 161 | $animationFile .= '.c16'; |
162 | 162 | } |
163 | 163 | $animationFirstImage = $this->GetAgentAnimationFirstImage(); |
164 | 164 | $animationString = $this->GetAgentAnimationString(); |
165 | - if($animationFirstImage == '') { |
|
165 | + if ($animationFirstImage == '') { |
|
166 | 166 | $animationFirstImage = 0; |
167 | 167 | } |
168 | - if($animationString == '') { |
|
168 | + if ($animationString == '') { |
|
169 | 169 | $animationString = 0; |
170 | 170 | } |
171 | - if(($position = strpos($animationString,' ')) !== false) { |
|
172 | - $animationString = substr($animationString,0,$position); |
|
171 | + if (($position = strpos($animationString, ' ')) !== false) { |
|
172 | + $animationString = substr($animationString, 0, $position); |
|
173 | 173 | } |
174 | 174 | $prayfile = $this->GetPrayFile(); |
175 | - if($prayfile == null) { |
|
175 | + if ($prayfile == null) { |
|
176 | 176 | throw new Exception('No PRAY file to get the icon from!'); |
177 | 177 | } |
178 | 178 | $iconBlock = $prayfile->GetBlockByName($animationFile); |
179 | - if($iconBlock->GetType() != 'FILE') { |
|
179 | + if ($iconBlock->GetType() != 'FILE') { |
|
180 | 180 | throw new Exception('The block with the animation\'s filename is not a file block!'); |
181 | 181 | } |
182 | - $type = strtolower(substr($animationFile,-3)); |
|
182 | + $type = strtolower(substr($animationFile, -3)); |
|
183 | 183 | $icon = null; |
184 | - if($type == 'c16') { |
|
184 | + if ($type == 'c16') { |
|
185 | 185 | $icon = new C16File(new StringReader($iconBlock->GetData())); |
186 | - } else if($type == 's16') { |
|
186 | + } else if ($type == 's16') { |
|
187 | 187 | $icon = new S16File(new StringReader($iconBlock->GetData())); |
188 | 188 | } |
189 | - if($icon == null) { |
|
189 | + if ($icon == null) { |
|
190 | 190 | throw new Exception('For one reason or another, couldn\'t make a sprite file for the agent.'); |
191 | 191 | } |
192 | 192 | return $icon->GetFrame($animationFirstImage+$animationString); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | } |
29 | 29 | /// @brief Compile the BinaryBlock |
30 | 30 | /** |
31 | - * @return The compiled BinaryBlock as a binary string. |
|
31 | + * @return string compiled BinaryBlock as a binary string. |
|
32 | 32 | */ |
33 | 33 | public function Compile() { |
34 | 34 | return $this->EncodeBlockHeader(strlen($this->binarydata)).$this->binarydata; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | class BinaryBlock extends PrayBlock { |
14 | 14 | /// @cond INTERNAL_DOCS |
15 | 15 | |
16 | - private $binarydata; |
|
16 | + private $binarydata; |
|
17 | 17 | /// @endcond |
18 | 18 | |
19 | 19 | /// @brief Instantiate a BinaryBlock |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | * @param $name The block's name. |
23 | 23 | * @param $content The content of the block as a binary string. |
24 | 24 | */ |
25 | - public function BinaryBlock($type,$name,$content) { |
|
26 | - parent::PrayBlock(null,$name,'',0,$type); |
|
27 | - $this->binarydata = $content; |
|
25 | + public function BinaryBlock($type,$name,$content) { |
|
26 | + parent::PrayBlock(null,$name,'',0,$type); |
|
27 | + $this->binarydata = $content; |
|
28 | 28 | } |
29 | 29 | /// @brief Compile the BinaryBlock |
30 | 30 | /** |
31 | 31 | * @return The compiled BinaryBlock as a binary string. |
32 | 32 | */ |
33 | - public function Compile() { |
|
34 | - return $this->EncodeBlockHeader(strlen($this->binarydata)).$this->binarydata; |
|
35 | - } |
|
33 | + public function Compile() { |
|
34 | + return $this->EncodeBlockHeader(strlen($this->binarydata)).$this->binarydata; |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | ?> |
@@ -22,8 +22,8 @@ |
||
22 | 22 | * @param $name The block's name. |
23 | 23 | * @param $content The content of the block as a binary string. |
24 | 24 | */ |
25 | - public function BinaryBlock($type,$name,$content) { |
|
26 | - parent::PrayBlock(null,$name,'',0,$type); |
|
25 | + public function BinaryBlock($type, $name, $content) { |
|
26 | + parent::PrayBlock(null, $name, '', 0, $type); |
|
27 | 27 | $this->binarydata = $content; |
28 | 28 | } |
29 | 29 | /// @brief Compile the BinaryBlock |
@@ -10,7 +10,7 @@ |
||
10 | 10 | /** |
11 | 11 | * If $prayfile is not null, all the data about this CREABlock |
12 | 12 | * will be read from the PRAYFile. |
13 | - * @param $prayfile The PRAYFile associated with this CREA block. |
|
13 | + * @param PRAYFile $prayfile The PRAYFile associated with this CREA block. |
|
14 | 14 | * It is allowed to be null. |
15 | 15 | * @param $name The name of this block. |
16 | 16 | * @param $content This block's content. |
@@ -16,8 +16,8 @@ |
||
16 | 16 | * @param $content This block's content. |
17 | 17 | * @param $flags Any flags this block may have |
18 | 18 | */ |
19 | - public function CREABlock($prayfile,$name,$content,$flags) { |
|
20 | - parent::CreaturesArchiveBlock($prayfile,$name,$content,$flags,PRAY_BLOCK_CREA); |
|
19 | + public function CREABlock($prayfile, $name, $content, $flags) { |
|
20 | + parent::CreaturesArchiveBlock($prayfile, $name, $content, $flags, PRAY_BLOCK_CREA); |
|
21 | 21 | } |
22 | 22 | /// @cond INTERNAL_DOCS |
23 | 23 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * @param $name The name of this block |
16 | 16 | * @param $content This block's binary data. |
17 | 17 | * @param $flags the flags of this block |
18 | - * @param $type This block's type as one of the PRAY_BLOCK_* constants |
|
18 | + * @param string $type This block's type as one of the PRAY_BLOCK_* constants |
|
19 | 19 | */ |
20 | 20 | public function CreaturesArchiveBlock(&$prayfile,$name,$content,$flags,$type) { |
21 | 21 | parent::PrayBlock($prayfile,$name,$content,$flags,$type); |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | * @param $flags the flags of this block |
18 | 18 | * @param $type This block's type as one of the PRAY_BLOCK_* constants |
19 | 19 | */ |
20 | - public function CreaturesArchiveBlock(&$prayfile,$name,$content,$flags,$type) { |
|
21 | - parent::PrayBlock($prayfile,$name,$content,$flags,$type); |
|
22 | - if($prayfile instanceof PRAYFile) { |
|
23 | - if(!$this->DeArchive()) { |
|
20 | + public function CreaturesArchiveBlock(&$prayfile, $name, $content, $flags, $type) { |
|
21 | + parent::PrayBlock($prayfile, $name, $content, $flags, $type); |
|
22 | + if ($prayfile instanceof PRAYFile) { |
|
23 | + if (!$this->DeArchive()) { |
|
24 | 24 | throw new Exception('De-Archiving failed, block probably wasn\'t a CreaturesArchive type'); |
25 | 25 | } |
26 | 26 | } |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | /// DeArchives this block |
31 | 31 | private function DeArchive() { |
32 | 32 | $content = $this->GetData(); |
33 | - if($content{0} == 'C') { |
|
33 | + if ($content{0} == 'C') { |
|
34 | 34 | $content = DeArchive($content); |
35 | - if($content !== false) { |
|
35 | + if ($content !== false) { |
|
36 | 36 | $this->SetData($content); |
37 | 37 | return true; |
38 | 38 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | /** |
14 | 14 | * If $prayfile is not null, all the data for this block |
15 | 15 | * will be read from the PRAYFile. |
16 | - * @param $prayfile The PRAYFile that this DFAM block belongs to. |
|
16 | + * @param PRAYFile $prayfile The PRAYFile that this DFAM block belongs to. |
|
17 | 17 | * @param $name The block's name. |
18 | 18 | * @param $content The binary data of this block. May be null. |
19 | 19 | * @param $flags The block's flags |
@@ -13,14 +13,14 @@ |
||
13 | 13 | /** |
14 | 14 | * If $prayfile is not null, all the data for this block |
15 | 15 | * will be read from the PRAYFile. |
16 | - * @param $prayfile The PRAYFile that this DFAM block belongs to. |
|
17 | - * @param $name The block's name. |
|
18 | - * @param $content The binary data of this block. May be null. |
|
19 | - * @param $flags The block's flags |
|
20 | - */ |
|
21 | - public function DFAMBlock($prayfile,$name,$content,$flags) { |
|
22 | - parent::TagBlock($prayfile,$name,$content,$flags,PRAY_BLOCK_DFAM); |
|
16 | + * @param $prayfile The PRAYFile that this DFAM block belongs to. |
|
17 | + * @param $name The block's name. |
|
18 | + * @param $content The binary data of this block. May be null. |
|
19 | + * @param $flags The block's flags |
|
20 | + */ |
|
21 | + public function DFAMBlock($prayfile,$name,$content,$flags) { |
|
22 | + parent::TagBlock($prayfile,$name,$content,$flags,PRAY_BLOCK_DFAM); |
|
23 | 23 | |
24 | - } |
|
24 | + } |
|
25 | 25 | } |
26 | 26 | ?> |
@@ -18,8 +18,8 @@ |
||
18 | 18 | * @param $content The binary data of this block. May be null. |
19 | 19 | * @param $flags The block's flags |
20 | 20 | */ |
21 | - public function DFAMBlock($prayfile,$name,$content,$flags) { |
|
22 | - parent::TagBlock($prayfile,$name,$content,$flags,PRAY_BLOCK_DFAM); |
|
21 | + public function DFAMBlock($prayfile, $name, $content, $flags) { |
|
22 | + parent::TagBlock($prayfile, $name, $content, $flags, PRAY_BLOCK_DFAM); |
|
23 | 23 | |
24 | 24 | } |
25 | 25 | } |