@@ -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 | } |
@@ -6,13 +6,13 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | /// @cond INTERNAL_DOCS |
| 8 | 8 | |
| 9 | - private $creationTime; |
|
| 10 | - private $version; |
|
| 11 | - private $revision; |
|
| 12 | - private $authorName; |
|
| 13 | - private $authorEmail; |
|
| 14 | - private $authorURL; |
|
| 15 | - private $authorComments; |
|
| 9 | + private $creationTime; |
|
| 10 | + private $version; |
|
| 11 | + private $revision; |
|
| 12 | + private $authorName; |
|
| 13 | + private $authorEmail; |
|
| 14 | + private $authorURL; |
|
| 15 | + private $authorComments; |
|
| 16 | 16 | |
| 17 | 17 | /// @endcond |
| 18 | 18 | |
@@ -20,103 +20,103 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * @param $authorName the name of the author of this COB |
| 23 | - * @param $authorEmail the author's email address |
|
| 24 | - * @param $authorURL The author's website address |
|
| 25 | - * @param $authorComments Any comments the author had about this COB |
|
| 26 | - * @param $creationTime the time this COB was compiled as a UNIX timestamp |
|
| 27 | - * @param $version The version number of this COB (integer) |
|
| 28 | - * @param $revision the COB's revision number (integer) |
|
| 29 | - */ |
|
| 30 | - public function COBAuthorBlock($authorName,$authorEmail,$authorURL,$authorComments,$creationTime,$version,$revision) { |
|
| 31 | - parent::COBBlock(COB_BLOCK_AUTHOR); |
|
| 32 | - $this->authorName = $authorName; |
|
| 33 | - $this->authorEmail = $authorEmail; |
|
| 34 | - $this->authorURL = $authorURL; |
|
| 35 | - $this->authorComments = $authorComments; |
|
| 36 | - $this->creationTime = $creationTime; |
|
| 37 | - $this->version = $version; |
|
| 38 | - $this->revision = $revision; |
|
| 23 | + * @param $authorEmail the author's email address |
|
| 24 | + * @param $authorURL The author's website address |
|
| 25 | + * @param $authorComments Any comments the author had about this COB |
|
| 26 | + * @param $creationTime the time this COB was compiled as a UNIX timestamp |
|
| 27 | + * @param $version The version number of this COB (integer) |
|
| 28 | + * @param $revision the COB's revision number (integer) |
|
| 29 | + */ |
|
| 30 | + public function COBAuthorBlock($authorName,$authorEmail,$authorURL,$authorComments,$creationTime,$version,$revision) { |
|
| 31 | + parent::COBBlock(COB_BLOCK_AUTHOR); |
|
| 32 | + $this->authorName = $authorName; |
|
| 33 | + $this->authorEmail = $authorEmail; |
|
| 34 | + $this->authorURL = $authorURL; |
|
| 35 | + $this->authorComments = $authorComments; |
|
| 36 | + $this->creationTime = $creationTime; |
|
| 37 | + $this->version = $version; |
|
| 38 | + $this->revision = $revision; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - /// @brief Gets the name of the author |
|
| 41 | + /// @brief Gets the name of the author |
|
| 42 | 42 | /** |
| 43 | 43 | * @return Author's name |
| 44 | 44 | */ |
| 45 | - public function GetAuthorName() { |
|
| 46 | - return $this->authorName; |
|
| 45 | + public function GetAuthorName() { |
|
| 46 | + return $this->authorName; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - /// @brief Gets the author's email address |
|
| 49 | + /// @brief Gets the author's email address |
|
| 50 | 50 | /** |
| 51 | 51 | * @return string |
| 52 | - */ |
|
| 53 | - public function GetAuthorEmail() { |
|
| 54 | - return $this->authorEmail; |
|
| 52 | + */ |
|
| 53 | + public function GetAuthorEmail() { |
|
| 54 | + return $this->authorEmail; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /// @brief Gets the author's web address |
| 58 | 58 | /** |
| 59 | 59 | * @return string |
| 60 | 60 | */ |
| 61 | - public function GetAuthorURL() { |
|
| 62 | - return $this->authorURL; |
|
| 61 | + public function GetAuthorURL() { |
|
| 62 | + return $this->authorURL; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - /// @brief Gets comments from the author |
|
| 65 | + /// @brief Gets comments from the author |
|
| 66 | 66 | /** |
| 67 | 67 | * @return string |
| 68 | 68 | */ |
| 69 | - public function GetAuthorComments() { |
|
| 70 | - return $this->authorComments; |
|
| 69 | + public function GetAuthorComments() { |
|
| 70 | + return $this->authorComments; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - /// @brief Gets the time this COB was created |
|
| 73 | + /// @brief Gets the time this COB was created |
|
| 74 | 74 | /** |
| 75 | 75 | * @return A UNIX timestamp representing the time this COB was created. |
| 76 | 76 | */ |
| 77 | - public function GetCreationTime() { |
|
| 78 | - return $this->creationTime; |
|
| 77 | + public function GetCreationTime() { |
|
| 78 | + return $this->creationTime; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - /// @brief Gets the COB's version number |
|
| 81 | + /// @brief Gets the COB's version number |
|
| 82 | 82 | /** |
| 83 | 83 | * @see GetRevision() |
| 84 | 84 | * @return An integer |
| 85 | - */ |
|
| 86 | - public function GetVersion() { |
|
| 87 | - return $this->version; |
|
| 88 | - } |
|
| 85 | + */ |
|
| 86 | + public function GetVersion() { |
|
| 87 | + return $this->version; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /// @brief Gets the COB's revision number |
|
| 90 | + /// @brief Gets the COB's revision number |
|
| 91 | 91 | /** |
| 92 | 92 | * The revision number is less significant than the version |
| 93 | 93 | * number. |
| 94 | 94 | * @return An integer |
| 95 | 95 | */ |
| 96 | - public function GetRevision() { |
|
| 97 | - return $this->revision; |
|
| 96 | + public function GetRevision() { |
|
| 97 | + return $this->revision; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /// @cond INTERNAL_DOCS |
| 101 | 101 | |
| 102 | 102 | /// @brief Creates the COBAuthorBlock from an IReader. |
| 103 | 103 | /** |
| 104 | - * @param $reader The IReader, currently at the position of the author block |
|
| 105 | - * @return COBAuthorBlock |
|
| 106 | - */ |
|
| 107 | - public static function CreateFromReader(IReader $reader) { |
|
| 108 | - $creationDay = $reader->ReadInt(1); |
|
| 109 | - $creationMonth = $reader->ReadInt(1); |
|
| 110 | - $creationYear = $reader->ReadInt(2); |
|
| 111 | - $timestamp = mktime(0,0,0,$creationMonth,$creationDay,$creationYear); |
|
| 112 | - $version = $reader->ReadInt(1); |
|
| 113 | - $revision = $reader->ReadInt(1); |
|
| 114 | - $authorName = $reader->ReadCString(); |
|
| 115 | - $authorEmail = $reader->ReadCString(); |
|
| 116 | - $authorURL = $reader->ReadCString(); |
|
| 117 | - $authorComments = $reader->ReadCString(); |
|
| 104 | + * @param $reader The IReader, currently at the position of the author block |
|
| 105 | + * @return COBAuthorBlock |
|
| 106 | + */ |
|
| 107 | + public static function CreateFromReader(IReader $reader) { |
|
| 108 | + $creationDay = $reader->ReadInt(1); |
|
| 109 | + $creationMonth = $reader->ReadInt(1); |
|
| 110 | + $creationYear = $reader->ReadInt(2); |
|
| 111 | + $timestamp = mktime(0,0,0,$creationMonth,$creationDay,$creationYear); |
|
| 112 | + $version = $reader->ReadInt(1); |
|
| 113 | + $revision = $reader->ReadInt(1); |
|
| 114 | + $authorName = $reader->ReadCString(); |
|
| 115 | + $authorEmail = $reader->ReadCString(); |
|
| 116 | + $authorURL = $reader->ReadCString(); |
|
| 117 | + $authorComments = $reader->ReadCString(); |
|
| 118 | 118 | |
| 119 | - return $readerData; |
|
| 119 | + return $readerData; |
|
| 120 | 120 | } |
| 121 | 121 | /// @endcond |
| 122 | 122 | } |
@@ -14,29 +14,29 @@ |
||
| 14 | 14 | |
| 15 | 15 | /// @brief The base COB block class |
| 16 | 16 | abstract class COBBlock { |
| 17 | - /// @cond INTERNAL_DOCS |
|
| 17 | + /// @cond INTERNAL_DOCS |
|
| 18 | 18 | |
| 19 | - private $type; |
|
| 19 | + private $type; |
|
| 20 | 20 | |
| 21 | - /// @brief Instantiates a new COBBlock |
|
| 22 | - /** This function must be called from all COBBlock parents |
|
| 23 | - * @param $type What type of COBBlock it is. Must be a 4-character string. |
|
| 24 | - */ |
|
| 25 | - public function COBBlock($type) { |
|
| 26 | - if(strlen($type) != 4) { |
|
| 27 | - throw new Exception('Invalid COB block type: '.$type); |
|
| 28 | - } |
|
| 29 | - $this->type = $type; |
|
| 21 | + /// @brief Instantiates a new COBBlock |
|
| 22 | + /** This function must be called from all COBBlock parents |
|
| 23 | + * @param $type What type of COBBlock it is. Must be a 4-character string. |
|
| 24 | + */ |
|
| 25 | + public function COBBlock($type) { |
|
| 26 | + if(strlen($type) != 4) { |
|
| 27 | + throw new Exception('Invalid COB block type: '.$type); |
|
| 28 | + } |
|
| 29 | + $this->type = $type; |
|
| 30 | 30 | } |
| 31 | 31 | /// @endcond |
| 32 | 32 | |
| 33 | 33 | /// @brief Gets the type of this COB block |
| 34 | 34 | /** |
| 35 | - * @return string One of the COB_BLOCK_* defines. |
|
| 36 | - */ |
|
| 37 | - public function GetType() { |
|
| 38 | - return $this->type; |
|
| 39 | - } |
|
| 35 | + * @return string One of the COB_BLOCK_* defines. |
|
| 36 | + */ |
|
| 37 | + public function GetType() { |
|
| 38 | + return $this->type; |
|
| 39 | + } |
|
| 40 | 40 | /// @brief Compiles this COB Block and returns COB file as a binary string. |
| 41 | 41 | /** |
| 42 | 42 | * @return string |
@@ -12,16 +12,16 @@ |
||
| 12 | 12 | |
| 13 | 13 | /// @brief Creates a new COBUnknown block with the given type and contents |
| 14 | 14 | /** |
| 15 | - * @param $type The four-character type of the block |
|
| 16 | - * @param $contents The contents of the block |
|
| 17 | - */ |
|
| 18 | - public function COBUnknownBlock($type,$contents) { |
|
| 19 | - parent::COBBlock($type); |
|
| 15 | + * @param $type The four-character type of the block |
|
| 16 | + * @param $contents The contents of the block |
|
| 17 | + */ |
|
| 18 | + public function COBUnknownBlock($type,$contents) { |
|
| 19 | + parent::COBBlock($type); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - /// @brief Gets the block's contents |
|
| 23 | - public function GetContents() { |
|
| 24 | - return $this->contents; |
|
| 25 | - } |
|
| 22 | + /// @brief Gets the block's contents |
|
| 23 | + public function GetContents() { |
|
| 24 | + return $this->contents; |
|
| 25 | + } |
|
| 26 | 26 | } |
| 27 | 27 | ?> |
@@ -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 | ?> |
@@ -4,9 +4,9 @@ |
||
| 4 | 4 | |
| 5 | 5 | /// @brief The class for a GENE block |
| 6 | 6 | /** |
| 7 | - * The contents are identical to that of a .gen file\n |
|
| 8 | - * This class doesn't have any useful functions yet - I don't |
|
| 9 | - * actually know how to decode genetics at the moment. |
|
| 7 | + * The contents are identical to that of a .gen file\n |
|
| 8 | + * This class doesn't have any useful functions yet - I don't |
|
| 9 | + * actually know how to decode genetics at the moment. |
|
| 10 | 10 | */ |
| 11 | 11 | class GENEBlock extends PrayBlock { |
| 12 | 12 | |
@@ -10,18 +10,18 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class SFAMBlock extends EXPCBlock { |
| 12 | 12 | |
| 13 | - /// @brief Instantiates a new SFAMBlock |
|
| 13 | + /// @brief Instantiates a new SFAMBlock |
|
| 14 | 14 | /** |
| 15 | 15 | * If $prayfile is not null, all the data for this block |
| 16 | 16 | * will be read from the PRAYFile. |
| 17 | - * @param $prayfile The PRAYFile that this DFAM block belongs to. |
|
| 18 | - * @param $name The block's name. |
|
| 19 | - * @param $content The binary data of this block. May be null. |
|
| 20 | - * @param $flags The block's flags |
|
| 21 | - */ |
|
| 22 | - public function SFAMBlock($prayfile,$name,$content,$flags) { |
|
| 23 | - parent::TagBlock($prayfile,$name,$content,$flags,PRAY_BLOCK_SFAM); |
|
| 17 | + * @param $prayfile The PRAYFile that this DFAM block belongs to. |
|
| 18 | + * @param $name The block's name. |
|
| 19 | + * @param $content The binary data of this block. May be null. |
|
| 20 | + * @param $flags The block's flags |
|
| 21 | + */ |
|
| 22 | + public function SFAMBlock($prayfile,$name,$content,$flags) { |
|
| 23 | + parent::TagBlock($prayfile,$name,$content,$flags,PRAY_BLOCK_SFAM); |
|
| 24 | 24 | |
| 25 | - } |
|
| 25 | + } |
|
| 26 | 26 | } |
| 27 | 27 | ?> |
@@ -19,16 +19,16 @@ |
||
| 19 | 19 | * @param $flags Any flags this block may have. I think this is a |
| 20 | 20 | * single byte. Check http://www.creatureswiki.net/wiki/PRAY |
| 21 | 21 | */ |
| 22 | - public function EGGSBlock($prayfile,$name,$content,$flags) { |
|
| 22 | + public function EGGSBlock($prayfile,$name,$content,$flags) { |
|
| 23 | 23 | parent::TagBlock($prayfile,$name,$content,$flags,PRAY_BLOCK_EGGS); |
| 24 | 24 | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - /// @brief Gets the agent's type. |
|
| 28 | - /** |
|
| 29 | - * This method is identical to that in EXPCBlock. |
|
| 30 | - * The type seems to always be 0 for EGGSBlocks. |
|
| 31 | - */ |
|
| 27 | + /// @brief Gets the agent's type. |
|
| 28 | + /** |
|
| 29 | + * This method is identical to that in EXPCBlock. |
|
| 30 | + * The type seems to always be 0 for EGGSBlocks. |
|
| 31 | + */ |
|
| 32 | 32 | public function GetAgentType() { |
| 33 | 33 | return $this->GetTag('Agent Type'); |
| 34 | 34 | } |
@@ -20,9 +20,9 @@ |
||
| 20 | 20 | * @param $flags The block's flags. See PrayBlock. |
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | - public function LIVEBlock($prayfile,$name,$content,$flags) { |
|
| 24 | - parent::TagBlock($prayfile,$name,$content,$flags,PRAY_BLOCK_LIVE); |
|
| 23 | + public function LIVEBlock($prayfile,$name,$content,$flags) { |
|
| 24 | + parent::TagBlock($prayfile,$name,$content,$flags,PRAY_BLOCK_LIVE); |
|
| 25 | 25 | |
| 26 | - } |
|
| 26 | + } |
|
| 27 | 27 | } |
| 28 | 28 | ?> |