diff --git a/Server/src/main/content/region/wilderness/handlers/WildernessPlugin.java b/Server/src/main/content/region/wilderness/handlers/WildernessPlugin.java index 2f9a764a6..1876e9866 100644 --- a/Server/src/main/content/region/wilderness/handlers/WildernessPlugin.java +++ b/Server/src/main/content/region/wilderness/handlers/WildernessPlugin.java @@ -12,8 +12,9 @@ import core.game.world.map.Location; import core.game.world.update.flag.context.Animation; import core.plugin.Initializable; import core.plugin.Plugin; +import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.hasRequirement; +import static core.api.ContentAPIKt.*; /** * Represents a plugin used to handle wilderness nodes. @@ -120,6 +121,8 @@ public final class WildernessPlugin extends OptionHandler { switch (id) { case 1816:// kbd lever. if (player.getLocation().withinDistance(LOCATIONS[5])) { + animate(player, 2140, false); + playAudio(player, Sounds.LEVER_2400); player.getPacketDispatch().sendMessage("You pull the lever..."); player.getTeleporter().send(LOCATIONS[4], TeleportType.NORMAL); player.getPacketDispatch().sendMessage("... and teleport into the lair of the King Black Dragon!", 5); @@ -127,6 +130,8 @@ public final class WildernessPlugin extends OptionHandler { break; case 1817: if (player.getLocation().withinDistance(LOCATIONS[4])) { + animate(player, 2140, false); + playAudio(player, Sounds.LEVER_2400); player.getPacketDispatch().sendMessage("You pull the lever..."); player.getTeleporter().send(LOCATIONS[5], TeleportType.NORMAL); player.getPacketDispatch().sendMessage("... and teleport out of the lair of the King Black Dragon!", 5); diff --git a/Server/src/main/core/api/ContentAPI.kt b/Server/src/main/core/api/ContentAPI.kt index 9c860eded..492064cdb 100644 --- a/Server/src/main/core/api/ContentAPI.kt +++ b/Server/src/main/core/api/ContentAPI.kt @@ -818,6 +818,21 @@ fun playAudio(player: Player, audio: Audio, global: Boolean = false) { player.audioManager.send(audio, global) } +/** + * Plays the given Audio for the given Entity + * @param player the player to play the audio for + * @param audio the audio to play + * @param volume the volume + * @param delay the delay + * @param global if other nearby entities should be able to hear it + * @param location the location where the audio will play + * @param radius the distance the audio can be heard from the given location + */ +@JvmOverloads +fun playAudio(player: Player, audio: Int, volume: Int = 10, delay: Int = 0, global: Boolean = false, location: Location? = null, radius: Int = 15) { + player.audioManager.send(audio, volume, delay, global, location, radius) +} + /** * Opens a dialogue with the given dialogue key or dialogue file, depending which is passed. * @param player the player to open the dialogue for diff --git a/Server/src/main/core/game/node/entity/player/link/audio/AudioManager.java b/Server/src/main/core/game/node/entity/player/link/audio/AudioManager.java index 82fb6d29b..2b7ab8125 100644 --- a/Server/src/main/core/game/node/entity/player/link/audio/AudioManager.java +++ b/Server/src/main/core/game/node/entity/player/link/audio/AudioManager.java @@ -116,6 +116,19 @@ public class AudioManager { } } + /** + * Plays the given Audio for the given Entity. + * @param audioId the audio to play. + * @param volume the volume. + * @param delay the delay. + * @param global if other nearby entities should be able to hear it. + * @param location the location where the audio will play. + * @param radius the distance the audio can be heard from the given location. + */ + public void send(int audioId, int volume, int delay, boolean global, Location location, int radius) { + send(new Audio(audioId, volume, delay, radius), global, location); + } + /** * Gets the player. * @return the player