RuneHive-Game
Loading...
Searching...
No Matches
SendProjectile.java
Go to the documentation of this file.
1package com.runehive.net.packet.out;
2
3import com.runehive.game.Projectile;
4import com.runehive.game.world.entity.mob.player.Player;
5import com.runehive.game.world.position.Position;
6import com.runehive.net.packet.OutgoingPacket;
7
8public class SendProjectile extends OutgoingPacket {
9
10 private final Projectile projectile;
11 private final Position position;
12 private final int lock;
13 private final byte offsetX;
14 private final byte offsetY;
15
17 super(117, 15);
18 this.projectile = projectile;
19 this.lock = lock;
20 this.offsetX = offsetX;
21 this.offsetY = offsetY;
22 this.position = position;
23 }
24
25 @Override
26 public boolean encode(Player player) {
27 player.send(new SendCoordinate(position));
28 builder.writeByte(((projectile.getOffsetX() & 7) << 3) | (projectile.getOffsetY() & 7))
29 .writeByte(offsetX)
30 .writeByte(offsetY)
31 .writeShort(lock)
32 .writeShort(projectile.getId())
33 .writeByte(projectile.getStartHeight())
34 .writeByte(projectile.getEndHeight())
35 .writeShort(projectile.getDelay())
36 .writeShort(projectile.getDuration())
37 .writeByte(projectile.getCurve())
38 .writeByte(projectile.getDistance());
39 return true;
40 }
41
42}
This class represents a character controlled by a player.
Definition Player.java:125
Represents a single tile on the game world.
Definition Position.java:14
OutgoingPacket(int opcode, int capacity)
SendProjectile(Projectile projectile, Position position, int lock, byte offsetX, byte offsetY)