Search in sources :

Example 1 with Projectile

use of org.apollo.game.model.entity.Projectile in project apollo by apollo-rsps.

the class SendProjectileMessageEncoder method encode.

@Override
public GamePacket encode(SendProjectileMessage message) {
    Projectile projectile = message.getProjectile();
    Position source = projectile.getPosition();
    Position destination = projectile.getDestination();
    GamePacketBuilder builder = new GamePacketBuilder(181);
    builder.put(DataType.BYTE, message.getPositionOffset());
    builder.put(DataType.BYTE, destination.getX() - source.getX());
    builder.put(DataType.BYTE, destination.getY() - source.getY());
    builder.put(DataType.SHORT, projectile.getTarget());
    builder.put(DataType.SHORT, projectile.getGraphic());
    builder.put(DataType.BYTE, projectile.getStartHeight());
    builder.put(DataType.BYTE, projectile.getEndHeight());
    builder.put(DataType.SHORT, projectile.getDelay());
    builder.put(DataType.SHORT, projectile.getLifetime());
    builder.put(DataType.BYTE, projectile.getPitch());
    builder.put(DataType.BYTE, projectile.getOffset());
    return builder.toGamePacket();
}
Also used : Position(org.apollo.game.model.Position) GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder) Projectile(org.apollo.game.model.entity.Projectile)

Aggregations

Position (org.apollo.game.model.Position)1 Projectile (org.apollo.game.model.entity.Projectile)1 GamePacketBuilder (org.apollo.net.codec.game.GamePacketBuilder)1