Verified naming
Spotanim Mask
The spotanim mask is used to request the client to play a graphics on an NPC or player. The graphics will follow the entity if it moves.
Table of contents
Supported Variables
The spotanim mask allows the server to specify various variables to modify the positioning and timing of the spotanim playback. Below is a breakdown of the different variables that the server defines:
- The id of the spotanim is defined as an unsigned short.
- Two variables are encoded into a single unsigned int.
- The delay in client ticks before the spotanim is played is written as the 16 right-most bits.
- The height at which the spotanim will be played is written as the 16 left-most bits. A player character measures about 200 units for reference.
Use Cases
The spotanim mask is used in various aspect of the games, usually in combination with the sequence mask. A simple example of it would be the purple teleport spotanim that is used for most regular teleports within the game.
Client Code
Below is the refactored version of the client code behind the spotanim mask.
All the buffer methods shown below can have different transformations applied on them, depending on the revision of the client. For the purposes of the demonstration, all transformations have been excluded.
entity.graphicsId = buffer.readUnsignedShort();
if (entity.graphicsId == 65535) {
entity.graphicsId = -1;
}
int packedHeightAndDelay = readInt();
entity.graphicsHeight = packedHeightAndDelay >> 16;
entity.graphicsDelay = (packedHeightAndDelay & 0xFFFF) + Client.gameCycle;
entity.spotAnimFrame = 0;
entity.spotAnimFrameCycle = 0;
if (entity.graphicsDelay > Client.gameCycle) {
entity.spotAnimFrame = -1;
}