FileStructure DEF
DEF FILES
We all have seen them, they create all the fun toys we play with in game. Mostly they get generated from Excel, using PERL batch scripts.
Well these files are used to Generate BIN files, stored in PIGG containers for use by the client and server.
There are various way to extract or build them. What how are they structured?
Well I am going to show you an example:
EXAMPLE
This is part of the code that defines who a DEF File for a Character Class like Blaster/Controller is defined:
</BR> #ifdef CLASSES_PARSE_INFO_DEFINITIONS
</BR> TokenizerParseInfo ParseCharacterClasses[] =
</BR> {
</BR> { "Class", TOK_STRUCT(CharacterClasses, ppClasses, ParseCharacterClass)},
{ "", 0, 0 }
</BR> };
</BR> #endif
That outputs:
Class
[INSERT CHARACTER CLASS STRUCT HERE]
TokenizerParseInfo ParseCharacterClass[] =
{
{ "{", TOK_START, 0 },
{ "Name", TOK_STRING(CharacterClass, pchName, 0) },
{ "DisplayName", TOK_STRING(CharacterClass, pchDisplayName, 0) },
{ "DisplayHelp", TOK_STRING(CharacterClass, pchDisplayHelp, 0) },
{ "AllowedOrigins", TOK_STRINGARRAY(CharacterClass, pchAllowedOriginNames)},
{ "SpecialRestrictions", TOK_STRINGARRAY(CharacterClass, pchSpecialRestrictions)},
{ "StoreRequires", TOK_STRING(CharacterClass, pchStoreRestrictions, 0)},
{ "LockedTooltip", TOK_STRING(CharacterClass, pchLockedTooltip, 0)},
{ "ProductCode", TOK_STRING(CharacterClass, pchProductCode, 0)},
{ "ReductionClass", TOK_STRING(CharacterClass, pchReductionClass, 0)},
{ "ReduceAsArchvillain", TOK_BOOLFLAG(CharacterClass, bReduceAsAV, 0)},
{ "LevelUpRespecs", TOK_INTARRAY(CharacterClass, piLevelUpRespecs)},
{ "DisplayShortHelp", TOK_STRING(CharacterClass, pchDisplayShortHelp, 0) },
{ "Icon", TOK_STRING(CharacterClass, pchIcon, 0) },
{ "PrimaryCategory", TOK_STRING(CharacterClass, pchTempCategory[kCategory_Primary], 0) },
{ "SecondaryCategory", TOK_STRING(CharacterClass, pchTempCategory[kCategory_Secondary], 0) },
{ "PowerPoolCategory", TOK_STRING(CharacterClass, pchTempCategory[kCategory_Pool], 0) },
{ "EpicPoolCategory", TOK_STRING(CharacterClass, pchTempCategory[kCategory_Epic], 0) },
{ "AttribMin", TOK_STRUCT(CharacterClass, ppattrMin, ParseCharacterAttributes) },
{ "AttribBase", TOK_STRUCT(CharacterClass, ppattrBase, ParseCharacterAttributes) },
{ "StrengthMin", TOK_STRUCT(CharacterClass, ppattrStrengthMin, ParseCharacterAttributes) },
{ "ResistanceMin", TOK_STRUCT(CharacterClass, ppattrResistanceMin, ParseCharacterAttributes) },
{ "AtrribDiminStrIn", TOK_STRUCT(CharacterClass, ppattrDiminStr[kClassesDiminish_Inner], ParseCharacterAttributes) },
{ "AtrribDiminStrOut", TOK_STRUCT(CharacterClass, ppattrDiminStr[kClassesDiminish_Outer], ParseCharacterAttributes) },
{ "AtrribDiminCurIn", TOK_STRUCT(CharacterClass, ppattrDiminCur[kClassesDiminish_Inner], ParseCharacterAttributes) },
{ "AtrribDiminCurOut", TOK_STRUCT(CharacterClass, ppattrDiminCur[kClassesDiminish_Outer], ParseCharacterAttributes) },
{ "AtrribDiminResIn", TOK_STRUCT(CharacterClass, ppattrDiminRes[kClassesDiminish_Inner], ParseCharacterAttributes) },
{ "AtrribDiminResOut", TOK_STRUCT(CharacterClass, ppattrDiminRes[kClassesDiminish_Outer], ParseCharacterAttributes) },
{ "AttribMaxTable", TOK_STRUCT(CharacterClass, ppTempAttribMax, ParseCharacterAttributesTable) },
{ "AttribMaxMaxTable", TOK_STRUCT(CharacterClass, ppTempAttribMaxMax, ParseCharacterAttributesTable) },
{ "StrengthMaxTable", TOK_STRUCT(CharacterClass, ppTempStrengthMax, ParseCharacterAttributesTable) },
{ "ResistanceMaxTable", TOK_STRUCT(CharacterClass, ppTempResistanceMax, ParseCharacterAttributesTable) },
{ "ModTable", TOK_STRUCT(CharacterClass, ppNamedTables, ParseNamedTable) },
{ "ConnectHPAndStatus", TOK_BOOL(CharacterClass, bConnectHPAndStatus, 0), BoolEnum},
{ "ConnectHPAndIntegrity", TOK_REDUNDANTNAME|TOK_BOOL(CharacterClass, bConnectHPAndStatus, 0), BoolEnum},
{ "DefiantHitPointsAttrib", TOK_AUTOINT(CharacterClass, offDefiantHitPointsAttrib, 0), ParsePowerDefines },
{ "DefiantScale", TOK_F32(CharacterClass, fDefiantScale, 1.0f) },
// These are for shared memory stuff. Ignore them.
{ "_FinalAttrMax_", TOK_POINTER(CharacterClass, pattrMax, iNumBytesTables) },
{ "_FinalAttrMaxMax_", TOK_POINTER(CharacterClass, pattrMaxMax, iNumBytesTables) },
{ "_FinalAttrStrengthMax_", TOK_POINTER(CharacterClass, pattrStrengthMax, iNumBytesTables) },
{ "_FinalAttrResistanceMax_", TOK_POINTER(CharacterClass, pattrResistanceMax, iNumBytesTables) },
{ "}", TOK_END, 0 },
{ "", 0, 0 }
};
#endif
This Defines the expected layout of the information int he DEF File
WHICH GIVE YOU THIS
Class
{
Name "Class_Blaster"
DisplayName "P426732286"
PrimaryCategory "Blaster_RANGED"
SecondaryCategory "Blaster_SUPPORT"
PowerPoolCategory "Pool"
DisplayShortHelp "P2961504413"
DisplayHelp "P583029207"
Icon "archetypeicon_Blaster.tga"
AllowedOrigins Science, Magic, Natural, Mutation, Technology
SpecialRestrictions Hero
ConnectHpAndStatus kFalse
[CONTINUES]