Npc Avatar
The npc avatar class represents an NPC as shown by the client. This class contains all the properties necessary to put a NPC into high resolution.
Npc direction table:
| Id | Client Angle | Direction |
|:--:|:------------:|:----------:|
| 0 | 768 | North-West |
| 1 | 1024 | North |
| 2 | 1280 | North-East |
| 3 | 512 | West |
| 4 | 1536 | East |
| 5 | 256 | South-West |
| 6 | 0 | South |
| 7 | 1792 | South-East |Parameters
the index of the npc in the world
the id of the npc in the world, limited to range of 0..16383
the height level of the npc
the absolute x coordinate of the npc
the absolute z coordinate of the npc
the game cycle on which the npc spawned into the world; for static NPCs, this would always be zero. This is only used by the C++ clients.
the direction that the npc will face on spawn (see table above)
Properties
Extended info repository, commonly referred to as "masks", will track everything relevant inside itself. Setting properties such as a spotanim would be done through this. The extendedInfo is also responsible for caching the non-temporary blocks, such as appearance and move speed.
Functions
Handles any changes to be done to the avatar post its update. This will clean up any extended info blocks and update the last coordinate to match up with the current (set earlier in the cycle).
Sets this avatar inaccessible, meaning no player can observe this NPC, but they are still in the world. This is how NPCs in the 'dead' state will be handled.
A helper function to teleport the NPC to a new coordinate. This will furthermore mark the movement type as teleport, meaning no matter what other coordinate changes are applied, as teleport has the highest priority, teleportation will be how it is rendered on the client's end.
Updates the spawn direction of the NPC.