From 7429415732a385090d5d8573020a079bec1d8882 Mon Sep 17 00:00:00 2001 From: Avi Weinstock Date: Mon, 27 Sep 2021 16:56:40 -0400 Subject: [PATCH] Add proper sound effects for crafting runes and antifire/antiposion expiration. --- .../rs09/client/console/DeveloperConsole.kt | 25 ++++++++++++++++++- .../core/game/node/entity/player/Player.java | 2 ++ .../skill/runecrafting/RuneCraftPulse.java | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Client/src/main/kotlin/org/rs09/client/console/DeveloperConsole.kt b/Client/src/main/kotlin/org/rs09/client/console/DeveloperConsole.kt index fef3c1d3e..2b02b342f 100644 --- a/Client/src/main/kotlin/org/rs09/client/console/DeveloperConsole.kt +++ b/Client/src/main/kotlin/org/rs09/client/console/DeveloperConsole.kt @@ -253,6 +253,29 @@ object DeveloperConsole { println("Error. Plays sound effect. Use: playsound soundID soundDelay soundVolume") } } + "playsoundrange" -> { + if (argSize == 4) { + var beginID = if (clientCommand[1].toIntOrNull() == null) 0 else clientCommand[1].toInt() + var endID = if (clientCommand[2].toIntOrNull() == null) 0 else clientCommand[2].toInt() + var delay = if (clientCommand[3].toIntOrNull() == null) 0 else clientCommand[3].toInt() + if (beginID > endID) { + val tmp = endID; + endID = beginID; + beginID = tmp; + } + Thread(object : Runnable { + override fun run() { + for (i in beginID..endID) { + println("Playing sound effect ${i}") + AudioHandler.soundEffectHandler(1, i, 0) + Thread.sleep(delay.toLong()) + } + } + }).start() + } else { + println("Error. Plays sound effect. Use: playsoundrange beginID endID delay") + } + } "playsong" -> { if (argSize in 2..8) { if (clientCommand[1].toIntOrNull() == null) { @@ -427,4 +450,4 @@ object DeveloperConsole { TextureOperation12.outgoingBuffer.writeByte(command.length + 2) TextureOperation12.outgoingBuffer.writeString(command) } -} \ No newline at end of file +} diff --git a/Server/src/main/java/core/game/node/entity/player/Player.java b/Server/src/main/java/core/game/node/entity/player/Player.java index 4a8278c63..93d5c52c7 100644 --- a/Server/src/main/java/core/game/node/entity/player/Player.java +++ b/Server/src/main/java/core/game/node/entity/player/Player.java @@ -480,6 +480,7 @@ public class Player extends Entity { if(time == 0){ sendMessage(colorize("%RYour antifire potion has expired.")); removeAttribute("fire:immune"); + getAudioManager().send(2607); } } if(getAttribute("poison:immunity",0) > 0){ @@ -491,6 +492,7 @@ public class Player extends Entity { if(time == 0){ sendMessage(colorize("%RYour antipoison potion has expired.")); removeAttribute("poison:immunity"); + getAudioManager().send(2607); } } if (!artificial && (System.currentTimeMillis() - getSession().getLastPing()) > 20_000L) { diff --git a/Server/src/main/java/core/game/node/entity/skill/runecrafting/RuneCraftPulse.java b/Server/src/main/java/core/game/node/entity/skill/runecrafting/RuneCraftPulse.java index 6da870aba..f36ac0362 100644 --- a/Server/src/main/java/core/game/node/entity/skill/runecrafting/RuneCraftPulse.java +++ b/Server/src/main/java/core/game/node/entity/skill/runecrafting/RuneCraftPulse.java @@ -133,6 +133,7 @@ public final class RuneCraftPulse extends SkillPulse { public void animate() { player.animate(ANIMATION); player.graphics(GRAPHICS); + player.getAudioManager().send(2710); } @Override