c2ephp

AGNTBlock Class Reference

Represents an AGNT block in a PRAY file, used for C3 Agent scripts and metadata. More...

Inheritance diagram for AGNTBlock:
Collaboration diagram for AGNTBlock:

List of all members.

Public Member Functions

 AGNTBlock ($prayfile, $name, $content, $flags)
 Instantiate a new AGNTBlock.
 GetAgentName ()
 Gets the agent's name.
 GetAgentDescription ($localisation='')
 Gets the agent's description in the specified language.
 GetAgentType ()
 Gets the agent's type.
 GetScriptCount ()
 Gets the number of scripts stored in this block.
 GetScript ($script=1)
 Gets the specified script.
 GetDependencyCount ()
 Get the number of files this agent depends on.
 GetDependency ($dependency)
 Gets the dependency specified.
 GetDependencies ()
 Gets all the files this agent depends on.
 GetRemoveScript ()
 Gets the script used to remove this agent.
 GetAgentAnimationFile ()
 Gets the file used for the animation of the agent on the C3 Creator/DS injector.
 GetAgentAnimationGallery ()
 Gets the filename (excluding extension) used for the animation of the agent on the C3 Creator/DS injector.
 GetAgentAnimationFirstImage ()
 Gets the number of the first image of the animation displayed on the C3 Creator/DS injector.
 GetAgentAnimationString ()
 Gets the animation displayed on the C3 creator/DS injector.
 GetAgentAnimationAsSpriteFrame ()
 Gets the image used on the creator.
 GetTag ($key)
 Gets the tag with the given name.
 GetTags ()
 Gets all the tags from this block as an array of tags.
 SetTag ($tag, $value)
 Sets a tag.
 GetName ()
 Gets the PRAY block's name.
 GetData ()
 Gets the PRAY block's binary data if the PRAYBlock is decompiled.
 GetType ()
 Gets the type of PrayBlock this is.
 GetFlags ()
 Returns the flag bitfield used to determine flags.
 IsFlagSet ($flag)
 Tells you whether $flag is set on this PRAY block.
 Compile ()
 Compile this PrayBlock.

Related Functions

(Note that these are not member functions.)
Block Types

Constants for the various PRAY block types

enum  PRAY_BLOCK_AGNT
enum  PRAY_BLOCK_CREA
enum  PRAY_BLOCK_DFAM
enum  PRAY_BLOCK_DSAG
enum  PRAY_BLOCK_DSEX
enum  PRAY_BLOCK_EGGS
enum  PRAY_BLOCK_EXPC
enum  PRAY_BLOCK_FILE
enum  PRAY_BLOCK_GENE
enum  PRAY_BLOCK_GLST
enum  PRAY_BLOCK_LIVE
enum  PRAY_BLOCK_PHOT
enum  PRAY_BLOCK_SFAM
Flags

Flags used to specify how the block's data is stored.

enum  PRAY_FLAG_ZLIB_COMPRESSED
 

Whether or not the block is zLib compressed.

More...

Detailed Description

Represents an AGNT block in a PRAY file, used for C3 Agent scripts and metadata.

Definition at line 7 of file AGNTBlock.php.


Member Function Documentation

AGNTBlock::AGNTBlock ( prayfile,
name,
content,
flags 
)

Instantiate a new AGNTBlock.

Makes a new AGNTBlock.
If $prayfile is not null, all the data about this AGNTBlock will be read from the PRAYFile.

Parameters:
$prayfileThe PRAYFile associated with this AGNT block. It is allowed to be null.
$nameThe name of this block.
$contentThis block's content.
$flagsAny flags this block may have. I think this is a single byte. Check http://www.creatureswiki.net/wiki/PRAY

Definition at line 21 of file AGNTBlock.php.

PrayBlock::Compile ( ) [inherited]

Compile this PrayBlock.

Compiles the PrayBlock's data if necessary, then adds the header and returns the binary pray block.
This function is mainly intended for use by PRAYFiles.

Reimplemented in BinaryBlock.

