diff --git a/game/src/main/java/org/apollo/game/message/impl/SendPlaySoundMessage.java b/game/src/main/java/org/apollo/game/message/impl/SendPlaySoundMessage.java new file mode 100644 index 000000000..9b6a8ee54 --- /dev/null +++ b/game/src/main/java/org/apollo/game/message/impl/SendPlaySoundMessage.java @@ -0,0 +1,67 @@ +package org.apollo.game.message.impl; + +import org.apollo.net.message.Message; + +/** + * A {@link Message} sent to the client to play a sound. + * + * @author tlf30 + */ +public final class SendPlaySoundMessage extends Message { + + /** + * The id of the sound to play. + */ + private final int id; + + /** + * The delay that the client should use before playing the sound. + */ + private final int delay; + + /** + * The type of sound to play. + */ + private final int type; + + /** + * Creates a new send play sound message. + * + * @param id The id of the sound to play. + * @param type The type of the sound to play. + * @param delay The delay before the client plays the sound + */ + public SendPlaySoundMessage(int id, int type, int delay) { + this.id = id; + this.type = type; + this.delay = delay; + } + + /** + * Gets the id of the sound. + * + * @return The id of the sound. + */ + public int getId() { + return id; + } + + /** + * Gets the type of the sound. + * + * @return The type of the sound. + */ + public int getType() { + return type; + } + + /** + * Gets the delay of the sound. + * + * @return The delay of the sound. + */ + public int getDelay() { + return delay; + } + +} \ No newline at end of file diff --git a/game/src/main/java/org/apollo/game/release/r377/SendPlaySoundMessageEncoder.java b/game/src/main/java/org/apollo/game/release/r377/SendPlaySoundMessageEncoder.java new file mode 100644 index 000000000..acb800bdc --- /dev/null +++ b/game/src/main/java/org/apollo/game/release/r377/SendPlaySoundMessageEncoder.java @@ -0,0 +1,27 @@ +package org.apollo.game.release.r377; + +import org.apollo.game.message.impl.SendFriendMessage; +import org.apollo.game.message.impl.SendPlaySoundMessage; +import org.apollo.net.codec.game.DataType; +import org.apollo.net.codec.game.GamePacket; +import org.apollo.net.codec.game.GamePacketBuilder; +import org.apollo.net.release.MessageEncoder; +import org.apollo.util.NameUtil; + +/** + * A {@link MessageEncoder} for the {@link SendPlaySoundMessage}. + * + * @author tlf30 + */ +public final class SendPlaySoundMessageEncoder extends MessageEncoder { + + @Override + public GamePacket encode(SendPlaySoundMessage message) { + GamePacketBuilder builder = new GamePacketBuilder(26); + builder.put(DataType.SHORT, message.getId()); + builder.put(DataType.BYTE, message.getType()); + builder.put(DataType.SHORT, message.getDelay()); + return builder.toGamePacket(); + } + +} \ No newline at end of file