diff --git a/Server/src/main/content/data/EnchantedJewellery.kt b/Server/src/main/content/data/EnchantedJewellery.kt index c70fb20d3..f2558d8a7 100644 --- a/Server/src/main/content/data/EnchantedJewellery.kt +++ b/Server/src/main/content/data/EnchantedJewellery.kt @@ -6,7 +6,6 @@ import core.api.* import core.game.event.TeleportEvent import core.game.node.entity.player.Player import core.game.node.entity.player.link.TeleportManager -import core.game.node.entity.player.link.audio.Audio import core.game.node.item.Item import core.game.system.task.Pulse import core.game.world.map.Location @@ -14,6 +13,7 @@ import core.game.world.update.flag.context.Animation import core.game.world.update.flag.context.Graphics import org.rs09.consts.Items import core.game.world.GameWorld.Pulser +import org.rs09.consts.Sounds import java.util.* /** @@ -223,7 +223,7 @@ enum class EnchantedJewellery( 0 -> { lock(player,4) visualize(player, ANIMATION, GRAPHICS) - playAudio(player, AUDIO, true) + playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) player.impactHandler.disabledTicks = 4 } 3 -> { @@ -325,7 +325,6 @@ enum class EnchantedJewellery( companion object { private val ANIMATION = Animation(714) - private val AUDIO = Audio(200) private val GRAPHICS = Graphics(308, 100, 50) val idMap = HashMap() diff --git a/Server/src/main/content/global/handlers/iface/ExperienceInterface.kt b/Server/src/main/content/global/handlers/iface/ExperienceInterface.kt index 7dd933efa..be4d2599e 100644 --- a/Server/src/main/content/global/handlers/iface/ExperienceInterface.kt +++ b/Server/src/main/content/global/handlers/iface/ExperienceInterface.kt @@ -5,12 +5,11 @@ import core.game.component.Component import core.game.component.ComponentDefinition import core.game.component.ComponentPlugin import core.game.node.entity.player.Player -import core.game.node.entity.player.link.audio.Audio import core.game.node.entity.skill.Skills import core.plugin.Initializable import core.plugin.Plugin import core.tools.Log -import core.tools.SystemLogger +import org.rs09.consts.Sounds /** * Represents the experience interface. @@ -94,7 +93,7 @@ class ExperienceInterface() : ComponentPlugin() { /** * Represents the sound to send. */ - private val SOUND = Audio(1270, 12, 1) + private val SOUND = Sounds.TBCU_FINDGEM_1270 @JvmField public val COMPONENT_ID = 134 } diff --git a/Server/src/main/content/global/handlers/iface/ge/StockMarket.kt b/Server/src/main/content/global/handlers/iface/ge/StockMarket.kt index 944e43055..dd1d345d3 100644 --- a/Server/src/main/content/global/handlers/iface/ge/StockMarket.kt +++ b/Server/src/main/content/global/handlers/iface/ge/StockMarket.kt @@ -4,7 +4,6 @@ import core.api.* import core.game.component.Component import core.game.ge.OfferState import core.game.node.entity.player.Player -import core.game.node.entity.player.link.audio.Audio import core.game.node.item.Item import core.net.packet.PacketRepository import core.net.packet.context.ConfigContext @@ -19,6 +18,7 @@ import core.game.ge.PriceIndex import core.game.interaction.InterfaceListener import core.tools.Log import core.tools.SystemLogger +import org.rs09.consts.Sounds import kotlin.math.min /** @@ -230,13 +230,13 @@ class StockMarket : InterfaceListener { { if(offer.offeredValue < 1) { - playAudio(player, Audio(4039, 1, 1)) + playAudio(player, Sounds.GE_TRADE_ERROR_4039) sendMessage(player, "You can't make an offer for 0 coins.") return OfferConfirmResult.ZeroCoins } if(offer.amount > Int.MAX_VALUE / offer.offeredValue) { - playAudio(player, Audio(4039, 1, 1)) + playAudio(player, Sounds.GE_TRADE_ERROR_4039) sendMessage(player, "You can't ${if(offer.sell) "sell" else "buy"} this much!") return OfferConfirmResult.TooManyCoins } @@ -246,7 +246,7 @@ class StockMarket : InterfaceListener { val maxAmt = getInventoryAmount(player, offer.itemID) if(offer.amount > maxAmt) { - playAudio(player, Audio(4039, 1, 1)) + playAudio(player, Sounds.GE_TRADE_ERROR_4039) sendMessage(player, "You do not have enough of this item in your inventory to cover the") sendMessage(player, "offer.") return OfferConfirmResult.NotEnoughItemsOrCoins @@ -275,7 +275,7 @@ class StockMarket : InterfaceListener { val total = offer.amount * offer.offeredValue if(!inInventory(player, 995, total)) { - playAudio(player, Audio(4039, 1, 1)) + playAudio(player, Sounds.GE_TRADE_ERROR_4039) sendMessage(player, "You do not have enough coins to cover the offer.") return OfferConfirmResult.NotEnoughItemsOrCoins } @@ -284,7 +284,7 @@ class StockMarket : InterfaceListener { player.removeAttribute("ge-temp") } } - playAudio(player, Audio(4043, 1, 1)) + playAudio(player, Sounds.GE_PLACE_ITEM_4043) offer.visualize(player) toMainInterface(player) return OfferConfirmResult.Success @@ -360,7 +360,7 @@ class StockMarket : InterfaceListener { val note = item.noteChange if(note == -1 || !hasSpaceFor(player, Item(note, item.amount))) { - playAudio(player, Audio(4039, 1, 1)) + playAudio(player, Sounds.GE_TRADE_ERROR_4039) sendMessage(player, "You do not have enough room in your inventory.") return } diff --git a/Server/src/main/content/global/handlers/item/DragonfireShieldPlugin.java b/Server/src/main/content/global/handlers/item/DragonfireShieldPlugin.java index d43770722..78f464d07 100644 --- a/Server/src/main/content/global/handlers/item/DragonfireShieldPlugin.java +++ b/Server/src/main/content/global/handlers/item/DragonfireShieldPlugin.java @@ -13,8 +13,6 @@ import core.game.node.entity.impl.Projectile; import core.game.node.entity.player.Player; import core.game.node.item.Item; import core.game.node.item.ItemPlugin; -import core.game.world.map.MapDistance; -import core.game.world.map.RegionManager; import core.game.world.update.flag.context.Animation; import core.game.world.update.flag.context.Graphics; import core.plugin.Initializable; @@ -87,7 +85,7 @@ public final class DragonfireShieldPlugin extends OptionHandler { setVarp(player, 301, 0); } player.removeAttribute("dfs_spec"); - playAudio(entity.asPlayer(), Sounds.DRAGONSLAYER_SHIELDFIRE_3761, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.DRAGONSLAYER_SHIELDFIRE_3761); Item shield = player.getEquipment().get(EquipmentContainer.SLOT_SHIELD); if (shield == null || shield.getId() != 11283) { return -1; @@ -103,7 +101,7 @@ public final class DragonfireShieldPlugin extends OptionHandler { } @Override public void visualizeImpact(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.FIRESTRIKE_HIT_161, 10, 20, true, victim.getLocation(), 5); + playGlobalAudio(victim.getLocation(), Sounds.FIRESTRIKE_HIT_161, 20); super.visualizeImpact(entity, victim, state); } @@ -120,7 +118,7 @@ public final class DragonfireShieldPlugin extends OptionHandler { player.getInventory().replace(new Item(11284), item.getSlot()); player.graphics(Graphics.create(1160)); player.getPacketDispatch().sendMessage("You release the charges."); - playAudio(player,Sounds.DRAGONSLAYER_SHIELD_EMPTY_3760); + playGlobalAudio(player.getLocation(), Sounds.DRAGONSLAYER_SHIELD_EMPTY_3760); return true; case "inspect": if (item.getId() == 11284) { diff --git a/Server/src/main/content/global/handlers/item/EnchantJewelleryTabListener.kt b/Server/src/main/content/global/handlers/item/EnchantJewelleryTabListener.kt index 66a04a9a0..8cea16326 100644 --- a/Server/src/main/content/global/handlers/item/EnchantJewelleryTabListener.kt +++ b/Server/src/main/content/global/handlers/item/EnchantJewelleryTabListener.kt @@ -4,8 +4,8 @@ import core.api.* import core.game.interaction.IntType import core.game.interaction.InteractionListener import core.game.interaction.QueueStrength -import core.game.node.entity.player.link.audio.Audio import org.rs09.consts.Items +import org.rs09.consts.Sounds class EnchantJewelleryTabListener : InteractionListener { @@ -71,7 +71,7 @@ class EnchantJewelleryTabListener : InteractionListener { val product = items[item.id] ?: continue if (removeItem(player, node.id) && (removeItem(player, item.id))) { addItem(player, product) - playAudio(player, Audio(979), false) + playAudio(player, Sounds.POH_TABLET_BREAK_979) animate(player, 4069, true) break } diff --git a/Server/src/main/content/global/handlers/item/FishbowlPlugin.java b/Server/src/main/content/global/handlers/item/FishbowlPlugin.java index 0c6146745..09cbfb5b2 100644 --- a/Server/src/main/content/global/handlers/item/FishbowlPlugin.java +++ b/Server/src/main/content/global/handlers/item/FishbowlPlugin.java @@ -74,7 +74,7 @@ public class FishbowlPlugin extends OptionHandler { if (player.getInventory().remove(item)) { player.lock(2); player.getInventory().add(new Item(FISHBOWL_EMPTY)); - playAudio(player, Sounds.LIQUID_2401, 1); + playAudio(player, Sounds.LIQUID_2401); player.getPacketDispatch().sendMessage("You empty the contents of the fishbowl onto the ground."); } break; diff --git a/Server/src/main/content/global/handlers/item/equipment/special/AncientMaceSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/AncientMaceSpecialHandler.java index aa3c10502..330523540 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/AncientMaceSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/AncientMaceSpecialHandler.java @@ -13,7 +13,7 @@ import core.plugin.Initializable; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the ancient mace special attack "Favour of the War God". @@ -75,7 +75,7 @@ public final class AncientMaceSpecialHandler extends MeleeSwingHandler implement @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.GOBLIN_MACE_3592, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.GOBLIN_MACE_3592); entity.visualize(ANIMATION, GRAPHIC); } } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/BackstabSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/BackstabSpecialHandler.java index d394d288e..bb243ad37 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/BackstabSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/BackstabSpecialHandler.java @@ -14,7 +14,7 @@ import core.plugin.Initializable; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the Bone dagger special attack "Backstab". @@ -73,7 +73,7 @@ public final class BackstabSpecialHandler extends MeleeSwingHandler implements P @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.DTTD_BONE_DAGGER_STAB_1084, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.DTTD_BONE_DAGGER_STAB_1084); entity.visualize(ANIMATION, GRAPHIC); } } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/ChainhitSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/ChainhitSpecialHandler.java index 1b372e468..a4682149f 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/ChainhitSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/ChainhitSpecialHandler.java @@ -25,7 +25,7 @@ import org.rs09.consts.Sounds; import java.util.Iterator; import java.util.List; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the Rune throwing axe special attack "Chain-hit". @@ -107,7 +107,7 @@ public final class ChainhitSpecialHandler extends RangeSwingHandler implements P @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.CHAINSHOT_2528, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.CHAINSHOT_2528); entity.visualize(ANIMATION, GRAPHIC); int speed = (int) (32 + (entity.getLocation().getDistance(victim.getLocation()) * 5)); Projectile.create(entity, victim, 258, 40, 36, 32, speed, 5, 11).send(); diff --git a/Server/src/main/content/global/handlers/item/equipment/special/CleaveSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/CleaveSpecialHandler.java index 5d71fd7f1..dd669c168 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/CleaveSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/CleaveSpecialHandler.java @@ -6,7 +6,6 @@ import core.game.node.entity.combat.CombatStyle; import core.game.node.entity.combat.MeleeSwingHandler; import core.game.node.entity.impl.Animator.Priority; import core.game.node.entity.player.Player; -import core.game.node.entity.player.link.audio.Audio; import core.game.world.update.flag.context.Animation; import core.game.world.update.flag.context.Graphics; import core.plugin.Initializable; @@ -14,7 +13,7 @@ import core.plugin.Plugin; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Represents the cleave special handler. @@ -67,7 +66,7 @@ public final class CleaveSpecialHandler extends MeleeSwingHandler implements Plu @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.CLEAVE_2529, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.CLEAVE_2529); entity.visualize(ANIMATION, GRAPHIC); } } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/DescentOfDarknessSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/DescentOfDarknessSpecialHandler.java index 1c3ce43c9..519f9462a 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/DescentOfDarknessSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/DescentOfDarknessSpecialHandler.java @@ -10,7 +10,6 @@ import core.game.node.entity.combat.equipment.Weapon; import core.game.node.entity.combat.equipment.Weapon.WeaponType; import core.game.node.entity.impl.Projectile; import core.game.node.entity.player.Player; -import core.game.node.entity.player.link.audio.Audio; import core.game.world.update.flag.context.Graphics; import core.plugin.Initializable; import core.plugin.Plugin; @@ -18,7 +17,7 @@ import core.tools.RandomFunction; import core.game.node.entity.combat.RangeSwingHandler; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Represents the descent of darkness sepcial handler. @@ -146,8 +145,8 @@ public final class DescentOfDarknessSpecialHandler extends RangeSwingHandler imp @Override public void visualizeImpact(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.DARKBOW_SHADOW_ATTACK_3736, 10, 20, true, victim.getLocation(), 10); - playAudio(entity.asPlayer(), Sounds.DARKBOW_SHADOW_IMPACT_3737, 10, 40, true, victim.getLocation(), 10); + playGlobalAudio(victim.getLocation(), Sounds.DARKBOW_SHADOW_ATTACK_3736, 20); + playGlobalAudio(victim.getLocation(), Sounds.DARKBOW_SHADOW_IMPACT_3737, 40); victim.visualize(victim.getProperties().getDefenceAnimation(), state.isFrozen() ? DRAGON_IMPACT : DARKNESS_IMPACT); } } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/EnergyDrainSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/EnergyDrainSpecialHandler.java index 58f44294b..c7b6dec41 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/EnergyDrainSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/EnergyDrainSpecialHandler.java @@ -14,7 +14,7 @@ import core.plugin.Plugin; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the Abyssal whip's Energy drain special attack. @@ -70,7 +70,7 @@ public final class EnergyDrainSpecialHandler extends MeleeSwingHandler implement @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.ENERGYDRAIN_2713, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.ENERGYDRAIN_2713); entity.animate(ANIMATION); victim.graphics(GRAPHIC); } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/FeintSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/FeintSpecialHandler.java index 4b0e0567e..73b45bc45 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/FeintSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/FeintSpecialHandler.java @@ -12,7 +12,7 @@ import core.plugin.Plugin; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles Vesta's Longsword special attack, feint. @@ -61,7 +61,7 @@ public final class FeintSpecialHandler extends MeleeSwingHandler implements Plug @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.CLEAVE_2529, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.CLEAVE_2529); entity.animate(ANIMATION); } } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/HealingBladeSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/HealingBladeSpecialHandler.java index 70e7939a5..76780908b 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/HealingBladeSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/HealingBladeSpecialHandler.java @@ -6,7 +6,6 @@ import core.game.node.entity.combat.CombatStyle; import core.game.node.entity.combat.MeleeSwingHandler; import core.game.node.entity.impl.Animator.Priority; import core.game.node.entity.player.Player; -import core.game.node.entity.player.link.audio.Audio; import core.game.world.update.flag.context.Animation; import core.game.world.update.flag.context.Graphics; import core.plugin.Plugin; @@ -14,7 +13,7 @@ import core.plugin.Initializable; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the healing blade special attack. @@ -77,7 +76,7 @@ public final class HealingBladeSpecialHandler extends MeleeSwingHandler implemen @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.GODWARS_SARADOMIN_SPECIAL_3857, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.GODWARS_SARADOMIN_SPECIAL_3857); entity.visualize(ANIMATION, GRAPHIC); } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/IceCleaveSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/IceCleaveSpecialHandler.java index cb5374403..42053679b 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/IceCleaveSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/IceCleaveSpecialHandler.java @@ -75,7 +75,7 @@ public final class IceCleaveSpecialHandler extends MeleeSwingHandler implements @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.GODWARS_GODSWORD_SLASH_3846, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.GODWARS_GODSWORD_SLASH_3846); entity.visualize(ANIMATION, GRAPHIC); } } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/ImpaleSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/ImpaleSpecialHandler.java index 57d178c19..11ddbd9f9 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/ImpaleSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/ImpaleSpecialHandler.java @@ -14,7 +14,7 @@ import core.plugin.Initializable; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the Rune claws special attack "Impale". @@ -67,7 +67,7 @@ public final class ImpaleSpecialHandler extends MeleeSwingHandler implements Plu @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.IMPALE_2534, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.IMPALE_2534); if (((Player) entity).getDetails().getRights() == Rights.ADMINISTRATOR) { entity.animate(Animation.create(2068)); return; diff --git a/Server/src/main/content/global/handlers/item/equipment/special/JudgementSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/JudgementSpecialHandler.java index 585753830..0fb647924 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/JudgementSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/JudgementSpecialHandler.java @@ -6,7 +6,6 @@ import core.game.node.entity.combat.CombatStyle; import core.game.node.entity.combat.MeleeSwingHandler; import core.game.node.entity.impl.Animator.Priority; import core.game.node.entity.player.Player; -import core.game.node.entity.player.link.audio.Audio; import core.game.world.update.flag.context.Animation; import core.game.world.update.flag.context.Graphics; import core.plugin.Initializable; @@ -14,7 +13,7 @@ import core.plugin.Plugin; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the Judgement special attack. @@ -67,7 +66,7 @@ public final class JudgementSpecialHandler extends MeleeSwingHandler implements @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.GODWARS_GODSWORD_SPECIAL_ATTACK_3865, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.GODWARS_GODSWORD_SPECIAL_ATTACK_3865); entity.visualize(ANIMATION, GRAPHIC); } } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/PowershotSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/PowershotSpecialHandler.java index a0bbc73dd..aca1a0070 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/PowershotSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/PowershotSpecialHandler.java @@ -12,7 +12,7 @@ import core.tools.RandomFunction; import core.game.node.entity.combat.RangeSwingHandler; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the Magic longbow special attack "Powershot". @@ -67,7 +67,7 @@ public final class PowershotSpecialHandler extends RangeSwingHandler implements @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.POWERSHOT_2536, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.POWERSHOT_2536); entity.visualize(state.getRangeWeapon().getAnimation(), GRAPHIC); int speed = (int) (46 + (entity.getLocation().getDistance(victim.getLocation()) * 5)); Projectile.create(entity, victim, 249, 40, 36, 45, speed, 5, 11).send(); diff --git a/Server/src/main/content/global/handlers/item/equipment/special/PowerstabSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/PowerstabSpecialHandler.java index f659fad7b..4c7ea7a83 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/PowerstabSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/PowerstabSpecialHandler.java @@ -18,7 +18,7 @@ import core.plugin.Initializable; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the Powerstab special attack. @@ -97,7 +97,7 @@ public final class PowerstabSpecialHandler extends MeleeSwingHandler implements @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.DRAGON_AXE_THUNDER_2530, 10, 0, true, entity.asPlayer().getLocation(), 6); + playGlobalAudio(entity.getLocation(), Sounds.DRAGON_AXE_THUNDER_2530); entity.visualize(ANIMATION, GRAPHIC); } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/PunctureSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/PunctureSpecialHandler.java index b335e2c1e..e489173fc 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/PunctureSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/PunctureSpecialHandler.java @@ -13,7 +13,7 @@ import core.plugin.Plugin; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the puncture special attack combat swing. @@ -82,7 +82,7 @@ public final class PunctureSpecialHandler extends MeleeSwingHandler implements P @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.PUNCTURE_2537, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.PUNCTURE_2537); entity.visualize(ANIMATION, GRAPHIC); } } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/QuickSmashSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/QuickSmashSpecialHandler.java index 615bb0f46..cc5e5a557 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/QuickSmashSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/QuickSmashSpecialHandler.java @@ -6,7 +6,6 @@ import core.game.node.entity.combat.CombatStyle; import core.game.node.entity.combat.MeleeSwingHandler; import core.game.node.entity.impl.Animator.Priority; import core.game.node.entity.player.Player; -import core.game.node.entity.player.link.audio.Audio; import core.game.world.GameWorld; import core.game.world.update.flag.context.Animation; import core.game.world.update.flag.context.Graphics; @@ -15,7 +14,7 @@ import core.plugin.Plugin; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the granite maul special attack. @@ -81,7 +80,7 @@ public final class QuickSmashSpecialHandler extends MeleeSwingHandler implements @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.QUICKSMASH_2715, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.QUICKSMASH_2715); entity.visualize(ANIMATION, GRAPHIC); victim.animate(victim.getProperties().getDefenceAnimation()); } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/RampageSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/RampageSpecialHandler.java index 3656a328e..0aef9cd2b 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/RampageSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/RampageSpecialHandler.java @@ -61,7 +61,7 @@ public final class RampageSpecialHandler extends MeleeSwingHandler implements Pl return -1; } p.sendChat("Raarrrrrgggggghhhhhhh!"); - playAudio(entity.asPlayer(), Sounds.RAMPAGE_2538, 1); + playAudio(entity.asPlayer(), Sounds.RAMPAGE_2538); p.visualize(ANIMATION, GRAPHIC); @SuppressWarnings("unused") int boost = 0; diff --git a/Server/src/main/content/global/handlers/item/equipment/special/SaradominsLightningHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/SaradominsLightningHandler.java index f87a3e1b0..3875ba7be 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/SaradominsLightningHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/SaradominsLightningHandler.java @@ -6,7 +6,6 @@ import core.game.node.entity.combat.CombatStyle; import core.game.node.entity.combat.MeleeSwingHandler; import core.game.node.entity.impl.Animator.Priority; import core.game.node.entity.player.Player; -import core.game.node.entity.player.link.audio.Audio; import core.game.world.update.flag.context.Animation; import core.game.world.update.flag.context.Graphics; import core.plugin.Plugin; @@ -14,7 +13,7 @@ import core.plugin.Initializable; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the Saradomin sword special attack. @@ -77,7 +76,7 @@ public final class SaradominsLightningHandler extends MeleeSwingHandler implemen @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.GODWARS_SARADOMIN_MAGIC_IMPACT_3853, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.GODWARS_SARADOMIN_MAGIC_IMPACT_3853); entity.visualize(ANIMATION, GRAPHIC); } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/SeercullSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/SeercullSpecialHandler.java index 273c65b03..5d9bc30ef 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/SeercullSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/SeercullSpecialHandler.java @@ -13,7 +13,7 @@ import core.plugin.Initializable; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Represents the Seercull's special attack which lowers the opponent's magic @@ -69,7 +69,7 @@ public final class SeercullSpecialHandler extends RangeSwingHandler implements P @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.SOULSHOT_2546, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.SOULSHOT_2546); victim.graphics(new Graphics(474)); int speed = (int) (35 + (entity.getLocation().getDistance(victim.getLocation()) * 10)); entity.visualize(entity.getProperties().getAttackAnimation(), DRAWBACK_GFX); diff --git a/Server/src/main/content/global/handlers/item/equipment/special/SeverSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/SeverSpecialHandler.java index 226cfdb43..116e993d4 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/SeverSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/SeverSpecialHandler.java @@ -14,7 +14,7 @@ import core.plugin.Initializable; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the Sever special attack. @@ -80,7 +80,7 @@ public final class SeverSpecialHandler extends MeleeSwingHandler implements Plug @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.SEVER_2540, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.SEVER_2540); entity.visualize(ANIMATION, GRAPHIC); } } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/ShatterSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/ShatterSpecialHandler.java index 1720d88f5..aebbd909f 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/ShatterSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/ShatterSpecialHandler.java @@ -6,7 +6,6 @@ import core.game.node.entity.combat.CombatStyle; import core.game.node.entity.combat.MeleeSwingHandler; import core.game.node.entity.impl.Animator.Priority; import core.game.node.entity.player.Player; -import core.game.node.entity.player.link.audio.Audio; import core.game.world.update.flag.context.Animation; import core.game.world.update.flag.context.Graphics; import core.plugin.Initializable; @@ -14,7 +13,7 @@ import core.plugin.Plugin; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the Shatter special attack. @@ -66,7 +65,7 @@ public final class ShatterSpecialHandler extends MeleeSwingHandler implements Pl @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.SHATTER_2541, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.SHATTER_2541); entity.visualize(ANIMATION, GRAPHIC); } } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/ShoveSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/ShoveSpecialHandler.java index 407a6eafe..12d92744b 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/ShoveSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/ShoveSpecialHandler.java @@ -16,8 +16,7 @@ import core.plugin.Initializable; import core.plugin.Plugin; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; -import static core.api.ContentAPIKt.stun; +import static core.api.ContentAPIKt.*; /** * Handles the dragon spear special attack. @@ -111,7 +110,7 @@ public final class ShoveSpecialHandler extends MeleeSwingHandler implements Plug @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.SHOVE_2544, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.SHOVE_2544); entity.visualize(ANIMATION, GRAPHIC); } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/SliceAndDiceSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/SliceAndDiceSpecialHandler.java index 76704c3ea..808cae7a4 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/SliceAndDiceSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/SliceAndDiceSpecialHandler.java @@ -13,7 +13,7 @@ import core.plugin.Plugin; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the Dragon claws special attack "Slice and Dice". @@ -104,7 +104,7 @@ public final class SliceAndDiceSpecialHandler extends MeleeSwingHandler implemen @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.PUNCTURE_2537, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.PUNCTURE_2537); entity.visualize(ANIMATION, GRAPHIC); } } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/SmashSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/SmashSpecialHandler.java index 908821343..e4137d26c 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/SmashSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/SmashSpecialHandler.java @@ -14,7 +14,7 @@ import core.plugin.Plugin; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles Statius' Warhammer special attack - Smash. @@ -69,7 +69,7 @@ public final class SmashSpecialHandler extends MeleeSwingHandler implements Plug @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.TZHAAR_KET_OM_CRUSH_2520, 10, 0, true, entity.asPlayer().getLocation(), 4); + playGlobalAudio(entity.getLocation(), Sounds.TZHAAR_KET_OM_CRUSH_2520); entity.visualize(ANIMATION, GRAPHIC); } } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/SnapshotSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/SnapshotSpecialHandler.java index b851573c8..ddd761a21 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/SnapshotSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/SnapshotSpecialHandler.java @@ -16,7 +16,7 @@ import core.game.node.entity.combat.RangeSwingHandler; import core.game.world.GameWorld; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the magic shortbow special attack "Snapshot". @@ -102,7 +102,7 @@ public final class SnapshotSpecialHandler extends RangeSwingHandler implements P @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.SNAPSHOT_2545, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.SNAPSHOT_2545); entity.visualize(ANIMATION, GRAPHIC); int speed = (int) (27 + (entity.getLocation().getDistance(victim.getLocation()) * 5)); Projectile.create(entity, victim, 249, 40, 36, 20, speed, 15, 11).send(); diff --git a/Server/src/main/content/global/handlers/item/equipment/special/SnipeSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/SnipeSpecialHandler.java index 9ee338231..b3941ef7c 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/SnipeSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/SnipeSpecialHandler.java @@ -14,7 +14,7 @@ import core.tools.RandomFunction; import core.game.node.entity.combat.RangeSwingHandler; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Represents the Dorgeshuun crossbow's special attack - snipe. @@ -71,7 +71,7 @@ public final class SnipeSpecialHandler extends RangeSwingHandler implements Plug @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.DTTD_BONE_CROSSBOW_SA_1080, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.DTTD_BONE_CROSSBOW_SA_1080); entity.animate(ANIMATION); Projectile.create(entity, victim, 698, 36, 25, 35, 72).send(); } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/SpearWallSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/SpearWallSpecialHandler.java index 20ade75cd..bdbef4ee4 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/SpearWallSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/SpearWallSpecialHandler.java @@ -18,7 +18,7 @@ import core.plugin.Initializable; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles Vesta's Spear special attack - Spear Wall. @@ -96,7 +96,7 @@ public final class SpearWallSpecialHandler extends MeleeSwingHandler implements @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.CLEAVE_2529, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.CLEAVE_2529); entity.visualize(ANIMATION, GRAPHIC); } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/SweepSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/SweepSpecialHandler.java index 80f273024..4b7947736 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/SweepSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/SweepSpecialHandler.java @@ -21,7 +21,7 @@ import core.plugin.Plugin; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the Dragon halberd special attack. @@ -159,7 +159,7 @@ public final class SweepSpecialHandler extends MeleeSwingHandler implements Plug @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.HALBERD_SWIPE_2533, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.HALBERD_SWIPE_2533); entity.visualize(ANIMATION, GRAPHIC); } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/WarstrikeSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/WarstrikeSpecialHandler.java index 0edd3ef68..8982b198b 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/WarstrikeSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/WarstrikeSpecialHandler.java @@ -7,7 +7,6 @@ import core.game.node.entity.combat.CombatStyle; import core.game.node.entity.combat.MeleeSwingHandler; import core.game.node.entity.impl.Animator.Priority; import core.game.node.entity.player.Player; -import core.game.node.entity.player.link.audio.Audio; import core.game.world.update.flag.context.Animation; import core.game.world.update.flag.context.Graphics; import core.plugin.Plugin; @@ -15,7 +14,7 @@ import core.plugin.Initializable; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles the Warstrike special attack. @@ -86,7 +85,7 @@ public final class WarstrikeSpecialHandler extends MeleeSwingHandler implements @Override public void visualize(Entity entity, Entity victim, BattleState state) { - playAudio(entity.asPlayer(), Sounds.GODWARS_SARADOMIN_MAGIC_CASTANDFIRE_3834, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.GODWARS_SARADOMIN_MAGIC_CASTANDFIRE_3834); entity.visualize(ANIMATION, GRAPHIC); } } diff --git a/Server/src/main/content/global/handlers/item/equipment/special/WeakenSpecialHandler.java b/Server/src/main/content/global/handlers/item/equipment/special/WeakenSpecialHandler.java index c9812fa5e..0fda16c8c 100644 --- a/Server/src/main/content/global/handlers/item/equipment/special/WeakenSpecialHandler.java +++ b/Server/src/main/content/global/handlers/item/equipment/special/WeakenSpecialHandler.java @@ -7,7 +7,6 @@ import core.game.node.entity.combat.CombatStyle; import core.game.node.entity.combat.MeleeSwingHandler; import core.game.node.entity.impl.Animator.Priority; import core.game.node.entity.player.Player; -import core.game.node.entity.player.link.audio.Audio; import core.game.world.update.flag.context.Animation; import core.game.world.update.flag.context.Graphics; import core.plugin.Plugin; @@ -15,7 +14,7 @@ import core.plugin.Initializable; import core.tools.RandomFunction; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; +import static core.api.ContentAPIKt.playGlobalAudio; /** * Handles Darklight's special attack, Weaken. @@ -76,6 +75,6 @@ public final class WeakenSpecialHandler extends MeleeSwingHandler implements Plu @Override public void visualize(Entity entity, Entity victim, BattleState state) { entity.visualize(ANIMATION, GRAPHIC); - playAudio(entity.asPlayer(), Sounds.DARKLIGHT_WEAKEN_225, 10, 0, true, entity.asPlayer().getLocation(), 5); + playGlobalAudio(entity.getLocation(), Sounds.DARKLIGHT_WEAKEN_225); } } diff --git a/Server/src/main/content/global/handlers/item/withobject/EctophialFillListener.kt b/Server/src/main/content/global/handlers/item/withobject/EctophialFillListener.kt index c60d9f822..d2700ee2c 100644 --- a/Server/src/main/content/global/handlers/item/withobject/EctophialFillListener.kt +++ b/Server/src/main/content/global/handlers/item/withobject/EctophialFillListener.kt @@ -1,13 +1,13 @@ package content.global.handlers.item.withobject import core.api.* -import core.game.node.entity.player.link.audio.Audio import core.game.system.task.Pulse import core.game.world.update.flag.context.Animation import org.rs09.consts.Items import org.rs09.consts.Scenery import core.game.interaction.IntType import core.game.interaction.InteractionListener +import org.rs09.consts.Sounds /** * Listener for filling empty ectophial @@ -18,14 +18,13 @@ class EctophialFillListener : InteractionListener { companion object { private val ANIMATION = Animation(1652) - private val AUDIO = Audio(1132) } override fun defineListeners() { onUseWith(IntType.SCENERY, Items.ECTOPHIAL_4252, Scenery.ECTOFUNTUS_5282) { player, used, _ -> lock(player, 5) animate(player, ANIMATION) - playAudio(player, AUDIO) + playAudio(player, Sounds.FILL_ECTOPLASM_1132) submitIndividualPulse(player, object: Pulse(3) { override fun pulse(): Boolean { diff --git a/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt b/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt index 6bcbc3148..a53198e44 100644 --- a/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt +++ b/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt @@ -46,10 +46,10 @@ class WaterSourceListener : InteractionListener { sendMessage(player, formatMsgText(used.name, vessel.fillMsg)) addItemOrDrop(player, vessel.output) if(with.name.contains("well", ignoreCase = true)) { - playAudio(player, getAudio(Sounds.WELL_FILL_2615, 1)) + playAudio(player, Sounds.WELL_FILL_2615) } else { - playAudio(player, getAudio(Sounds.TAP_FILL_2609, 1)) + playAudio(player, Sounds.TAP_FILL_2609) } } diff --git a/Server/src/main/content/global/handlers/npc/SheepBehavior.kt b/Server/src/main/content/global/handlers/npc/SheepBehavior.kt index d71d9b169..a90c91baf 100644 --- a/Server/src/main/content/global/handlers/npc/SheepBehavior.kt +++ b/Server/src/main/content/global/handlers/npc/SheepBehavior.kt @@ -7,7 +7,6 @@ import core.game.interaction.InteractionListener import core.game.node.entity.combat.DeathTask import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPCBehavior -import core.game.node.entity.player.link.audio.Audio import core.game.system.task.Pulse import core.game.world.GameWorld import core.game.world.update.flag.context.Animation @@ -75,7 +74,7 @@ class SheepBehavior : NPCBehavior(*sheepIds), InteractionListener { setAttribute(player, ATTR_IS_PENGUIN_SHEEP_SHEARED, true) } animate(player, Animation(893)) - playAudio(player, Audio(Sounds.PENGUINSHEEP_ESCAPE_686), false) + playAudio(player, Sounds.PENGUINSHEEP_ESCAPE_686) sendMessage(player, "The... whatever it is... manages to get away from you!") animate(sheep, Animation(3570)) sheep.moveStep() @@ -100,7 +99,7 @@ class SheepBehavior : NPCBehavior(*sheepIds), InteractionListener { if (random != 4) { sheep.locks.lockMovement(2) sheep.transform(NPCs.SHEEP_5153) - playAudio(player, Audio(Sounds.SHEAR_SHEEP_761), false) + playAudio(player, Sounds.SHEAR_SHEEP_761) sendMessage(player, "You get some wool.") addItem(player, Items.WOOL_1737) // 5160 GameWorld.Pulser.submit(object : Pulse(80, sheep) { diff --git a/Server/src/main/content/global/handlers/scenery/MillingListener.kt b/Server/src/main/content/global/handlers/scenery/MillingListener.kt index 152d3d051..c61a8c82a 100644 --- a/Server/src/main/content/global/handlers/scenery/MillingListener.kt +++ b/Server/src/main/content/global/handlers/scenery/MillingListener.kt @@ -4,11 +4,11 @@ import core.api.* import core.game.interaction.IntType import core.game.interaction.InteractionListener import core.game.node.entity.player.Player -import core.game.node.entity.player.link.audio.Audio import core.game.node.item.Item import core.game.world.update.flag.context.Animation import org.rs09.consts.Items import org.rs09.consts.Scenery +import org.rs09.consts.Sounds private const val GRAIN = Items.GRAIN_1947 private const val SWEETCORN = Items.SWEETCORN_5986 @@ -20,7 +20,7 @@ private val HOPPER_CONTROLS = intArrayOf(Scenery.HOPPER_CONTROLS_2718, Scenery.H private val FLOUR_BINS = intArrayOf(Scenery.FLOUR_BIN_1782, Scenery.FLOUR_BIN_5792, Scenery.FLOUR_BIN_22420, Scenery.FLOUR_BIN_22421, Scenery.FLOUR_BIN_24070, Scenery.FLOUR_BIN_36878) private const val VARP = 695 private val ANIMATION = Animation(3571) -private val SOUND = Audio(3189) +private val SOUND = Sounds.GIANT_ROC_APPROACHES_3189 /** * Handles interactions with windmills diff --git a/Server/src/main/content/global/skill/agility/pyramid/AgilityPyramidCourse.java b/Server/src/main/content/global/skill/agility/pyramid/AgilityPyramidCourse.java index b7143ac7f..06cae7b1b 100644 --- a/Server/src/main/content/global/skill/agility/pyramid/AgilityPyramidCourse.java +++ b/Server/src/main/content/global/skill/agility/pyramid/AgilityPyramidCourse.java @@ -196,7 +196,7 @@ public final class AgilityPyramidCourse extends AgilityCourse { player.getPacketDispatch().sendMessage("You must be level 30 agility or higher to climb down the rocks."); return; } - playAudio(player, Sounds.CLIMBING_LOOP_2454, 6); + playAudio(player, Sounds.CLIMBING_LOOP_2454, 0, 6); if (!scale) { ForceMovement.run(player, player.getLocation(), end, Animation.create(740), Animation.create(740), Direction.WEST, 13).setEndAnimation(Animation.RESET); } else { @@ -223,7 +223,7 @@ public final class AgilityPyramidCourse extends AgilityCourse { } player.lock(4); player.getPacketDispatch().sendMessage("You climb the low wall..."); - playAudio(player, Sounds.CLIMB_WALL_2453,10, 40); + playAudio(player, Sounds.CLIMB_WALL_2453, 40); if (fail) { Location end = player.getLocation().transform(d, 1); player.lock(3); @@ -247,10 +247,10 @@ public final class AgilityPyramidCourse extends AgilityCourse { final boolean fail = player.getSkills().getLevel(Skills.AGILITY) < 75 && hasFailed(player); final Location end = player.getLocation().transform(dir.getStepX() * (fail ? 3 : 5), dir.getStepY() * (fail ? 3 : 5), 0); player.getPacketDispatch().sendMessage("You put your foot on the ledge and try to edge across..."); - playAudio(player, Sounds.BALANCING_LEDGE_2451, 5); + playAudio(player, Sounds.BALANCING_LEDGE_2451, 0, 5); if (fail) { player.lock(4); - playAudio(player, Sounds.FALL_LAND_2455, 10, 125); + playAudio(player, Sounds.FALL_LAND_2455, 125); AgilityHandler.walk(player, -1, player.getLocation(), end, Animation.create(157 - diff), 0.0, "You slip and fall to the level below."); GameWorld.getPulser().submit(new Pulse(3, player) { @Override @@ -297,13 +297,13 @@ public final class AgilityPyramidCourse extends AgilityCourse { final boolean fail = player.getSkills().getLevel(Skills.AGILITY) >= 75 ? false : hasFailed(player) ; final Location end = object.getLocation().transform(object.getId() != 10868 ? dir : dir.getOpposite(), fail ? 2 : 5); AgilityHandler.walk(player, fail ? -1 : 1, player.getLocation(), end, Animation.create(155), fail ? 0.0 : 56.4, fail ? null : "You walk carefully across the slippery plank..."); - playAudio(player, Sounds.PLANKWALK_2480, 3); + playAudio(player, Sounds.PLANKWALK_2480, 0, 3); if (fail) { GameWorld.getPulser().submit(new Pulse(2, player) { @Override public boolean pulse() { final Location dest = transformLevel(end.transform(!custom ? 2 : 0, custom ? -2 : 0, 0)); - playAudio(player, Sounds.FALL_LAND_2455, 10, 50); + playAudio(player, Sounds.FALL_LAND_2455, 50); AgilityHandler.failWalk(player, 2, end, dest, dest, Animation.create(764), 10, 10, null); return true; } @@ -331,13 +331,13 @@ public final class AgilityPyramidCourse extends AgilityCourse { } dest = transformLevel(dest); player.lock(8); - playAudio(player, Sounds.JUMP_NO_LAND_2467, 10, 30); - playAudio(player, Sounds.FALL_LAND_2455, 10, 200); + playAudio(player, Sounds.JUMP_NO_LAND_2467, 30); + playAudio(player, Sounds.FALL_LAND_2455, 200); AgilityHandler.forceWalk(player, -1, player.getLocation(), end, Animation.create(3068), 10, 0.0, "... and miss your footing."); AgilityHandler.fail(player, 8, dest, Animation.create(3068), 8, null); return; } - playAudio(player, Sounds.JUMP2_2462, 10 , 30); + playAudio(player, Sounds.JUMP2_2462, 30); player.lock(4); AgilityHandler.forceWalk(player, 2, player.getLocation(), player.getLocation().transform(dir, 3), Animation.create(3067), 20, 22, null); } @@ -355,7 +355,7 @@ public final class AgilityPyramidCourse extends AgilityCourse { int mod = player.getLocation().equals(new Location(3359, 2849, 2)) ? 0 : player.getLocation().equals(new Location(3357, 2841, 2)) ? 1 : player.getLocation().equals(new Location(3367, 2832, 1)) ? 1 : player.getLocation().equals(new Location(3372, 2832, 1)) ? 0 : object.getLocation().equals(new Location(3370, 2831, 1)) ? 0 : rot == 1 && dir == Direction.EAST ? 0 : rot == 3 && (dir == Direction.WEST || dir == Direction.EAST) ? 1 : rot == 0 && dir == Direction.SOUTH ? 1 : dir == Direction.WEST && rot != 3 || dir == Direction.EAST ? 1 : 0; final Animation animation = Animation.create(387 - mod); playAudio(player, Sounds.HANDHOLDS_GRAB_TO_SECOND_2450); - playAudio(player, Sounds.FALL_LAND_2455, 10, 170); + playAudio(player, Sounds.FALL_LAND_2455, 170); if (fail) { Location dest = object.getLocation().transform(dir, 1); dest = rot == 1 && dir == Direction.EAST ? dest.transform(1, 2, 0) : rot == 1 && dir == Direction.WEST && player.getLocation().getY() < 2841 ? dest.transform(0, -2, 0) : rot == 1 && dir == Direction.WEST ? dest.transform(0, 2, 0): dest.transform(dir == Direction.NORTH || dir == Direction.SOUTH ? -1 : dir == Direction.WEST ? 1 : 0, dir == Direction.SOUTH ? 1 : dir == Direction.WEST || dir == Direction.EAST ? -1 : 0, 0); diff --git a/Server/src/main/content/global/skill/agility/pyramid/MovingBlockNPC.java b/Server/src/main/content/global/skill/agility/pyramid/MovingBlockNPC.java index f709095d9..984fd532b 100644 --- a/Server/src/main/content/global/skill/agility/pyramid/MovingBlockNPC.java +++ b/Server/src/main/content/global/skill/agility/pyramid/MovingBlockNPC.java @@ -63,7 +63,7 @@ public final class MovingBlockNPC extends AbstractNPC { getWalkingQueue().addPath(loc.getX(), loc.getY()); for (Player p : RegionManager.getLocalPlayers(getTileLocations()[0], 4)) { checkBlock(p); - playAudio(p, Sounds.PYRAMID_BLOCK_1395, 10, 30); + playAudio(p, Sounds.PYRAMID_BLOCK_1395, 30); } moving = true; GameWorld.getPulser().submit(new Pulse(1, this) { @@ -137,7 +137,7 @@ public final class MovingBlockNPC extends AbstractNPC { } } player.lock(4); - playAudio(player, Sounds.LAND_FLAT_2469, 10 , 50); + playAudio(player, Sounds.LAND_FLAT_2469, 50); player.setAttribute("block-move", GameWorld.getTicks() + 4); if(dest != null) { AgilityHandler.failWalk(player, close ? 1 : 3, player.getLocation(), dest, AgilityPyramidCourse.transformLevel(dest), Animation.create(3066), 10, 8, null, getId() == 3124 ? Direction.WEST : Direction.SOUTH); diff --git a/Server/src/main/content/global/skill/crafting/jewellery/JewelleryPulse.java b/Server/src/main/content/global/skill/crafting/jewellery/JewelleryPulse.java index 716354915..e69a7ee29 100644 --- a/Server/src/main/content/global/skill/crafting/jewellery/JewelleryPulse.java +++ b/Server/src/main/content/global/skill/crafting/jewellery/JewelleryPulse.java @@ -58,7 +58,7 @@ public final class JewelleryPulse extends SkillPulse { public void animate() { if (ticks % 5 == 0) { player.animate(ANIMATION); - playAudio(player, Sounds.FURNACE_2725, 1); + playAudio(player, Sounds.FURNACE_2725); } } diff --git a/Server/src/main/content/global/skill/crafting/silver/SilverCraftingPulse.kt b/Server/src/main/content/global/skill/crafting/silver/SilverCraftingPulse.kt index 16cfadf1b..8bc77007c 100644 --- a/Server/src/main/content/global/skill/crafting/silver/SilverCraftingPulse.kt +++ b/Server/src/main/content/global/skill/crafting/silver/SilverCraftingPulse.kt @@ -29,7 +29,7 @@ class SilverCraftingPulse( } animate(player, Animations.HUMAN_FURNACE_SMELTING_3243) - playAudio(player, Sounds.FURNACE_2725, 1) + playAudio(player, Sounds.FURNACE_2725) if (removeItem(player, Items.SILVER_BAR_2355, Container.INVENTORY)) { addItem(player, product.producedItemId, product.amountProduced) diff --git a/Server/src/main/content/global/skill/crafting/spinning/SpinningPulse.java b/Server/src/main/content/global/skill/crafting/spinning/SpinningPulse.java index 5609beee8..ae652f9a8 100644 --- a/Server/src/main/content/global/skill/crafting/spinning/SpinningPulse.java +++ b/Server/src/main/content/global/skill/crafting/spinning/SpinningPulse.java @@ -70,7 +70,7 @@ public final class SpinningPulse extends SkillPulse { public void animate() { if (ticks % 5 == 0) { player.animate(ANIMATION); - playAudio(player, Sounds.SPINNING_2590, 1); + playAudio(player, Sounds.SPINNING_2590); } } diff --git a/Server/src/main/content/global/skill/hunter/pitfall/HunterPitfall.kt b/Server/src/main/content/global/skill/hunter/pitfall/HunterPitfall.kt index b744ab910..cfe50aef7 100644 --- a/Server/src/main/content/global/skill/hunter/pitfall/HunterPitfall.kt +++ b/Server/src/main/content/global/skill/hunter/pitfall/HunterPitfall.kt @@ -188,7 +188,7 @@ class PitfallListeners : InteractionListener { player.setAttribute("pitfall:timestamp:${pit.location.x}:${pit.location.y}", System.currentTimeMillis()) setPitState(player, pit.location, 1) - playAudio(player, getAudio(Sounds.HUNTING_PLACEBRANCHES_2639)) + playAudio(player, Sounds.HUNTING_PLACEBRANCHES_2639) val collapsePulse = object : Pulse(201, player) { override fun pulse(): Boolean { val oldTime = player.getAttribute("pitfall:timestamp:${pit.location.x}:${pit.location.y}", System.currentTimeMillis()) @@ -210,7 +210,7 @@ class PitfallListeners : InteractionListener { if(dir != null) { val dst = src.transform(dir, 3) ForceMovement.run(player, src, dst, ForceMovement.WALK_ANIMATION, Animation(1603), dir, 16) - playAudio(player, getAudio(Sounds.HUNTING_JUMP_2635)) + playAudio(player, Sounds.HUNTING_JUMP_2635) val pitfall_npc: Entity? = player.getAttribute("pitfall_npc", null) if(pitfall_npc != null && pitfall_npc.getLocation().getDistance(src) < 3.0) { val last_pit_loc: Location? = pitfall_npc.getAttribute("last_pit_loc", null) @@ -248,7 +248,7 @@ class PitfallListeners : InteractionListener { } on(SPIKED_PIT, IntType.SCENERY, "dismantle") { player, node -> val pit = node as Scenery - playAudio(player, getAudio(Sounds.HUNTING_TAKEBRANCHES_2649)) + playAudio(player, Sounds.HUNTING_TAKEBRANCHES_2649) player.removeAttribute("pitfall:timestamp:${pit.location.x}:${pit.location.y}") player.incrementAttribute("pitfall:count", -1) setPitState(player, pit.location, 0) @@ -281,7 +281,7 @@ class PitfallListeners : InteractionListener { return@on true } entity.attack(player) - playAudio(player, getAudio(Sounds.HUNTING_TEASE_FELINE_2651)) + playAudio(player, Sounds.HUNTING_TEASE_FELINE_2651) player.setAttribute("pitfall_npc", entity) return@on true } @@ -295,7 +295,7 @@ class PitfallListeners : InteractionListener { setPitState(player, pit.location, 0) player.getSkills().addExperience(Skills.HUNTER, xp, true) player.inventory.add(Item(Items.BIG_BONES_532)) - playAudio(player, getAudio(Sounds.HUNTING_TAKEBRANCHES_2649)) + playAudio(player, Sounds.HUNTING_TAKEBRANCHES_2649) // TODO: what's the actual probability of tatty vs perfect fur? val chance = RandomFunction.getSkillSuccessChance(50.0, 100.0, player.skills.getLevel(Skills.HUNTER)) if(RandomFunction.random(0.0, 100.0) < chance) { diff --git a/Server/src/main/content/global/skill/hunter/tracking/HunterTracking.kt b/Server/src/main/content/global/skill/hunter/tracking/HunterTracking.kt index e4ca5c4e1..3a56ee557 100644 --- a/Server/src/main/content/global/skill/hunter/tracking/HunterTracking.kt +++ b/Server/src/main/content/global/skill/hunter/tracking/HunterTracking.kt @@ -13,7 +13,6 @@ import core.game.world.map.Location import core.game.world.update.flag.context.Animation import core.tools.RandomFunction import org.rs09.consts.Items -import core.tools.SystemLogger import core.game.world.GameWorld import core.tools.Log import org.rs09.consts.Sounds @@ -165,7 +164,7 @@ abstract class HunterTracking : OptionHandler(){ fun reward(player: Player, success: Boolean) { player.lock() player.animator.animate(if(success) KEBBIT_ANIM else MISS_ANIM) - playAudio(player, getAudio(Sounds.HUNTING_NOOSE_2637)) + playAudio(player, Sounds.HUNTING_NOOSE_2637) GameWorld.Pulser.submit(object : Pulse(KEBBIT_ANIM.duration){ override fun pulse(): Boolean { if(hasTrail(player) && success){ diff --git a/Server/src/main/content/global/skill/magic/ancient/BloodSpells.java b/Server/src/main/content/global/skill/magic/ancient/BloodSpells.java index ee244d4f4..b3db5e3f8 100644 --- a/Server/src/main/content/global/skill/magic/ancient/BloodSpells.java +++ b/Server/src/main/content/global/skill/magic/ancient/BloodSpells.java @@ -97,7 +97,7 @@ public final class BloodSpells extends CombatSpell { projectile.transform(entity, (Entity) target, false, 58, 10).send(); } entity.animate(animation); - playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20); + playGlobalAudio(entity.getLocation(), audio.getId(), 20); } @Override diff --git a/Server/src/main/content/global/skill/magic/ancient/IceSpells.java b/Server/src/main/content/global/skill/magic/ancient/IceSpells.java index 531e5cce9..8641ac76a 100644 --- a/Server/src/main/content/global/skill/magic/ancient/IceSpells.java +++ b/Server/src/main/content/global/skill/magic/ancient/IceSpells.java @@ -102,14 +102,14 @@ public final class IceSpells extends CombatSpell { projectile.transform(entity, (Entity) target, false, 58, 10).send(); } entity.animate(animation); - playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20); + playGlobalAudio(entity.getLocation(), audio.getId(), 20); } @Override public void visualizeImpact(Entity entity, Entity target, BattleState state) { if (state.isFrozen()) { - playGlobalAudio(target.getLocation(), impactAudio, 1, 20); + playGlobalAudio(target.getLocation(), impactAudio, 20); target.graphics(BARRAGE_ORB); return; } diff --git a/Server/src/main/content/global/skill/magic/ancient/MiasmicSpells.java b/Server/src/main/content/global/skill/magic/ancient/MiasmicSpells.java index ec35da7e7..6df4d946c 100644 --- a/Server/src/main/content/global/skill/magic/ancient/MiasmicSpells.java +++ b/Server/src/main/content/global/skill/magic/ancient/MiasmicSpells.java @@ -101,7 +101,7 @@ public final class MiasmicSpells extends CombatSpell { projectile.transform(entity, (Entity) target, false, 58, 10).send(); } entity.animate(animation); - playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20); + playGlobalAudio(entity.getLocation(), audio.getId(), 20); } @Override diff --git a/Server/src/main/content/global/skill/magic/ancient/ShadowSpells.java b/Server/src/main/content/global/skill/magic/ancient/ShadowSpells.java index d6d3a7146..75ec82d48 100644 --- a/Server/src/main/content/global/skill/magic/ancient/ShadowSpells.java +++ b/Server/src/main/content/global/skill/magic/ancient/ShadowSpells.java @@ -20,7 +20,6 @@ import core.plugin.Initializable; import core.plugin.Plugin; import org.rs09.consts.Sounds; -import static core.api.ContentAPIKt.playAudio; import static core.api.ContentAPIKt.playGlobalAudio; /** @@ -100,7 +99,7 @@ public final class ShadowSpells extends CombatSpell { projectile.transform(entity, (Entity) target, false, 58, 10).send(); } entity.animate(animation); - playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20); + playGlobalAudio(entity.getLocation(), audio.getId(), 20); } @Override diff --git a/Server/src/main/content/global/skill/magic/ancient/SmokeSpells.java b/Server/src/main/content/global/skill/magic/ancient/SmokeSpells.java index dde86c19d..7c6a71965 100644 --- a/Server/src/main/content/global/skill/magic/ancient/SmokeSpells.java +++ b/Server/src/main/content/global/skill/magic/ancient/SmokeSpells.java @@ -108,7 +108,7 @@ public final class SmokeSpells extends CombatSpell { projectile.transform(entity, (Entity) target, false, 58, 10).send(); } entity.animate(animation); - playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20); + playGlobalAudio(entity.getLocation(), audio.getId(), 20); } @Override diff --git a/Server/src/main/content/global/skill/magic/lunar/HumidifySpell.java b/Server/src/main/content/global/skill/magic/lunar/HumidifySpell.java index 580690aca..2dd389953 100644 --- a/Server/src/main/content/global/skill/magic/lunar/HumidifySpell.java +++ b/Server/src/main/content/global/skill/magic/lunar/HumidifySpell.java @@ -77,7 +77,7 @@ public final class HumidifySpell extends MagicSpell { p.lock(ANIMATION.getDuration() + 1); p.animate(ANIMATION); p.graphics(GRAPHIC); - playGlobalAudio(p.getLocation(), Sounds.LUNAR_HUMIDIFY_3614, 1, 20); + playGlobalAudio(p.getLocation(), Sounds.LUNAR_HUMIDIFY_3614, 20); for (int k = 0; k < 28; k++) { for (int i = 0; i < 21; i++) { if (p.getInventory().contains(EMPTY[i], 1)) { diff --git a/Server/src/main/content/global/skill/magic/lunar/LunarListeners.kt b/Server/src/main/content/global/skill/magic/lunar/LunarListeners.kt index fd9c2ee3d..66a37b071 100644 --- a/Server/src/main/content/global/skill/magic/lunar/LunarListeners.kt +++ b/Server/src/main/content/global/skill/magic/lunar/LunarListeners.kt @@ -13,7 +13,6 @@ import core.game.node.entity.combat.ImpactHandler import core.game.node.entity.npc.NPC import core.game.node.entity.player.Player import core.game.node.entity.player.link.TeleportManager -import core.game.node.entity.player.link.audio.Audio import core.game.node.entity.skill.Skills import core.game.node.item.Item import core.game.node.scenery.Scenery @@ -40,91 +39,91 @@ class LunarListeners : SpellListener("lunar"), Commands { onCast(Lunar.MOONCLAN_TELEPORT, NONE) { player, _ -> requires(player,69, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563,1), Item(Items.EARTH_RUNE_557,2))) - playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) + if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) sendTeleport(player,66.0, Location.create(2111, 3916, 0)) } onCast(Lunar.MOONCLAN_GR_TELEPORT, NONE) { player, _ -> requires(player,70, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563,1), Item(Items.EARTH_RUNE_557,4))) - playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) + if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) sendGroupTeleport(player,67.0,"Moonclan Island",Location.create(2111, 3916, 0)) } onCast(Lunar.OURANIA_TELEPORT, NONE) { player, _ -> requires(player,71, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563,1), Item(Items.EARTH_RUNE_557,6))) - playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) + if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) sendTeleport(player,69.0, Location.create(2469, 3247, 0)) } onCast(Lunar.WATERBIRTH_TELEPORT, NONE){ player, _ -> requires(player,72, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563), Item(Items.WATER_RUNE_555))) - playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) + if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) sendTeleport(player,71.0, Location.create(2527, 3739, 0)) } onCast(Lunar.WATERBIRTH_GR_TELEPORT, NONE) { player, _ -> requires(player,73, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563), Item(Items.WATER_RUNE_555,5))) - playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) + if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) sendGroupTeleport(player,72.0,"Waterbirth Island", Location.create(2527, 3739, 0)) } onCast(Lunar.BARBARIAN_TELEPORT, NONE) { player, _ -> requires(player,75, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563,2), Item(Items.FIRE_RUNE_554,3))) - playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) + if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) sendTeleport(player,76.0, Location.create(2544, 3572, 0)) } onCast(Lunar.BARBARIAN_GR_TELEPORT, NONE) { player, _ -> requires(player,77, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563,2), Item(Items.FIRE_RUNE_554,6))) - playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) + if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) sendGroupTeleport(player,77.0,"Barbarian Outpost", Location.create(2544, 3572, 0)) } onCast(Lunar.KHAZARD_TELEPORT, NONE) { player, _ -> requires(player,78, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563,2), Item(Items.WATER_RUNE_555,4))) - playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) + if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) sendTeleport(player,80.0, Location.create(2656, 3157, 0)) } onCast(Lunar.KHAZARD_GR_TELEPORT, NONE) { player, _ -> requires(player,79, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563,2), Item(Items.WATER_RUNE_555,8))) - playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) + if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) sendGroupTeleport(player,81.0, "Port Khazard", Location.create(2656, 3157, 0)) } onCast(Lunar.FISHING_GUILD_TELEPORT, NONE) { player, _ -> requires(player,85, arrayOf(Item(Items.ASTRAL_RUNE_9075,3), Item(Items.LAW_RUNE_563,3), Item(Items.WATER_RUNE_555,10))) - playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) + if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) sendTeleport(player,89.0, Location.create(2611, 3393, 0)) } onCast(Lunar.FISHING_GUILD_GR_TELEPORT, NONE) { player, _ -> requires(player,86, arrayOf(Item(Items.ASTRAL_RUNE_9075,3), Item(Items.LAW_RUNE_563,3), Item(Items.WATER_RUNE_555,14))) - playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) + if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) sendGroupTeleport(player,90.0,"Fishing Guild", Location.create(2611, 3393, 0)) } onCast(Lunar.CATHERBY_TELEPORT, NONE) { player, _ -> requires(player,87, arrayOf(Item(Items.ASTRAL_RUNE_9075,3), Item(Items.LAW_RUNE_563,3), Item(Items.WATER_RUNE_555,10))) - playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) + if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) sendTeleport(player,92.0, Location.create(2804, 3433, 0)) } onCast(Lunar.CATHERBY_GR_TELEPORT, NONE) { player, _ -> requires(player,88, arrayOf(Item(Items.ASTRAL_RUNE_9075,3), Item(Items.LAW_RUNE_563,3), Item(Items.WATER_RUNE_555,15))) - playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) + if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) sendGroupTeleport(player,93.0,"Catherby", Location.create(2804, 3433, 0)) } onCast(Lunar.ICE_PLATEAU_TELEPORT, NONE) { player, _ -> requires(player,89, arrayOf(Item(Items.ASTRAL_RUNE_9075,3), Item(Items.LAW_RUNE_563,3), Item(Items.WATER_RUNE_555,8))) - playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) + if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) sendTeleport(player,96.0, Location.create(2972, 3873, 0)) } onCast(Lunar.ICE_PLATEAU_GR_TELEPORT, NONE) { player, _ -> requires(player,90, arrayOf(Item(Items.ASTRAL_RUNE_9075,3), Item(Items.LAW_RUNE_563,3), Item(Items.WATER_RUNE_555,16))) - playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) + if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) sendGroupTeleport(player,99.0, "Ice Plateau", Location.create(2972, 3873, 0)) } @@ -487,7 +486,7 @@ class LunarListeners : SpellListener("lunar"), Commands { visualizeSpell(player, CURE_ME_ANIM, CURE_ME_GFX, 2880) curePoison(player) addXP(player, 69.0) - playAudio(player, Audio(2900)) + playAudio(player, Sounds.LUNAR_CURE_OTHER_INDIVIDUAL_2900) sendMessage(player, "You have been cured of poison.") } @@ -505,7 +504,7 @@ class LunarListeners : SpellListener("lunar"), Commands { } curePoison(acct) sendMessage(acct, "You have been cured of poison.") - playAudio(acct, Audio(2889), true) + playGlobalAudio(acct.location, Sounds.LUNAR_CURE_OTHER_INDIVIDUAL_2889) visualize(acct, -1, CURE_GROUP_GFX) } addXP(player, 74.0) @@ -533,7 +532,7 @@ class LunarListeners : SpellListener("lunar"), Commands { player.face(p) visualizeSpell(player, CURE_OTHER_ANIM, CURE_OTHER_GFX, 2886) visualize(p, -1, CURE_OTHER_GFX) - playAudio(p, Audio(2889), true) + playGlobalAudio(p.location, Sounds.LUNAR_CURE_OTHER_INDIVIDUAL_2889) removeRunes(player, true) curePoison(p) sendMessage(p, "You have been cured of poison.") diff --git a/Server/src/main/content/global/skill/magic/modern/GodSpells.java b/Server/src/main/content/global/skill/magic/modern/GodSpells.java index 1b455073b..8b492fdd8 100644 --- a/Server/src/main/content/global/skill/magic/modern/GodSpells.java +++ b/Server/src/main/content/global/skill/magic/modern/GodSpells.java @@ -193,19 +193,19 @@ public final class GodSpells extends CombatSpell { if (state.getEstimatedHit() == -1) { target.graphics(SPLASH_GRAPHIC); if (projectile == SARA_PROJECTILE) { - playGlobalAudio(target.getLocation(), Sounds.SARADOMIN_STRIKE_FAIL_1656, 1, 20); + playGlobalAudio(target.getLocation(), Sounds.SARADOMIN_STRIKE_FAIL_1656, 20); } if (projectile == GUTHIX_PROJECTILE) { - playGlobalAudio(target.getLocation(), Sounds.CLAWS_OF_GUTHIX_FAIL_1652, 1, 20); + playGlobalAudio(target.getLocation(), Sounds.CLAWS_OF_GUTHIX_FAIL_1652, 20); } if (projectile == ZAM_PROJECTILE) { - playGlobalAudio(target.getLocation(), Sounds.FLAMES_OF_ZAMORAK_FAIL_1654, 1, 20); + playGlobalAudio(target.getLocation(), Sounds.FLAMES_OF_ZAMORAK_FAIL_1654, 20); } return; } } target.graphics(endGraphic); - playGlobalAudio(target.getLocation(), impactAudio, 1); + playGlobalAudio(target.getLocation(), impactAudio); } @Override diff --git a/Server/src/main/content/global/skill/magic/modern/ModernListeners.kt b/Server/src/main/content/global/skill/magic/modern/ModernListeners.kt index 1c1750e9c..4ed7ea661 100644 --- a/Server/src/main/content/global/skill/magic/modern/ModernListeners.kt +++ b/Server/src/main/content/global/skill/magic/modern/ModernListeners.kt @@ -256,7 +256,7 @@ class ModernListeners : SpellListener("modern"){ player.animate(Animation(if (high) 713 else 712)) player.graphics(Graphics(if (high) 113 else 112)) } - playAudio(player, Audio(if (high) 97 else 98)) + playAudio(player, if (high) Sounds.HIGH_ALCHEMY_97 else Sounds.LOW_ALCHEMY_98) if (coins.amount > 0) player.inventory.add(coins) diff --git a/Server/src/main/content/global/skill/magic/modern/SpellCharge.kt b/Server/src/main/content/global/skill/magic/modern/SpellCharge.kt index 65e6a4b31..fba47af0d 100644 --- a/Server/src/main/content/global/skill/magic/modern/SpellCharge.kt +++ b/Server/src/main/content/global/skill/magic/modern/SpellCharge.kt @@ -1,17 +1,16 @@ package content.global.skill.magic.modern -import core.api.getAudio -import core.api.playAudio -import core.api.sendMessage +import core.api.* import core.game.node.entity.Entity import core.game.node.entity.player.Player +import org.rs09.consts.Sounds import core.game.system.timer.PersistTimer class SpellCharge : PersistTimer (700, "magic:spellcharge") { override fun run (entity: Entity) : Boolean { if (entity !is Player) return false sendMessage(entity, "Your magical charge fades away.") - playAudio(entity, getAudio(1650)) + playAudio(entity, Sounds.CHARGE_GONE_1650) return false } } diff --git a/Server/src/main/content/global/skill/magic/modern/TeleblockSpell.java b/Server/src/main/content/global/skill/magic/modern/TeleblockSpell.java index 33087f668..1c3fc3f1b 100644 --- a/Server/src/main/content/global/skill/magic/modern/TeleblockSpell.java +++ b/Server/src/main/content/global/skill/magic/modern/TeleblockSpell.java @@ -78,7 +78,7 @@ public final class TeleblockSpell extends CombatSpell { projectile.transform(entity, (Entity) target, false, 58, 10).send(); } entity.animate(animation); - playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20); + playGlobalAudio(entity.getLocation(), audio.getId(), 20); } @Override diff --git a/Server/src/main/content/global/travel/EssenceTeleport.kt b/Server/src/main/content/global/travel/EssenceTeleport.kt index 449ef6456..cf79f80c4 100644 --- a/Server/src/main/content/global/travel/EssenceTeleport.kt +++ b/Server/src/main/content/global/travel/EssenceTeleport.kt @@ -58,7 +58,7 @@ object EssenceTeleport { npc.faceTemporary(player, 1) npc.graphics(GLOWING_HANDS_GFX) lock(player,4) - playGlobalAudio(player.location, Sounds.CURSE_ALL_125, 1) + playGlobalAudio(player.location, Sounds.CURSE_ALL_125, 0, 1) Projectile.create(npc, player, CURSE_PROJECTILE).send() npc.sendChat("Senventior Disthine Molenko!") GameWorld.Pulser.submit(object : Pulse(1) { diff --git a/Server/src/main/content/minigame/castlewars/CastleWarsListeners.kt b/Server/src/main/content/minigame/castlewars/CastleWarsListeners.kt index f557001df..eed986625 100644 --- a/Server/src/main/content/minigame/castlewars/CastleWarsListeners.kt +++ b/Server/src/main/content/minigame/castlewars/CastleWarsListeners.kt @@ -9,15 +9,14 @@ import core.game.interaction.IntType import core.game.interaction.InteractionListener import core.game.node.entity.player.Player import core.game.node.entity.player.link.TeleportManager -import core.game.node.entity.player.link.audio.Audio import core.game.node.item.Item import core.game.node.scenery.Scenery import core.game.node.scenery.SceneryBuilder import core.game.world.GameWorld import core.game.world.map.Location import core.game.world.update.flag.context.Animation -import core.tools.Log import org.rs09.consts.Items +import org.rs09.consts.Sounds import rs09.game.content.activity.castlewars.areas.CastleWarsWaitingArea import java.util.* @@ -80,7 +79,7 @@ class CastleWarsListeners : InteractionListener { // If item is added to inventory, play pickup sound if (addItem(player, rewardItem)) { - playAudio(player, Audio(2582)) + playAudio(player, Sounds.PICK2_2582) // Warn player inventory full using custom dialogue box } else { @@ -127,7 +126,7 @@ class CastleWarsListeners : InteractionListener { // Bucket fill animation animate(player, 832) // Bucket fill sound - playAudio(player, Audio(2609, 1)) + playAudio(player, Sounds.TAP_FILL_2609) // Replace empty -> full water bucket replaceSlot(player, used.asItem().slot, Item(Items.BUCKET_OF_WATER_1929)) return@onUseWith true @@ -142,7 +141,7 @@ class CastleWarsListeners : InteractionListener { // Delay sound to line up with "jump" movement runTask(player, 1) { // Play jumping sound - playAudio(player, Audio(2461)) + playAudio(player, Sounds.JUMP_2461) } return@on true } diff --git a/Server/src/main/content/region/desert/handlers/DesertZone.java b/Server/src/main/content/region/desert/handlers/DesertZone.java index a977f36aa..070889206 100644 --- a/Server/src/main/content/region/desert/handlers/DesertZone.java +++ b/Server/src/main/content/region/desert/handlers/DesertZone.java @@ -108,7 +108,7 @@ public final class DesertZone extends MapZone implements Plugin { p.getInventory().add(new Item(i.getId() + 2)); p.animate(ANIMATION); p.getPacketDispatch().sendMessage("You take a drink of water."); - playAudio(p, Sounds.LIQUID_2401, 1); + playAudio(p, Sounds.LIQUID_2401); return true; } } diff --git a/Server/src/main/content/region/fremennik/jatizso/handlers/JatizsoListeners.kt b/Server/src/main/content/region/fremennik/jatizso/handlers/JatizsoListeners.kt index b67f84798..65824ab40 100644 --- a/Server/src/main/content/region/fremennik/jatizso/handlers/JatizsoListeners.kt +++ b/Server/src/main/content/region/fremennik/jatizso/handlers/JatizsoListeners.kt @@ -2,7 +2,6 @@ package content.region.fremennik.jatizso.handlers import core.api.* import core.game.node.entity.npc.NPC -import core.game.node.entity.player.link.audio.Audio import core.game.system.task.Pulse import core.game.world.map.Direction import core.game.world.map.Location @@ -11,6 +10,7 @@ import org.rs09.consts.NPCs import content.region.fremennik.jatizso.dialogue.LeftieRightieDialogue import core.game.interaction.InteractionListener import core.game.interaction.IntType +import org.rs09.consts.Sounds class JatizsoListeners : InteractionListener { val GATES_CLOSED = intArrayOf(21403,21405) @@ -71,7 +71,7 @@ class JatizsoListeners : InteractionListener { replaceScenery(other.asScenery(), other.id, -1, Direction.SOUTH) } } - playAudio(player, getAudio(81)) + playAudio(player, Sounds.NICEDOOR_OPEN_81) return@on true } @@ -121,7 +121,7 @@ class JatizsoListeners : InteractionListener { } on(BELL, IntType.SCENERY, "ring-bell"){ player, _ -> - playAudio(player, Audio(15)) + playAudio(player, Sounds.STEEL_15) sendMessage(player, "You ring the warning bell, but everyone ignores it!") return@on true } diff --git a/Server/src/main/content/region/kandarin/seers/quest/elementalworkshop/EWListeners.kt b/Server/src/main/content/region/kandarin/seers/quest/elementalworkshop/EWListeners.kt index d5d8f4c04..f742d5a21 100644 --- a/Server/src/main/content/region/kandarin/seers/quest/elementalworkshop/EWListeners.kt +++ b/Server/src/main/content/region/kandarin/seers/quest/elementalworkshop/EWListeners.kt @@ -1,7 +1,6 @@ package content.region.kandarin.seers.quest.elementalworkshop import core.api.* -import core.game.node.entity.player.link.audio.Audio import core.game.node.entity.skill.Skills import core.game.node.item.Item import core.game.system.task.Pulse @@ -65,14 +64,14 @@ class EWListeners : InteractionListener { private val smithElementalShield = Animation(Animations.HUMAN_COOKING_RANGE_896) /* Sound effects */ - private val fillStoneBowlSFX = Audio(Sounds.FILL_STONE_BOWL_1537, 1) - private val fillFurnaceWithLavaSFX = Audio(Sounds.FILL_FURNACE_WITH_LAVA_1538) - private val pullLeverResetGatesSFX = Audio(Sounds.PULL_LEVER_RESET_GATE_1540) - private val turnWaterControlsSFX = Audio(Sounds.TURN_METAL_WATER_VALVE) - private val pullLeverEnabledSFX = Audio(Sounds.PULL_LEVER_ENABLED_1547) - private val pullLeverDisabledSFX = Audio(Sounds.PULL_LEVER_DISABLED_1548) - private val bellowLeverSFX = Audio(Sounds.PULL_LEVER_GENERAL_2400) - private val smithElementalShieldSFX = Audio(2721) + private val fillStoneBowlSFX = Sounds.FILL_STONE_BOWL_1537 + private val fillFurnaceWithLavaSFX = Sounds.FILL_FURNACE_WITH_LAVA_1538 + private val pullLeverResetGatesSFX = Sounds.PULL_LEVER_RESET_GATE_1540 + private val turnWaterControlsSFX = Sounds.TURN_METAL_WATER_VALVE + private val pullLeverEnabledSFX = Sounds.PULL_LEVER_ENABLED_1547 + private val pullLeverDisabledSFX = Sounds.PULL_LEVER_DISABLED_1548 + private val bellowLeverSFX = Sounds.PULL_LEVER_GENERAL_2400 + private val smithElementalShieldSFX = Sounds.ANVIL_4_2721 /* In-game locations */ private val leftWaterControlsLocation = Location.create(2713, 9907, 0) diff --git a/Server/src/main/content/region/morytania/quest/naturespirit/NSDrezelDialogue.kt b/Server/src/main/content/region/morytania/quest/naturespirit/NSDrezelDialogue.kt index c49a78527..924ff050a 100644 --- a/Server/src/main/content/region/morytania/quest/naturespirit/NSDrezelDialogue.kt +++ b/Server/src/main/content/region/morytania/quest/naturespirit/NSDrezelDialogue.kt @@ -1,16 +1,16 @@ package content.region.morytania.quest.naturespirit import core.api.* -import core.game.dialogue.FacialExpression import core.game.node.entity.npc.NPC import core.game.node.entity.player.Player -import core.game.node.entity.player.link.audio.Audio import core.game.system.task.Pulse import core.game.world.update.flag.context.Animation import core.game.world.update.flag.context.Graphics import org.rs09.consts.Items import core.game.dialogue.DialogueFile +import core.game.dialogue.FacialExpression import core.tools.END_DIALOGUE +import org.rs09.consts.Sounds class NSDrezelDialogue : DialogueFile() { var questStage = 0 @@ -104,7 +104,7 @@ private class BlessingPulse(val drezel: NPC, val player: Player) : Pulse(){ override fun pulse(): Boolean { when(ticks){ - 0 -> animate(drezel, 1162).also { spawnProjectile(drezel, player, 268); playAudio(player, Audio(2674)) } + 0 -> animate(drezel, 1162).also { spawnProjectile(drezel, player, 268); playAudio(player, Sounds.PRAYER_RECHARGE_2674) } 2 -> visualize(player, Animation(645), Graphics(267, 100)) 4 -> unlock(player).also { player.questRepository.getQuest("Nature Spirit").setStage(player, 40); return true } } diff --git a/Server/src/main/core/api/ContentAPI.kt b/Server/src/main/core/api/ContentAPI.kt index 5c5bfa13e..0b5883d24 100644 --- a/Server/src/main/core/api/ContentAPI.kt +++ b/Server/src/main/core/api/ContentAPI.kt @@ -60,7 +60,6 @@ import core.game.system.config.ItemConfigParser import core.game.system.config.ServerConfigParser import core.game.world.GameWorld import core.game.world.GameWorld.Pulser -import core.game.world.map.path.ProjectilePathfinder import core.game.world.repository.Repository import core.game.consumable.* import core.ServerConstants @@ -555,13 +554,6 @@ fun getWorldTicks(): Int { return GameWorld.ticks } -/** - * Gets an Audio object with specified id, volume, etc - */ -fun getAudio(id: Int, volume: Int = 10, delay: Int = 1): Audio { - return Audio(id, volume, delay) -} - /** * Plays a jingle by id * @param player the player to play the jingle for @@ -815,51 +807,33 @@ fun animate(entity: Entity, anim: T, forced: Boolean = false) { } } -/** - * Plays the given Audio for the given Entity - * @param player the player to play the audio for - * @param audio the Audio to play - * @param global if other nearby entities should be able to hear it - */ -fun playAudio(player: Player, audio: Audio, global: Boolean = false) { - player.audioManager.send(audio, global) -} - /** * Plays audio for the player * @param player the player to play the defined audio for * @param audio the audio id to play - * @param volume the volume for the audio (for some audio ids it is used to define how many times to play/loop the audio) * @param delay the delay in client cycles (50 cycles = 1 second) - * @param global if other nearby players should be able to hear the audio - * @param location the location where the audio will play from (if a location is defined the sound will fade with distance) + * @param loops the number of times to loop audio (for some audio ids it is used to define how many times to loop the audio) + * @param location the location where the audio will play from (The sound will fade with distance) * @param radius the distance the audio can be heard from the defined location (default = 8 tiles if undefined) */ @JvmOverloads -fun playAudio(player: Player, audio: Int, volume: Int = 10, delay: Int = 0, global: Boolean = false, location: Location? = null, radius: Int = 8) { - if (global) { - val nearbyPlayers = RegionManager.getLocalPlayers(location ?: player.location, radius) - for ( player in nearbyPlayers ) { - PacketRepository.send(AudioPacket::class.java, DefaultContext(player, Audio(audio, volume, delay, radius), location)) - } - } else { - PacketRepository.send(AudioPacket::class.java, DefaultContext(player, Audio(audio, volume, delay, radius), location)) - } +fun playAudio(player: Player, audio: Int, delay: Int = 0, loops: Int = 1, location: Location? = null, radius: Int = 8) { + PacketRepository.send(AudioPacket::class.java, DefaultContext(player, Audio(audio, loops, delay, radius), location)) } /** * Plays audio for players near a defined location * @param location the location where the audio will play from (The sound will fade with distance) * @param audio the audio id to play - * @param volume the volume for the audio (for some audio ids it is used to define how many times to play/loop the audio) * @param delay the delay in client cycles (50 cycles = 1 second) + * @param loops the number of times to loop audio (for some audio ids it is used to define how many times to loop the audio) * @param radius the distance the audio can be heard from the defined location (default = 8 tiles if undefined) */ @JvmOverloads -fun playGlobalAudio(location: Location, audio: Int, volume: Int = 10, delay: Int = 0, radius: Int = 8) { +fun playGlobalAudio(location: Location, audio: Int, delay: Int = 0, loops: Int = 1, radius: Int = 8) { val nearbyPlayers = RegionManager.getLocalPlayers(location, radius) for (player in nearbyPlayers) { - PacketRepository.send(AudioPacket::class.java, DefaultContext(player, Audio(audio, volume, delay, radius), location)) + PacketRepository.send(AudioPacket::class.java, DefaultContext(player, Audio(audio, loops, delay, radius), location)) } } @@ -872,9 +846,9 @@ fun playHurtAudio(player: Player, delay: Int = 0) { val maleHurtAudio = intArrayOf(Sounds.HUMAN_HIT4_516, Sounds.HUMAN_HIT5_517, Sounds.HUMAN_HIT_518, Sounds.HUMAN_HIT_6_522) val femaleHurtAudio = intArrayOf(Sounds.FEMALE_HIT_506, Sounds.FEMALE_HIT_507, Sounds.FEMALE_HIT2_508, Sounds.FEMALE_HIT_2_510) if (player.isMale) { - playAudio(player, maleHurtAudio.random(), 10, delay) + playAudio(player, maleHurtAudio.random(), delay) } else { - playAudio(player, femaleHurtAudio.random(), 10, delay) + playAudio(player, femaleHurtAudio.random(), delay) } } diff --git a/Server/src/main/core/game/global/action/DropListener.kt b/Server/src/main/core/game/global/action/DropListener.kt index 5bc8add04..e183cbd58 100644 --- a/Server/src/main/core/game/global/action/DropListener.kt +++ b/Server/src/main/core/game/global/action/DropListener.kt @@ -8,12 +8,12 @@ import core.game.node.Node import core.game.node.entity.combat.graves.GraveController import core.game.node.entity.player.Player import core.game.node.entity.player.info.login.PlayerParser -import core.game.node.entity.player.link.audio.Audio import core.game.node.item.GroundItemManager import core.game.node.item.Item import core.game.system.config.ItemConfigParser import content.global.skill.summoning.pet.Pets import org.rs09.consts.Items +import org.rs09.consts.Sounds /** * Represents the item drop/destroy/dissolve handler. @@ -25,9 +25,9 @@ class DropListener : InteractionListener { } companion object { - private val DROP_COINS_SOUND = Audio(10, 1, 0) - private val DROP_ITEM_SOUND = Audio(2739, 1, 0) - private val DESTROY_ITEM_SOUND = Audio(4500, 1, 0) + private val DROP_COINS_SOUND = Sounds.EYEGLO_COIN_10 + private val DROP_ITEM_SOUND = Sounds.PUT_DOWN_2739 + private val DESTROY_ITEM_SOUND = Sounds.DESTROY_OBJECT_2381 @JvmStatic fun drop(player: Player, item: Item) : Boolean { return handleDropAction(player, item) } diff --git a/Server/src/main/core/game/node/entity/combat/graves/GraveController.kt b/Server/src/main/core/game/node/entity/combat/graves/GraveController.kt index 78fb837bf..a57a76562 100644 --- a/Server/src/main/core/game/node/entity/combat/graves/GraveController.kt +++ b/Server/src/main/core/game/node/entity/combat/graves/GraveController.kt @@ -6,7 +6,6 @@ import core.game.node.entity.combat.ImpactHandler import core.game.node.entity.player.Player import core.game.node.entity.player.info.Rights import core.game.node.entity.player.link.IronmanMode -import core.game.node.entity.player.link.audio.Audio import core.game.node.entity.skill.Skills import core.game.node.item.Item import core.game.system.task.Pulse @@ -24,6 +23,7 @@ import core.game.world.map.zone.impl.WildernessZone import core.game.world.repository.Repository import core.tools.secondsToTicks import core.tools.colorize +import org.rs09.consts.Sounds import java.util.Map import kotlin.math.min @@ -122,7 +122,7 @@ class GraveController : PersistWorld, TickListener, InteractionListener, Command player.skills.prayerPoints -= blessAmount setAttribute(g, "blessed", true) - playAudio(player, Audio(2674)) + playAudio(player, Sounds.PRAYER_RECHARGE_2674) animate(player, 645) val gOwner = Repository.uid_map[g.ownerUid] @@ -155,7 +155,7 @@ class GraveController : PersistWorld, TickListener, InteractionListener, Command player.skills.prayerPoints -= restoreAmount setAttribute(g, "repaired", true) - playAudio(player, Audio(2674)) + playAudio(player, Sounds.PRAYER_RECHARGE_2674) animate(player, 645) return true } diff --git a/Server/src/main/core/game/node/entity/combat/spell/CombatSpell.java b/Server/src/main/core/game/node/entity/combat/spell/CombatSpell.java index f6249cdcd..b277c3ead 100644 --- a/Server/src/main/core/game/node/entity/combat/spell/CombatSpell.java +++ b/Server/src/main/core/game/node/entity/combat/spell/CombatSpell.java @@ -136,12 +136,12 @@ public abstract class CombatSpell extends MagicSpell { */ public void visualizeImpact(Entity entity, Entity target, BattleState state) { if (state.getEstimatedHit() == -1) { - playGlobalAudio(target.getLocation(), Sounds.SPELLFAIL_227, 1, 20); + playGlobalAudio(target.getLocation(), Sounds.SPELLFAIL_227, 20); target.graphics(SPLASH_GRAPHIC); return; } target.graphics(endGraphic); - playGlobalAudio(target.getLocation(), impactAudio, 1, 20); + playGlobalAudio(target.getLocation(), impactAudio, 20); } @Override @@ -173,7 +173,7 @@ public abstract class CombatSpell extends MagicSpell { entity.animate(animation); } } - playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20); + playGlobalAudio(entity.getLocation(), audio.getId(), 20); } @Override diff --git a/Server/src/main/core/game/node/entity/combat/spell/MagicSpell.java b/Server/src/main/core/game/node/entity/combat/spell/MagicSpell.java index a93b2a517..3b829cbd7 100644 --- a/Server/src/main/core/game/node/entity/combat/spell/MagicSpell.java +++ b/Server/src/main/core/game/node/entity/combat/spell/MagicSpell.java @@ -20,7 +20,6 @@ import core.tools.RandomFunction; import java.util.ArrayList; import java.util.List; -import static core.api.ContentAPIKt.playAudio; import static core.api.ContentAPIKt.playGlobalAudio; /** @@ -161,7 +160,7 @@ public abstract class MagicSpell implements Plugin { public void visualize(Entity entity, Node target) { entity.graphics(graphic); entity.animate(animation); - playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20); + playGlobalAudio(entity.getLocation(), audio.getId(), 20); } /** diff --git a/Server/src/main/core/game/system/timer/impl/PoisonImmunity.kt b/Server/src/main/core/game/system/timer/impl/PoisonImmunity.kt index 9827728a4..1695fce7b 100644 --- a/Server/src/main/core/game/system/timer/impl/PoisonImmunity.kt +++ b/Server/src/main/core/game/system/timer/impl/PoisonImmunity.kt @@ -5,10 +5,8 @@ import core.api.* import core.tools.* import core.game.node.entity.Entity import core.game.node.entity.player.Player -import core.game.node.entity.combat.ImpactHandler -import core.game.world.repository.Repository -import core.game.node.entity.player.link.audio.Audio import org.json.simple.* +import org.rs09.consts.Sounds /** * A timer that replicates the behavior of poison immunity mechanics. Runs every tick. @@ -35,11 +33,11 @@ class PoisonImmunity : PersistTimer (1, "poison:immunity", isSoft = true, flags if (entity is Player && ticksRemaining == secondsToTicks(30)) { sendMessage(entity, colorize("%RYou have 30 seconds remaining on your poison immunity.")) - playAudio(entity, Audio(3120)) + playAudio(entity, Sounds.CLOCK_TICK_1_3120, 0, 3) } else if (entity is Player && ticksRemaining == 0) { sendMessage(entity, colorize("%RYour poison immunity has expired.")) - playAudio(entity, Audio(2607)) + playAudio(entity, Sounds.DRAGON_POTION_FINISHED_2607) } return ticksRemaining > 0