Definition at line 253 of file PrayBlock.php.

AGNTBlock::GetAgentAnimationAsSpriteFrame ( )

Gets the image used on the creator.

Since I have no desire to bring GIF files back to the internet this function will ONLY support single-frame animations. If you really, REALLY, want to make a GIF, it's totally possible so do it yourself. You can use this function as a basis. After all, that's what FOSS software is for.

This function tries pretty hard to get the sprite out, and throws an exception if it can't.

Definition at line 154 of file AGNTBlock.php.

AGNTBlock::GetAgentAnimationFile ( )

Gets the file used for the animation of the agent on the C3 Creator/DS injector.

Only the name, not the path. Includes file extension.

Definition at line 109 of file AGNTBlock.php.

AGNTBlock::GetAgentAnimationFirstImage ( )

Gets the number of the first image of the animation displayed on the C3 Creator/DS injector.

This is used as the basis for the animation string. For example, an AGNT block with
'Animation Sprite First Image' = 4
and 'Agent Animation String' = 0 0 3 4
Would show the same image as one with
'Animation Sprite First Image' = 0
and 'Agent Animation String' = 4 4 7 8

Definition at line 132 of file AGNTBlock.php.

AGNTBlock::GetAgentAnimationGallery ( )

Gets the filename (excluding extension) used for the animation of the agent on the C3 Creator/DS injector.

For all agent files I've seen, it's functionally identical to substr(AGNTBlock::GetAgentAnimationFile(),0,-4) I have no idea why anyone would use this.

Definition at line 119 of file AGNTBlock.php.

AGNTBlock::GetAgentAnimationString ( )

Gets the animation displayed on the C3 creator/DS injector.

Returns:
A space-delimited set of numbers, corresponding to the indices of the sprites in the animation file.

Definition at line 139 of file AGNTBlock.php.

AGNTBlock::GetAgentDescription ( localisation = '')

Gets the agent's description in the specified language.

If the description doesn't exist in the language specified, falls back on English rather than returning nothing.

Parameters:
$localisationThe two-letter language code (e.g. de, fr) to get. If not specified, english is used.

Definition at line 39 of file AGNTBlock.php.

AGNTBlock::GetAgentName ( )

Gets the agent's name.

Sometimes this ends in .agnt or .dsag, because some people don't do their PRAYING properly.

Returns:
The agent name

Definition at line 31 of file AGNTBlock.php.

AGNTBlock::GetAgentType ( )

Gets the agent's type.

I honestly have no idea what this is. It seems to always be 0.

Definition at line 54 of file AGNTBlock.php.

PrayBlock::GetData ( ) [inherited]

Gets the PRAY block's binary data if the PRAYBlock is decompiled.

It will decompress automatically if necessary, then unset the compressed flag. TODO: I'm not 100% sure I should keep this public... return the PRAY block's binary data.

Definition at line 153 of file PrayBlock.php.

AGNTBlock::GetDependencies ( )

Gets all the files this agent depends on.

return An array of PrayDependency objects.

Definition at line 90 of file AGNTBlock.php.

AGNTBlock::GetDependency ( dependency)

Gets the dependency specified.

Parameters:
$dependencyThe number of the dependency to get. 1-based. return A PrayDependency object describing the file the agent depends on

Definition at line 82 of file AGNTBlock.php.

AGNTBlock::GetDependencyCount ( )

Get the number of files this agent depends on.

Definition at line 74 of file AGNTBlock.php.

PrayBlock::GetFlags ( ) [inherited]

Returns the flag bitfield used to determine flags.

Prefer using IsFlagSet. (This may be deprecated/removed in future releases) Least Significant Bit determines whether the block is compressed (1) or not. All other bits are 0 in all c2e-compatible PRAY blocks.

Returns:
an integer 0-255

Definition at line 179 of file PrayBlock.php.

PrayBlock::GetName ( ) [inherited]

Gets the PRAY block's name.

return the PRAY block's name

Definition at line 144 of file PrayBlock.php.

AGNTBlock::GetRemoveScript ( )

