NPC Definition¶
NPCs: their names, menu operations, combat stats, the models they are drawn from, and the forms they can turn into.
NPCDefinition.Create¶
function TNPCDefinition.Create(id, revision: Integer; const data: TByteArray): TNPCDefinition; static;
Decodes an NPC: its name and menu operations, its combat stats, its models and the forms it can turn into.
revision is the archive’s revision, which decides whether the head icons are stored as a
single sprite or as the per slot list that replaced it in build 1493.
When the stream doesn’t set a footprint, it is worked out afterwards from the NPC’s size the way the client does it.
Example:
archive := CacheReader.Indices[ECacheIndex.CONFIGS].ReferenceTable.Archives.Value[EConfigArchive.NPC];
def := TNPCDefinition.Create(3010, archive.Revision, archive.Files.Value[3010].Data);
TNPCDefinitionArray.IndexOf¶
function TNPCDefinitionArray.IndexOf(id: Integer): Integer;
The position of id in the array, or -1 if there is no such NPC.
NPC definitions are stored one per id with no gaps, so an id is its own index; this exists to keep that assumption in one place.