Gets the script used to remove this agent.

If not specified, most likely a removal script is included in the agent's scripts, however, if this isn't specified the game won't know how to remove the agent

Definition at line 102 of file AGNTBlock.php.

AGNTBlock::GetScript ( script = 1)

Gets the specified script.

Gets the first script, or if you specified which script, that one.

Parameters:
$scriptWhich script to get as an integer. The first script is script 1.

Definition at line 66 of file AGNTBlock.php.

AGNTBlock::GetScriptCount ( )

Gets the number of scripts stored in this block.

Definition at line 58 of file AGNTBlock.php.

TagBlock::GetTag ( key) [inherited]

Gets the tag with the given name.

Returns the tag's value as a string, or nothing if the tag doesn't exist.

Definition at line 44 of file TagBlock.php.

TagBlock::GetTags ( ) [inherited]

Gets all the tags from this block as an array of tags.

This is mainly useful for people writing subclasses of TagBlock. If you have to write code that uses GetTags in your application, please file a bug report!

Definition at line 57 of file TagBlock.php.

PrayBlock::GetType ( ) [inherited]

Gets the type of PrayBlock this is.

Gives the type as one of the PRAY_BLOCK_* constants - a four-character string, all in caps. These are defined above.

Returns:
One of the PRAY_BLOCK_* constants

Definition at line 170 of file PrayBlock.php.

PrayBlock::IsFlagSet ( flag) [inherited]

Tells you whether $flag is set on this PRAY block.

Parameters:
$flagthe bitfield to compare $flags to. As such can be multiple flags OR'd together.
Returns:
true or false.

Definition at line 187 of file PrayBlock.php.

TagBlock::SetTag ( tag,
value 
) [inherited]

Sets a tag.

Sets the tag with the given value, overwriting or creating the tag as needed. Generally setters ought to be used in subclasses of TagBlock.

Parameters:
$tagName of the tag to set
$valueThe value to set the tag to

Definition at line 69 of file TagBlock.php.


Friends And Related Function Documentation

enum PRAY_BLOCK_AGNT [related, inherited]

Value: 'AGNT'

Definition at line 27 of file PrayBlock.php.

enum PRAY_BLOCK_CREA [related, inherited]

Value: 'CREA'

Definition at line 29 of file PrayBlock.php.

enum PRAY_BLOCK_DFAM [related, inherited]

Value: 'DFAM'

Definition at line 31 of file PrayBlock.php.

enum PRAY_BLOCK_DSAG [related, inherited]

Value: 'DSAG'

Definition at line 33 of file PrayBlock.php.

enum PRAY_BLOCK_DSEX [related, inherited]

Value: 'DSEX'

Definition at line 35 of file PrayBlock.php.

enum PRAY_BLOCK_EGGS [related, inherited]

Value: 'EGG'

Definition at line 37 of file PrayBlock.php.

enum PRAY_BLOCK_EXPC [related, inherited]

Value: 'EXPC'

Definition at line 39 of file PrayBlock.php.

enum PRAY_BLOCK_FILE [related, inherited]

Value: 'FILE'

Definition at line 41 of file PrayBlock.php.

enum PRAY_BLOCK_GENE [related, inherited]

Value: 'GENE'

Definition at line 43 of file PrayBlock.php.

enum PRAY_BLOCK_GLST [related, inherited]

Value: 'GLST'

Definition at line 45 of file PrayBlock.php.

enum PRAY_BLOCK_LIVE [related, inherited]

Value: 'LIVE'

Definition at line 47 of file PrayBlock.php.

enum PRAY_BLOCK_PHOT [related, inherited]

Value: 'PHOT'

Definition at line 49 of file PrayBlock.php.

enum PRAY_BLOCK_SFAM [related, inherited]

Value: 'SFAM'

Definition at line 51 of file PrayBlock.php.

enum PRAY_FLAG_ZLIB_COMPRESSED [related, inherited]

Whether or not the block is zLib compressed.

Value: 1

Definition at line 60 of file PrayBlock.php.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Enumerations