Audio refactor continued

Implemented admin audio command ::audio audioId loops[optional]
Implemented admin globalaudio command ::globalaudio audioId radius playername (plays from that players location) or can be used by coords ::globalaudio audioId radius x y z
Refactored the following sounds:
Tribal totem quest Cromperty teleport (fixed looping)
Vinesweeper tool leprechaun teleport sound (Corrected this sound so it does not loop 10 times)
Antifire and poision immunity 30 seconds remaining tick tock sounds and sound of the potions expiring (Fixed it so it plays the correct number of tick tocks)
Sound when summoning a familiar (All familiars were using the summon unicorn sound. It is now defaulted to the normal summoning sound instead of the unicorn summon sound. All familiars on first summon have a their own sounds that will need to be implemented later)
Door and gate sounds
Bank interface sounds
Unicorn stallion special move sound
Agility pyramid rolling block sounds
Prayer book sounds
Lunar stat spy
Hunter falconry
Picking items in a field like potatoes
Ectophial teleport and refill
Summoning pouch creation and renewing points
Runecrafting at altar sound
Making finished and unfinished potions
Cutting gems
Entering giant mole area
Praying at an altar
Warriors guild animator sounds
Chiseling limestone
Spirit wolf special move sound
Telegrab spell sound
Glassblowing sound
Strong of security opening reward chest creaking sound
Butterfly net sound
Desert rug travel rise and descend sound
Enchanting bolts
Woodcutting tree falling and chopping sound
Hunter setting up dismantling traps and pitfall sounds
Explorers ring run energy restore sound
Farming: Raking, adding compost to patch, picking from fruit trees, seed dibb, using plant cure on patch, opening/closing/adding to/from compost bin
Mage training arena alchemy spell sounds
Breaking bones to peaches/bananas tab sound
Casting silver sickle bloom
Entrana magic door teleport
Cabbage teleport
Teleother cast sound
Fairy ring teleport sound
Lunar vengeance spells
Running out of prayer sound
Lunar (non teleport) spells
Super heat and bones to bananas normal spell book sounds
Equip/unequip item sound
Revenant combat sounds
Herb cleaning sound
Emptying buckets/bowls/jugs of water
Making cannonballs at a furnace
Digging with a spade
Peer the seer fremmenik trials challenge: heating items on the range
Blessing a spirit shield at a POH altar
ContentAPI function stun sound
Picking up items off the ground
Eating food sound
Cooking and intentionally burning food
Drinking a potion
Warriors guild catapult
Pulling wilderness teleport levers
Offering bones on a POH altar
Slashing spider webs in Varrock sewers
Entering POH portal teleport sound
GE exchanging item set sound
Jumping wilderness ditch
Dragon axe special
Digging up a farming patch
Lunar heal spells
Chaos elemental projectile impact sounds
Mounted glory teleport
Lunar share and boost potion spell
Dwarf multi cannon setup, rotate, and firing sounds
NPC attacking sound
Enchanted bolt effect combat sound
This commit is contained in:
Zerken
2023-08-24 13:58:19 +00:00
committed by Ryan
parent 00af62e449
commit c52e02936d
109 changed files with 463 additions and 619 deletions
@@ -8,6 +8,9 @@ import core.game.node.item.GroundItemManager;
import core.game.node.item.Item;
import core.tools.RandomFunction;
import core.tools.StringUtils;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Represents a birds nest.
@@ -93,7 +96,7 @@ public enum BirdNest {
*/
public static void drop(final Player player) {
final BirdNest nest = getRandomNest(false);
player.getAudioManager().send(1997);
playAudio(player, Sounds.CUCKOO_1_1997);
GroundItemManager.create(nest.getNest(), player);
player.getPacketDispatch().sendMessage("<col=FF0000>A bird's nest falls out of the tree.");
}
@@ -1,5 +1,6 @@
package content.global.handlers.iface;
import core.api.ContentAPIKt;
import core.game.component.Component;
import core.game.component.ComponentDefinition;
import core.game.component.ComponentPlugin;
@@ -15,6 +16,8 @@ import core.game.world.update.flag.context.Graphics;
import core.plugin.Plugin;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Represents the component plugin used to handle the bolt enchanting interface.
* @author Emperor
@@ -88,7 +91,7 @@ public final class BoltEnchantingInterface extends ComponentPlugin {
}
player.getSkills().addExperience(Skills.MAGIC, bolts.getExp(), true);
player.getPacketDispatch().sendMessage("The magic of the runes coaxes out the true nature of the gem tips.");
player.getAudioManager().send(Sounds.ENCHANTED_TIPPING_2921);
playAudio(player, Sounds.ENCHANTED_TIPPING_2921);
return true;
}
});
@@ -106,7 +106,7 @@ public final class GlassInterface extends ComponentPlugin {
return true;
}
player.animate(ANIMATION);
player.getAudioManager().send(Sounds.GLASSBLOWING_2724);
playAudio(player, Sounds.GLASSBLOWING_2724);
player.getInventory().remove(MOLTEN_GLASS);
player.getInventory().add(new Item(glass.getProduct(), 1));
player.getSkills().addExperience(Skills.CRAFTING, glass.getExperience(), true);
@@ -8,7 +8,6 @@ import core.game.component.ComponentPlugin;
import core.game.ge.GEGuidePrice;
import core.game.ge.GEItemSet;
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.system.task.Pulse;
import core.net.packet.PacketRepository;
@@ -19,6 +18,9 @@ import core.plugin.Plugin;
import core.game.ge.GrandExchangeOffer;
import core.game.ge.GrandExchangeRecords;
import core.game.world.GameWorld;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Handles the Grand Exchange interface options.
@@ -178,7 +180,7 @@ public class GrandExchangeInterface extends ComponentPlugin {
player.getInventory().refresh();
player.getPacketDispatch().sendMessage("You successfully traded your item components for a set!");
}
player.getAudioManager().send(new Audio(4044, 1, 1));
playAudio(player, Sounds.GE_TRADE_OK_4044);
PacketRepository.send(ContainerPacket.class, new ContainerContext(player, -1, -2, player.getAttribute("container-key", 93), player.getInventory(), false));
break;
case 155:
@@ -11,6 +11,8 @@ import org.rs09.consts.Sounds;
import java.util.HashMap;
import static core.api.ContentAPIKt.playAudio;
/**
* Handles items with "empty" options
* @author ceik
@@ -29,7 +31,7 @@ public final class EmptyOptionPlugin extends OptionHandler {
}
if(EmptyItem.emptyItemMap.get(node.getId()) != null){
player.getInventory().remove(node.asItem());
player.getAudioManager().send(Sounds.LIQUID_2401, 1);
playAudio(player, Sounds.LIQUID_2401, 0 ,1);
player.getInventory().add(EmptyItem.getEmpty(node.getId()));
player.getPacketDispatch().sendMessage(EmptyItem.getEmptyMessage(node.getId()));
} else {
@@ -28,7 +28,7 @@ class ExplorersRingPlugin : InteractionListener {
return@on true
}
player.settings.updateRunEnergy(-50.0)
player.audioManager.send(5035)
playAudio(player, 5035)
getStoreFile()[player.username.toLowerCase() + ":run"] = charges + 1
@@ -7,6 +7,9 @@ import core.game.node.Node;
import core.game.node.entity.player.Player;
import core.plugin.Initializable;
import core.plugin.Plugin;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Represents the plugin used to handle the dig option on a spade.
@@ -24,7 +27,7 @@ public class SpadeDigOptionPlugin extends OptionHandler {
@Override
public boolean handle(final Player player, Node node, String option) {
player.getAudioManager().send(1470,1,1);
playAudio(player, Sounds.DIGSPADE_1470);
if (!DigSpadeHandler.dig(player)) {
player.sendMessage("You dig but find nothing.");
}
@@ -1,6 +1,7 @@
package content.global.handlers.item.equipment.special
import core.ServerConstants
import core.api.playAudio
import core.game.container.impl.EquipmentContainer
import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState
@@ -18,6 +19,7 @@ import core.plugin.Initializable
import core.plugin.Plugin
import core.tools.RandomFunction
import org.rs09.consts.Items
import org.rs09.consts.Sounds
/**
@@ -70,7 +72,7 @@ class ClobberSpecialHandler : MeleeSwingHandler(), Plugin<Any> {
victim.skills.updateLevel(Skills.DEFENCE, -hit, 0)
victim.skills.updateLevel(Skills.MAGIC, -hit, 0)
player.audioManager.send(AUTHENTIC_AUDIO)
playAudio(player, Sounds.CLOBBER_2531, 20)
return 1
}
@@ -84,7 +86,7 @@ class ClobberSpecialHandler : MeleeSwingHandler(), Plugin<Any> {
player.sendChat("Chop chop!")
player.skills.updateLevel(Skills.WOODCUTTING, 3, player.skills.getStaticLevel(Skills.WOODCUTTING) + 3)
visualize(player, null, null)
player.audioManager.send(OSRS_AUDIO)
playAudio(player, Sounds.CLOBBER_2531, 20)
return -1
}
@@ -104,16 +106,6 @@ class ClobberSpecialHandler : MeleeSwingHandler(), Plugin<Any> {
*/
private val GRAPHIC = Graphics(479, 96)
/**
* The authentic sound.
*/
private val AUTHENTIC_AUDIO = Audio(2531)
/**
* The OSRS sound.
*/
private val OSRS_AUDIO = Audio(2530)
/**
* The item.
*/
@@ -40,7 +40,7 @@ class AmmoMouldOnFurnace : InteractionListener {
0 -> {
sendMessage(player,"You heat the steel bar into a liquid state.")
animate(player, 3243) // 899 would be preferable but the arms spaz out
player.audioManager.send(Sounds.FURNACE_2725, 1)
playAudio(player, Sounds.FURNACE_2725)
}
3 -> {
sendMessage(player,"You pour the molten metal into your cannonball mould.")
@@ -18,6 +18,8 @@ import core.plugin.Initializable;
import core.tools.RandomFunction;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Handles the pick option of interactive scenery (non-farming cabbages,
* potatoes, bananas, etc)
@@ -65,7 +67,7 @@ public final class FieldPickingPlugin extends OptionHandler {
player.lock(1);
player.setAttribute("delay:picking", GameWorld.getTicks() + (plant == PickingPlant.FLAX ? 2 : 3));
player.animate(ANIMATION);
player.getAudioManager().send(Sounds.PICK_2581,10, 30);
playAudio(player, Sounds.PICK_2581, 30);
if (plant.name().startsWith("NETTLES") && (player.getEquipment().get(EquipmentContainer.SLOT_HANDS) == null || player.getEquipment().get(EquipmentContainer.SLOT_HANDS) != null && !player.getEquipment().get(EquipmentContainer.SLOT_HANDS).getName().contains("glove"))) {
player.getPacketDispatch().sendMessage("You have been stung by the nettles!");
player.getImpactHandler().manualHit(player, 2, HitsplatType.POISON);
@@ -126,7 +128,7 @@ public final class FieldPickingPlugin extends OptionHandler {
*/
private void handleFlaxPick(final Player player, final Scenery object, final PickingPlant plant) {
int charge = object.getCharge();
player.getAudioManager().send(2581);
playAudio(player, Sounds.PICK_2581);
player.getPacketDispatch().sendMessage("You pick some flax.");
// Seers achievement diary
@@ -12,13 +12,15 @@ import core.game.node.entity.combat.equipment.WeaponInterface.AttackStyle;
import core.game.node.entity.combat.equipment.WeaponInterface.WeaponInterfaces;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.diary.DiaryType;
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.update.flag.context.Animation;
import core.plugin.Plugin;
import core.tools.RandomFunction;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Handles the slashing of a web object.
@@ -74,7 +76,7 @@ public final class SlashWebPlugin extends OptionHandler {
}
final boolean success = RandomFunction.random(2) == 1;
player.lock(2);
player.getAudioManager().send(new Audio(2548));
playAudio(player, Sounds.STABSWORD_SLASH_2548);
player.animate(weapon == KNIFE ? KNIFE_ANIMATION : ANIMATION);
if (success) {
player.getPacketDispatch().sendMessage("You slash the web apart.");
@@ -12,6 +12,9 @@ import core.game.world.map.Direction;
import core.game.world.map.Location;
import core.game.world.map.RegionManager;
import core.game.world.update.flag.context.Animation;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Represents the rolling block obstacle.
@@ -29,8 +32,8 @@ public final class RollingBlock implements MovementHook {
final boolean fail = backwards || AgilityHandler.hasFailed(player, 2, 0.3);
player.lock(5);
AgilityPyramidCourse.addConfig(player, stone, 1, false);
player.getAudioManager().send(1396);
player.getAudioManager().send(2469, 10 , 40);
playAudio(player, Sounds.PYRAMID_SCRAPE_1396);
playAudio(player, Sounds.LAND_FLAT_2469, 40);
if(e.isPlayer())
{
@@ -8,7 +8,6 @@ import core.api.regionspec.RegionSpecification;
import core.api.regionspec.contracts.FillChunkContract;
import core.game.dialogue.FacialExpression;
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.game.node.scenery.Scenery;
import core.game.system.task.Pulse;
@@ -25,6 +24,7 @@ import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import core.tools.SystemLogger;
import core.game.world.GameWorld;
import org.rs09.consts.Sounds;
import java.awt.*;
import java.nio.ByteBuffer;
@@ -224,7 +224,7 @@ public final class HouseManager {
private void openLoadInterface(Player player) {
player.getInterfaceManager().openComponent(399);
player.getAudioManager().send(new Audio(984));
playAudio(player, Sounds.POH_TELEPORT_984);
submitCloseLoadInterfacePulse(player);
}
@@ -18,6 +18,7 @@ import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
import org.rs09.consts.Sounds;
/**
* Handles the offering of bones on an altar.
@@ -98,7 +99,7 @@ public class BoneOfferPlugin extends UseWithHandler {
if (counter == 1 || counter % 5 == 0) {
if (player.getInventory().remove(new Item(b.getItemId()))) {
player.animate(ANIM);
player.getAudioManager().send(new Audio(958));
playAudio(player, Sounds.POH_OFFER_BONES_958);
player.getPacketDispatch().sendPositionedGraphics(GFX, gfxLoc);
player.sendMessage(getMessage(isLit(left), isLit(right)));
player.getSkills().addExperience(Skills.PRAYER, b.getExperience() * getMod(altar, isLit(left), isLit(right)));
@@ -1,14 +1,15 @@
package content.global.skill.construction.decoration.chapel
import core.api.playAudio
import core.game.interaction.NodeUsageEvent
import core.game.interaction.UseWithHandler
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.world.update.flag.context.Animation
import core.plugin.Initializable
import core.plugin.Plugin
import org.rs09.consts.Items
import org.rs09.consts.Sounds
const val HOLY_ELIXER = 13754
const val SPIRIT_SHIELD = 13734
@@ -38,7 +39,7 @@ class ShieldBlessingPlugin : UseWithHandler(HOLY_ELIXER, SPIRIT_SHIELD) {
}
player.animator.animate(Animation(896))
player.audioManager.send(Audio(958))
playAudio(player, Sounds.POH_OFFER_BONES_958)
if(player.inventory.remove(Item(HOLY_ELIXER)) && player.inventory.remove(Item(SPIRIT_SHIELD)))
player.inventory.add(Item(Items.BLESSED_SPIRIT_SHIELD_13736))
@@ -1,14 +1,15 @@
package content.global.skill.construction.decoration.questhall
import core.api.playGlobalAudio
import core.api.teleport
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.system.task.Pulse
import core.game.world.map.Location
import core.game.world.update.flag.context.Animation
import core.game.world.update.flag.context.Graphics
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
import org.rs09.consts.Sounds
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
@@ -53,7 +54,7 @@ class MountedGlory : InteractionListener {
1 -> {
player.lock(5)
player.visualize(Animation(714), Graphics(308, 100, 50))
player.getAudioManager().send(Audio(200), true)
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
}
4 -> player.animator.reset().also { teleport(player, TELEPORTS[int]) }
}
@@ -7,7 +7,6 @@ import core.game.dialogue.DialogueInterpreter;
import core.game.interaction.OptionHandler;
import core.game.node.Node;
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.GameWorld;
import core.game.world.map.Location;
@@ -15,6 +14,9 @@ import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playGlobalAudio;
/**
* Handles the POH Mounted Glory.
@@ -79,7 +81,7 @@ public class MountedGloryPlugin extends OptionHandler {
}
player.lock();
player.visualize(ANIMATION, GRAPHICS);
player.getAudioManager().send(new Audio(200), true);
playGlobalAudio(player.getLocation(), Sounds.TELEPORT_ALL_200);
player.getImpactHandler().setDisabledTicks(4);
GameWorld.getPulser().submit(new Pulse(4, player) {
@Override
@@ -3,6 +3,9 @@ package content.global.skill.cooking;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.game.node.scenery.Scenery;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
public class IntentionalBurnPulse extends StandardCookingPulse {
int initial,product,amount;
@@ -47,7 +50,7 @@ public class IntentionalBurnPulse extends StandardCookingPulse {
if (player.getInventory().remove(initialItem)) {
player.getInventory().add(productItem);
player.getPacketDispatch().sendMessage(getMessage(initialItem, productItem, burned));
player.getAudioManager().send(SOUND);
playAudio(player, Sounds.FRY_2577);
return true;
}
return false;
@@ -13,6 +13,9 @@ import core.game.system.task.Pulse;
import core.game.world.update.flag.context.Animation;
import core.tools.RandomFunction;
import org.rs09.consts.Items;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
public class StandardCookingPulse extends Pulse {
//range animation
@@ -170,7 +173,7 @@ public class StandardCookingPulse extends Pulse {
player.getInventory().add(CookableItems.getBurnt(initial));
}
player.getPacketDispatch().sendMessage(getMessage(initialItem, productItem, burned));
player.getAudioManager().send(SOUND);
playAudio(player, Sounds.FRY_2577);
return true;
}
return false;
@@ -4,6 +4,9 @@ import core.game.node.entity.skill.SkillPulse;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Represents the pulse used to cut a gem.
@@ -61,7 +64,7 @@ public final class GemCutPulse extends SkillPulse<Item> {
@Override
public void animate() {
if (ticks % 5 == 0 || ticks < 1) {
player.getAudioManager().send(2586);
playAudio(player, Sounds.CHISEL_2586);
player.animate(gem.getAnimation());
}
}
@@ -5,6 +5,9 @@ import core.game.node.entity.skill.Skills;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
*
@@ -48,7 +51,7 @@ public class ChiselLimestonePulse extends SkillPulse<Item> {
@Override
public void animate() {
if (ticks % 5 == 0 || ticks < 1) {
player.getAudioManager().send(2586);
playAudio(player, Sounds.CHISEL_2586);
player.animate(Animation.create(4470));
}
}
@@ -9,6 +9,7 @@ import core.tools.RandomFunction
import org.json.simple.JSONArray
import org.json.simple.JSONObject
import org.rs09.consts.Items
import org.rs09.consts.Sounds
import java.util.concurrent.TimeUnit
class CompostBin(val player: Player, val bin: CompostBins) {
@@ -25,14 +26,14 @@ class CompostBin(val player: Player, val bin: CompostBins) {
fun close() {
isClosed = true
player.audioManager.send(2428)
playAudio(player, Sounds.COMPOST_CLOSE_2428)
finishedTime = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(RandomFunction.random(35,50).toLong())
updateBit()
}
fun open(){
isClosed = false
player.audioManager.send(2429)
playAudio(player, Sounds.COMPOST_OPEN_2429)
updateBit()
}
@@ -47,7 +48,7 @@ class CompostBin(val player: Player, val bin: CompostBins) {
isSuperCompost = true
isClosed = false
}
player.audioManager.send(Audio (2443, 1, 1))
playAudio(player, Sounds.FARMING_SCOOP_2443)
updateBit()
if(isSuperCompost) rewardXP(player, Skills.FARMING, 8.5)
else rewardXP(player, Skills.FARMING, 4.5)
@@ -116,7 +117,7 @@ class CompostBin(val player: Player, val bin: CompostBins) {
} else item.amount
for(i in 0 until amount) {
player.audioManager.send(2441)
playAudio(player, Sounds.FARMING_PUTIN_2441)
addItem(item.id)
}
}
@@ -6,7 +6,6 @@ import core.game.interaction.OptionHandler
import core.game.node.Node
import content.global.skill.summoning.familiar.GiantEntNPC
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.game.node.item.Item
import core.game.system.task.Pulse
@@ -14,6 +13,7 @@ import core.game.world.update.flag.context.Animation
import core.plugin.Initializable
import core.plugin.Plugin
import org.rs09.consts.Items
import org.rs09.consts.Sounds
val livesBased = arrayOf(PatchType.HERB, PatchType.CACTUS, PatchType.BELLADONNA, PatchType.HOPS, PatchType.ALLOTMENT,PatchType.EVIL_TURNIP)
@@ -65,17 +65,17 @@ class CropHarvester : OptionHandler() {
else -> Animation(0)
}
val sound = when(requiredItem){
Items.SPADE_952 -> Audio(1470, 1, 1)
Items.SECATEURS_5329 -> Audio(2437, 1, 1)
Items.MAGIC_SECATEURS_7409 -> Audio(2437, 1, 1)
else -> Audio(0)
Items.SPADE_952 -> Sounds.DIGSPADE_1470
Items.SECATEURS_5329 -> Sounds.FARMING_PICK_2437
Items.MAGIC_SECATEURS_7409 -> Sounds.FARMING_PICK_2437
else -> 0
}
if(!player.inventory.containsItem(Item(requiredItem))){
player.sendMessage("You lack the needed tool to harvest these crops.")
return true
}
player.animator.animate(anim)
player.audioManager.send(sound)
playAudio(player, sound)
delay = 2
player.inventory.add(reward)
player.skills.addExperience(Skills.FARMING,plantable.harvestXP)
@@ -1,5 +1,6 @@
package content.global.skill.farming
import core.api.playAudio
import core.game.dialogue.DialoguePlugin
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.audio.Audio
@@ -8,6 +9,7 @@ import core.game.node.item.Item
import core.game.system.task.Pulse
import core.game.world.update.flag.context.Animation
import core.plugin.Initializable
import org.rs09.consts.Sounds
@Initializable
class DigUpPatchDialogue(player: Player? = null) : DialoguePlugin(player) {
@@ -35,7 +37,7 @@ class DigUpPatchDialogue(player: Player? = null) : DialoguePlugin(player) {
1 -> {
end()
player.animator.animate(Animation(830))
player.audioManager.send(Audio(1470, 1, 1))
playAudio(player, Sounds.DIGSPADE_1470)
player.pulseManager.run(object : Pulse(){
override fun pulse(): Boolean {
if(patch?.patch?.type == PatchType.TREE){
@@ -12,6 +12,7 @@ import core.game.system.task.Pulse
import core.game.world.update.flag.context.Animation
import core.plugin.Initializable
import core.plugin.Plugin
import org.rs09.consts.Sounds
import java.util.concurrent.TimeUnit
@Initializable
@@ -68,7 +69,7 @@ class FruitAndBerryPicker : OptionHandler() {
}
player.animator.animate(animation)
player.audioManager.send(2437)
playAudio(player, Sounds.FARMING_PICK_2437)
addItemOrDrop(player,reward.id,reward.amount)
player.skills.addExperience(Skills.FARMING,plantable.harvestXP)
patch.setCurrentState(patch.getCurrentState() - 1)
@@ -1,11 +1,13 @@
package content.global.skill.farming
import core.api.playAudio
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.node.item.Item
import core.game.system.task.Pulse
import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items
import org.rs09.consts.Sounds
object PatchRaker {
val RAKE_ANIM = Animation(2273)
@@ -17,7 +19,7 @@ object PatchRaker {
var patchStage = patch.getPatchFor(player).getCurrentState()
if(patchStage <= 2){
player.animator.animate(RAKE_ANIM)
player.audioManager.send(2442)
playAudio(player, Sounds.FARMING_RAKING_2442)
}
if(delay < 5) {
delay = 5
@@ -9,6 +9,7 @@ import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import org.rs09.consts.Sounds
class UseWithPatchHandler : InteractionListener {
val RAKE = Items.RAKE_5341
@@ -99,7 +100,7 @@ class UseWithPatchHandler : InteractionListener {
player.pulseManager.run(object: Pulse(){
override fun pulse(): Boolean {
player.animator.animate(plantCureAnim)
player.audioManager.send(2438)
playAudio(player, Sounds.FARMING_PLANTCURE_2438)
if(player.inventory.remove(usedItem)){
player.inventory.add(Item(Items.VIAL_229))
p.cureDisease()
@@ -123,7 +124,7 @@ class UseWithPatchHandler : InteractionListener {
return true
}
player.animator.animate(wateringCanAnim)
player.audioManager.send(2446)
playAudio(player, Sounds.FARMING_WATERING_2446)
if(player.inventory.remove(usedItem)){
player.inventory.add(Item(usedItem.id.getNext()))
p.water()
@@ -138,7 +139,7 @@ class UseWithPatchHandler : InteractionListener {
val p = patch.getPatchFor(player)
if(p.compost == CompostType.NONE) {
player.animator.animate(pourBucketAnim)
player.audioManager.send(2427)
playAudio(player, Sounds.FARMING_COMPOST_2427)
player.pulseManager.run(object : Pulse(){
override fun pulse(): Boolean {
if(player.inventory.remove(usedItem,false)){
@@ -207,7 +208,7 @@ class UseWithPatchHandler : InteractionListener {
player.lock()
if(player.inventory.remove(plantItem)) {
player.animator.animate(Animation(2291))
player.audioManager.send(2432)
playAudio(player, Sounds.FARMING_DIBBING_2432)
player.pulseManager.run(object : Pulse(3) {
override fun pulse(): Boolean {
if(plantable == Plantable.JUTE_SEED && patch == FarmingPatch.MCGRUBOR_HOPS && !player.achievementDiaryManager.hasCompletedTask(DiaryType.SEERS_VILLAGE,0,7)){
@@ -1,10 +1,12 @@
package content.global.skill.gather
import core.api.playAudio
import core.game.interaction.NodeUsageEvent
import core.game.interaction.UseWithHandler
import core.game.node.item.Item
import core.plugin.Initializable
import core.plugin.Plugin
import org.rs09.consts.Sounds
/**
* Repairs pickaxes after being broken
@@ -35,7 +37,7 @@ class PickaxeRepairPlugin : UseWithHandler(480,482,484,486,488,490){
event.player.inventory.remove(used.asItem())
event.player.inventory.add(Item(product))
event.player.sendMessage("You carefully reattach the head to the handle.")
event.player.audioManager.send(10)
playAudio(event.player, Sounds.EYEGLO_COIN_10)
return true
}
@@ -12,14 +12,13 @@ import core.api.*
import core.cache.def.impl.ItemDefinition
import core.game.container.impl.EquipmentContainer
import core.game.event.ResourceProducedEvent
import core.game.interaction.Clocks
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.interaction.Clocks
import core.game.node.Node
import core.game.node.entity.npc.NPC
import core.game.node.entity.impl.Projectile
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.node.entity.player.link.diary.DiaryType
import core.game.node.entity.skill.Skills
import core.game.node.item.Item
@@ -169,7 +168,7 @@ class WoodcuttingListener : InteractionListener {
SceneryBuilder.replace(node, node.transform(0), resource.getRespawnDuration())
}
node.setActive(false)
player.getAudioManager().send(TREE_FALLING_2734)
playAudio(player, TREE_FALLING_2734)
return true
}
}
@@ -196,11 +195,10 @@ class WoodcuttingListener : InteractionListener {
.filter { p: Player -> p.username != player.username }
.toList()
val soundIndex = RandomFunction.random(0, woodcuttingSounds.size)
player.audioManager.send(
Audio(woodcuttingSounds[soundIndex]),
playersAroundMe,
player.location
)
for (p in playersAroundMe) {
playAudio(p, woodcuttingSounds[soundIndex])
}
}
}
@@ -29,6 +29,7 @@ import org.rs09.consts.Sounds;
import java.util.List;
import java.util.stream.Collectors;
import static core.api.ContentAPIKt.playAudio;
import static core.game.system.command.sets.StatAttributeKeysKt.STATS_BASE;
import static core.game.system.command.sets.StatAttributeKeysKt.STATS_LOGS;
@@ -123,11 +124,9 @@ public class WoodcuttingSkillPulse extends Pulse {
int soundIndex = RandomFunction.random(0, woodcuttingSounds.length);
player.getAudioManager().send(
new Audio(woodcuttingSounds[soundIndex]),
playersAroundMe,
player.getLocation()
);
for (Player p : playersAroundMe) {
playAudio(p, woodcuttingSounds[soundIndex]);
}
}
}
@@ -216,7 +215,7 @@ public class WoodcuttingSkillPulse extends Pulse {
}
node.setActive(false);
player.getAudioManager().send(Sounds.TREE_FALLING_2734);
playAudio(player, Sounds.TREE_FALLING_2734);
return true;
}
}
@@ -41,7 +41,7 @@ public final class HerbCleanPlugin extends OptionHandler {
if (removeItem(player, node.asItem(), Container.INVENTORY)){
player.getSkills().addExperience(Skills.HERBLORE, exp, true);
addItem(player, herb.getProduct().getId(), 1, Container.INVENTORY);
player.getAudioManager().send(5153, 1);
playAudio(player, 5153);
player.getPacketDispatch().sendMessage("You clean the dirt from the " + herb.getProduct().getName().toLowerCase().replace("clean", "").trim() + " leaf.");
}
player.lock(1);
@@ -9,6 +9,9 @@ import core.tools.StringUtils;
import content.global.skill.skillcapeperks.*;
import content.data.consumables.Consumables;
import core.tools.RandomFunction;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
@@ -121,7 +124,7 @@ public final class HerblorePulse extends SkillPulse<Item> {
final Item item = potion.getProduct();
player.getInventory().add(item);
player.getPacketDispatch().sendMessage("You put the" + StringUtils.formatDisplayName(potion.getIngredient().getName().toLowerCase().replace("clean", "")) + " leaf into the vial of water.");
player.getAudioManager().send(2608);
playAudio(player, Sounds.GRIND_2608);
if (cycles++ == 3) {
player.animate(ANIMATION);
cycles = 0;
@@ -146,7 +149,7 @@ public final class HerblorePulse extends SkillPulse<Item> {
player.getInventory().add(item);
player.getSkills().addExperience(Skills.HERBLORE, potion.getExperience(), true);
player.getPacketDispatch().sendMessage("You mix the " + potion.getIngredient().getName().toLowerCase() + " into your potion.");
player.getAudioManager().send(2608);
playAudio(player, Sounds.GRIND_2608);
player.animate(ANIMATION);
}
}
@@ -57,21 +57,21 @@ public final class TrapCreatePulse extends SkillPulse<Node> {
if (checkRequirements()){
switch(trap) {
case BIRD_SNARE:
player.getAudioManager().send(Sounds.HUNTING_SETNOOSE_2646, 10, 40);
playAudio(player, Sounds.HUNTING_SETNOOSE_2646, 40);
break;
case BOX_TRAP:
player.getAudioManager().send(Sounds.HUNTING_LAYBOXTRAP_2636, 10, 20);
playAudio(player, Sounds.HUNTING_LAYBOXTRAP_2636, 20);
break;
case NET_TRAP:
lock(player, 3);
player.getAudioManager().send(Sounds.HUNTING_SET_TWITCHNET_2644);
playAudio(player, Sounds.HUNTING_SET_TWITCHNET_2644);
break;
case RABBIT_SNARE:
player.getAudioManager().send(Sounds.HUNTING_SETSNARE_2647);
playAudio(player, Sounds.HUNTING_SETSNARE_2647);
break;
case DEAD_FALL:
lock(player, 6);
player.getAudioManager().send(Sounds.HUNTING_SETDEADFALL_2645, 10, 130);
playAudio(player, Sounds.HUNTING_SETDEADFALL_2645, 130);
}
}
}
@@ -46,20 +46,20 @@ public final class TrapDismantlePulse extends SkillPulse<Scenery> {
switch(trap) {
case BIRD_SNARE:
lock(player,5);
player.getAudioManager().send(Sounds.HUNTING_DISMANTLE_2632, 10, 50);
playAudio(player, Sounds.HUNTING_DISMANTLE_2632, 50);
break;
case BOX_TRAP:
lock(player,4);
player.getAudioManager().send(Sounds.HUNTING_DISMANTLE_2632, 10, 50);
playAudio(player, Sounds.HUNTING_DISMANTLE_2632, 50);
break;
case NET_TRAP:
lock(player, 5);
player.getAudioManager().send(Sounds.HUNTING_DISMANTLE_2632, 10, 20);
playAudio(player, Sounds.HUNTING_DISMANTLE_2632, 20);
break;
case RABBIT_SNARE:
case DEAD_FALL:
lock(player, 4);
player.getAudioManager().send(Sounds.HUNTING_DISMANTLE_2632, 10, 80);
playAudio(player, Sounds.HUNTING_DISMANTLE_2632, 80);
break;
}
}
@@ -18,6 +18,8 @@ import core.game.world.update.flag.context.Animation;
import core.tools.RandomFunction;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* A setting for a trap type.
* @author Vexia
@@ -309,18 +311,18 @@ public class TrapSetting {
wrapper.setObject(getFinalId(wrapper, node));
switch(wrapper.getType()) {
case BIRD_SNARE:
player.getAudioManager().send(Sounds.HUNTING_NOOSE_2637, 10, 0, 10, wrapper.getObject().getLocation());
player.getAudioManager().send(Sounds.HUNTING_BIRDCAUGHT_2625, 10, 20, 10, wrapper.getObject().getLocation());
playAudio(player, Sounds.HUNTING_NOOSE_2637, 0, 1, wrapper.getObject().getLocation(), 10);
playAudio(player, Sounds.HUNTING_BIRDCAUGHT_2625, 20, 1, wrapper.getObject().getLocation(), 10);
break;
case BOX_TRAP:
player.getAudioManager().send(Sounds.HUNTING_BOXTRAP_2627, 10, 0, 10, wrapper.getObject().getLocation());
playAudio(player, Sounds.HUNTING_BOXTRAP_2627, 0, 1, wrapper.getObject().getLocation(), 10);
break;
case NET_TRAP:
player.getAudioManager().send(Sounds.HUNTING_TWITCHNET_2652, 10, 0, 10, wrapper.getObject().getLocation());
player.getAudioManager().send(Sounds.SALAMANDER_HIT_739, 10, 20, 10, wrapper.getObject().getLocation());
playAudio(player, Sounds.HUNTING_TWITCHNET_2652, 0, 1, wrapper.getObject().getLocation(), 10);
playAudio(player, Sounds.SALAMANDER_HIT_739, 20, 1, wrapper.getObject().getLocation(), 10);
break;
case DEAD_FALL:
player.getAudioManager().send(Sounds.HUNTING_DEADFALL_2631, 10, 0, 10, wrapper.getObject().getLocation());
playAudio(player, Sounds.HUNTING_DEADFALL_2631, 0, 1, wrapper.getObject().getLocation(), 10);
break;
}
return true;
@@ -15,6 +15,8 @@ import org.rs09.consts.Sounds;
import java.util.Random;
import static core.api.ContentAPIKt.playAudio;
/**
* Handles the butterfly net catch pulse.
* @author Vexia
@@ -94,7 +96,7 @@ public final class BNetPulse extends SkillPulse<NPC> {
public void animate() {
if (ticks < 1) {
player.animate(ANIMATION);
player.getAudioManager().send(Sounds.HUNTING_BUTTERFLYNET_2623);
playAudio(player, Sounds.HUNTING_BUTTERFLYNET_2623);
}
}
@@ -15,6 +15,8 @@ import core.game.world.repository.Repository;
import core.tools.RandomFunction;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Represents the skill pulse used to catch a kebbit.
* @author Vexia
@@ -124,7 +126,7 @@ public final class FalconryCatchPulse extends SkillPulse<NPC> {
falcon.setAttribute("falcon:catch", falconCatch);
falcon.init();
HintIconManager.registerHintIcon(player, falcon);
player.getAudioManager().send(Sounds.HUNTING_FALCON_SWOOP_2634, 10, 0, 12, node.getLocation());
playAudio(player, Sounds.HUNTING_FALCON_SWOOP_2634, 10, 1, node.getLocation(), 12);
GameWorld.getPulser().submit(new Pulse(100, falcon) {
@Override
public boolean pulse() {
@@ -157,7 +159,7 @@ public final class FalconryCatchPulse extends SkillPulse<NPC> {
projectile.setStartHeight(26);
projectile.setEndHeight(1);
projectile.send();
player.getAudioManager().send(Sounds.HUNTING_FALCON_FLY_2633);
playAudio(player, Sounds.HUNTING_FALCON_FLY_2633);
}
/**
@@ -225,8 +225,8 @@ class PitfallListeners : InteractionListener {
//pitfall_npc.setLocation(pit.getLocation());
//pitfall_npc.walkingQueue.addPath(pit.location.x, pit.location.y);
teleport(pitfall_npc, pit.location)
player.audioManager.send(Sounds.HUNTING_PITFALL_COLLAPSE_2638, 10, 0, 10, pit.location)
player.audioManager.send(Sounds.PANTHER_DEATH_667, 10, 50, 10, pit.location)
playAudio(player, Sounds.HUNTING_PITFALL_COLLAPSE_2638, 0, 1, pit.location, 10)
playAudio(player, Sounds.PANTHER_DEATH_667, 50, 1, pit.location, 10)
pitfall_npc.startDeath(null)
player.removeAttribute("pitfall:timestamp:${pit.location.x}:${pit.location.y}")
player.incrementAttribute("pitfall:count", -1)
@@ -238,7 +238,7 @@ class PitfallListeners : InteractionListener {
val npcdst = dst.transform(dir, if(dir == Direction.SOUTH || dir == Direction.WEST) 1 else 0)
teleport(pitfall_npc, npcdst)
pitfall_npc.animate(Animation(5232, Priority.HIGH))
player.audioManager.send(Sounds.HUNTING_BIGCAT_JUMP_2619, 10, 0, 10, pit.location)
playAudio(player, Sounds.HUNTING_BIGCAT_JUMP_2619, 0, 1, pit.location, 10)
pitfall_npc.attack(player)
pitfall_npc.setAttribute("last_pit_loc", pit.location)
}
@@ -1,5 +1,6 @@
package content.global.skill.magic
import core.api.playAudio
import core.api.setAttribute
import core.cache.def.impl.ItemDefinition
import core.game.node.Node
@@ -76,7 +77,7 @@ abstract class SpellListener(val bookName: String) : Listener {
if(player.getAttribute("tablet-spell",false)) return
player.visualize(anim,gfx)
if(soundID != -1){
player.audioManager.send(soundID)
playAudio(player, soundID)
}
}
@@ -1,12 +1,14 @@
package content.global.skill.magic
import content.global.skill.magic.spellconsts.Modern
import core.api.playAudio
import core.game.node.entity.player.Player
import core.game.node.item.Item
import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
import org.rs09.consts.Sounds
class SpellTablets : InteractionListener {
val B2P_TABLET = Items.BONES_TO_PEACHES_8015
@@ -30,7 +32,7 @@ class SpellTablets : InteractionListener {
}
fun breakTablet(player: Player){
player.audioManager.send(979)
playAudio(player, Sounds.POH_TABLET_BREAK_979)
player.animator.forceAnimation(Animation(4069))
player.lock(5)
player.setAttribute("tablet-spell",true)
@@ -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(), 20);
playGlobalAudio(entity.getLocation(), audio.id, 20);
}
@Override
@@ -102,7 +102,7 @@ public final class IceSpells extends CombatSpell {
projectile.transform(entity, (Entity) target, false, 58, 10).send();
}
entity.animate(animation);
playGlobalAudio(entity.getLocation(), audio.getId(), 20);
playGlobalAudio(entity.getLocation(), audio.id, 20);
}
@@ -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(), 20);
playGlobalAudio(entity.getLocation(), audio.id, 20);
}
@Override
@@ -99,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(), 20);
playGlobalAudio(entity.getLocation(), audio.id, 20);
}
@Override
@@ -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(), 20);
playGlobalAudio(entity.getLocation(), audio.id, 20);
}
@Override
@@ -9,17 +9,19 @@ import core.game.node.entity.Entity;
import core.game.node.entity.combat.ImpactHandler.HitsplatType;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.audio.Audio;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.node.item.Item;
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.Plugin;
import org.rs09.consts.Sounds;
import java.util.Iterator;
import java.util.List;
import static core.api.ContentAPIKt.playGlobalAudio;
/**
* Represents the healing spell.
* @author 'Vexia
@@ -105,8 +107,8 @@ public final class HealSpell extends MagicSpell {
player.getImpactHandler().manualHit(player, transfer, null);
o.getSkills().heal(transfer);
player.animate(ANIMATION);
player.getAudioManager().send(new Audio(2895), true);
o.getAudioManager().send(new Audio(2892), true);
playGlobalAudio(player.getLocation(), Sounds.LUNAR_HEAL_OTHER_2895);
playGlobalAudio(o.getLocation(), Sounds.LUNAR_HEAL_OTHER_INDIVIDUAL_2892);
o.graphics(GRAPHICS);
} else {
List<Player> players = RegionManager.getLocalPlayers(player, 1);
@@ -130,9 +132,9 @@ public final class HealSpell extends MagicSpell {
}
player.getImpactHandler().manualHit(player, percentage, HitsplatType.NORMAL);
player.animate(ANIMATION_G);
player.getAudioManager().send(new Audio(2894), true);
playGlobalAudio(player.getLocation(), Sounds.LUNAR_HEAL_GROUP_2894);
for (Player p : players) {
p.getAudioManager().send(new Audio(2892), true);
playGlobalAudio(p.getLocation(), Sounds.LUNAR_HEAL_OTHER_INDIVIDUAL_2892);
p.graphics(GRAPHICS_G);
p.getSkills().heal(percentage);
}
@@ -13,6 +13,9 @@ import core.game.world.GameWorld;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Plugin;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* The magic imbue spell.
@@ -61,7 +64,7 @@ public class MagicImbueSpell extends MagicSpell {
player.lock(ANIMATION.getDuration() + 1);
player.graphics(GRAPHIC);
player.animate(ANIMATION);
player.getAudioManager().send(2888, 1, 1);
playAudio(player, Sounds.LUNAR_EMBUE_RUNES_2888);
player.getPacketDispatch().sendMessage("You are charged to combine runes!");
return true;
}
@@ -8,7 +8,6 @@ import core.game.node.Node;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.audio.Audio;
import core.game.bots.AIPlayer;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.node.item.Item;
@@ -17,9 +16,12 @@ import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
import org.rs09.consts.Sounds;
import java.util.List;
import static core.api.ContentAPIKt.playGlobalAudio;
@Initializable
public final class StatBoostSpell extends MagicSpell {
@@ -70,7 +72,7 @@ public final class StatBoostSpell extends MagicSpell {
continue;
}
o.graphics(GRAPHICS);
o.getAudioManager().send(new Audio (2902), true);
playGlobalAudio(o.getLocation(), Sounds.LUNAR_STRENGTH_SHARE2_2902);
potion.getEffect().activate(o);
size++;
}
@@ -80,7 +82,7 @@ public final class StatBoostSpell extends MagicSpell {
}
super.meetsRequirements(player, true, true);
potion.getEffect().activate(player);
player.getAudioManager().send(new Audio (2901), true);
playGlobalAudio(player.getLocation(), Sounds.LUNAR_STRENGTH_SHARE_2901);
player.animate(ANIMATION);
player.graphics(GRAPHICS);
player.getInventory().remove(item);
@@ -9,7 +9,6 @@ import core.game.node.Node;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.spell.SpellType;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.audio.Audio;
import core.game.bots.AIPlayer;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.node.item.Item;
@@ -17,9 +16,12 @@ 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.Plugin;
import org.rs09.consts.Sounds;
import java.util.List;
import static core.api.ContentAPIKt.playGlobalAudio;
@Initializable
public class StatRestoreSpell extends MagicSpell {
@@ -87,7 +89,7 @@ public class StatRestoreSpell extends MagicSpell {
}
super.meetsRequirements(player, true, true);
potion.getEffect().activate(player);
player.getAudioManager().send(new Audio (2899), true);
playGlobalAudio(player.getLocation(), Sounds.LUNAR_STAT_SHARE_2899);
player.animate(ANIMATION);
player.graphics(GRAPHICS);
player.getInventory().remove(item);
@@ -15,6 +15,9 @@ import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Plugin;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* The stat spy spell.
@@ -72,7 +75,7 @@ public final class StatSpySpell extends MagicSpell {
final Player o = ((Player) target);
player.animate(ANIMATION);
player.face(o);
player.getAudioManager().send(3620);
playAudio(player, Sounds.LUNAR_STAT_SPY_3620);
COMPONENT.setCloseEvent(new CloseEvent() {
@Override
public boolean close(Player player, Component c) {
@@ -82,7 +85,7 @@ public final class StatSpySpell extends MagicSpell {
});
player.graphics(EYE);
o.graphics(GRAPHIC);
player.getAudioManager().send(3621);
playAudio(player, Sounds.LUNAR_STAT_SPY_IMPACT_3621);
for (int[] element : SKILLS) {
player.getPacketDispatch().sendString("" + o.getSkills().getLevel(element[0]) + "", 523, element[1]);
player.getPacketDispatch().sendString("" + o.getSkills().getStaticLevel(element[0]) + "", 523, element[2]);
@@ -13,6 +13,10 @@ import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
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;
/**
* Handles the vengeance (other) spell.
@@ -81,7 +85,7 @@ public final class VengeanceSpell extends MagicSpell {
visualize(entity, p);
entity.setAttribute("vengeance_delay", ticks + 50);
p.setAttribute("vengeance", true);
p.getAudioManager().send(vengOther ? 2908 : 2907);
playGlobalAudio(p.getLocation(), vengOther ? Sounds.LUNAR_VENGENCE_OTHER_2908 : Sounds.LUNAR_VENGENCE_2907);
return true;
}
@@ -187,7 +187,7 @@ class ModernListeners : SpellListener("modern"){
}
}
visualizeSpell(player,BONE_CONVERT_ANIM, BONE_CONVERT_GFX)
player.audioManager.send(Audio(114))
playAudio(player, Sounds.BONES_TO_BANANAS_ALL_114)
removeRunes(player)
addXP(player,if(bananas) 25.0 else 65.0)
setDelay(player,false)
@@ -223,7 +223,7 @@ class ModernListeners : SpellListener("modern"){
player.lock(3)
removeRunes(player)
addXP(player,53.0)
player.audioManager.send(Sounds.SUPERHEAT_ALL_190)
playAudio(player, Sounds.SUPERHEAT_ALL_190)
showMagicTab(player)
player.pulseManager.run(SmeltingPulse(player, item, bar, 1, true))
setDelay(player,false)
@@ -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(), 20);
playGlobalAudio(entity.getLocation(), audio.id, 20);
}
@Override
@@ -7,12 +7,14 @@ import core.game.node.entity.skill.Skills;
import core.game.interaction.OptionHandler;
import core.game.node.Node;
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.system.task.Pulse;
import core.game.world.GameWorld;
import core.game.world.update.flag.context.Animation;
import core.plugin.Plugin;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Represents the bone bury option plugin.
@@ -26,10 +28,6 @@ public final class BoneBuryingOptionPlugin extends OptionHandler {
*/
private static final Animation ANIMATION = new Animation(827);
/**
* Represents the sound to use.
*/
private static final Audio SOUND = new Audio(2738, 10, 1);
@Override
public boolean handle(final Player player, Node node, String option) {
@@ -57,7 +55,7 @@ public final class BoneBuryingOptionPlugin extends OptionHandler {
player.lock(2);
player.animate(ANIMATION);
player.getPacketDispatch().sendMessage("You dig a hole in the ground...");
player.getAudioManager().send(SOUND);
playAudio(player, Sounds.BONES_DOWN_2738);
final Bones bonee = bone;
GameWorld.getPulser().submit(new Pulse(2, player) {
@Override
@@ -14,8 +14,10 @@ import core.game.node.entity.player.link.quest.Quest;
import core.game.world.map.Location;
import core.game.world.update.flag.context.Animation;
import core.plugin.Plugin;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.hasRequirement;
import static core.api.ContentAPIKt.playAudio;
/**
* Handles the praying at an alter.
@@ -93,7 +95,7 @@ public class PrayerAltarPlugin extends OptionHandler {
*/
public void visualize(Player player) {
player.lock(3);
player.getAudioManager().send(2674);
playAudio(player, Sounds.PRAYER_RECHARGE_2674);
player.animate(Animation.create(645));
}
@@ -12,12 +12,13 @@ import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.tools.RandomFunction;
import static core.api.ContentAPIKt.inEquipment;
import static core.api.ContentAPIKt.*;
import static core.game.system.command.sets.StatAttributeKeysKt.STATS_BASE;
import static core.game.system.command.sets.StatAttributeKeysKt.STATS_RC;
import static core.api.ContentAPIKt.hasRequirement;
import core.game.world.GameWorld;
import org.rs09.consts.Items;
import org.rs09.consts.Sounds;
import java.util.ArrayList;
import java.util.Arrays;
@@ -152,7 +153,7 @@ public final class RuneCraftPulse extends SkillPulse<Item> {
public void animate() {
player.animate(ANIMATION);
player.graphics(GRAPHICS);
player.getAudioManager().send(2710);
playAudio(player, Sounds.BIND_RUNES_2710);
}
@Override
@@ -111,7 +111,7 @@ public class SmeltingPulse extends SkillPulse<Item> {
player.visualize(Animation.create(725), new Graphics(148, 96));
} else {
player.animate(Animation.create(3243)); // Used to be 899 but that looked wonky and broken
player.getAudioManager().send(Sounds.FURNACE_2725, 1);
playAudio(player, Sounds.FURNACE_2725);
}
}
}
@@ -10,6 +10,9 @@ import core.game.node.entity.player.Player;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Plugin;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Represents the option used on the summoning obelisk.
@@ -31,7 +34,7 @@ public final class ObeliskOptionPlugin extends OptionHandler {
return true;
}
player.visualize(Animation.create(8502), Graphics.create(1308));
player.getAudioManager().send(4214);
playAudio(player, Sounds.DREADFOWL_BOOST_4214);
player.getSkills().setLevel(Skills.SUMMONING, player.getSkills().getStaticLevel(Skills.SUMMONING));
player.dispatch(new SummoningPointsRechargeEvent(node));
player.getPacketDispatch().sendMessage("You renew your summoning points.");
@@ -39,7 +42,6 @@ public final class ObeliskOptionPlugin extends OptionHandler {
}
return false;
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
SceneryDefinition.setOptionHandler("infuse-pouch", this);
@@ -10,6 +10,9 @@ import core.game.node.scenery.Scenery;
import core.game.world.map.Location;
import core.game.world.map.RegionManager;
import core.game.world.update.flag.context.Animation;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Represents a utility class of creating summoning nodes.
@@ -157,7 +160,7 @@ public final class SummoningCreator {
if (getDelay() == 1) {
setDelay(4);
player.getPacketDispatch().sendSceneryAnimation(object, Animation.create(8509));
player.getAudioManager().send(4164); // 4277 also sounds the same
playAudio(player, Sounds.CRAFT_POUCH_4164); // 4277 also sounds the same
return false;
}
player.getPacketDispatch().sendSceneryAnimation(object, Animation.create(8510));
@@ -30,6 +30,7 @@ import core.game.node.entity.combat.CombatSwingHandler;
import core.tools.SystemLogger;
import core.game.world.GameWorld;
import content.global.skill.summoning.SummoningPouch;
import org.rs09.consts.Sounds;
import java.util.ArrayList;
import java.util.List;
@@ -371,7 +372,7 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
if (specialMove(special)) {
setAttribute("special-delay", GameWorld.getTicks() + 3);
owner.getInventory().remove(new Item(scroll.getItemId()));
owner.getAudioManager().send(4161);
playAudio(owner, Sounds.SPELL_4161);
visualizeSpecialMove();
updateSpecialPoints(specialCost);
owner.getSkills().addExperience(Skills.SUMMONING, scroll.getExperience(), true);
@@ -564,10 +565,11 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
getProperties().setTeleportLocation(destination);
if (!(this instanceof Pet)) {
if(firstCall) {
owner.getAudioManager().send(4366);
// TODO: Each familiar has its own initial summon sound that needs to be implemented at some point
playAudio(owner, Sounds.SUMMON_NPC_188);
firstCall = false;
} else {
owner.getAudioManager().send(188);
playAudio(owner, Sounds.SUMMON_NPC_188);
}
if (size() > 1) {
graphics(LARGE_SUMMON_GRAPHIC);
@@ -15,6 +15,9 @@ import core.game.world.map.path.Path;
import core.game.world.map.path.Pathfinder;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Handles the Spirit wolf familiar.
@@ -105,7 +108,7 @@ public final class SpiritWolfNPC extends Familiar {
return false;
}
visualizeSpecialMove();
owner.getAudioManager().send(4265);
playAudio(owner, Sounds.WOLF_HOWL2_4265);
faceTemporary(npc, owner, 2);
super.visualize(Animation.create(8293), new Graphics(1334, 96));
Projectile.magic(this, npc, 1333, 40, 36, 50, 5).send();
@@ -11,6 +11,7 @@ import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Plugin;
import core.plugin.ClassScanner;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.*;
@@ -45,7 +46,7 @@ public class UnicornStallionNPC extends Familiar {
@Override
protected boolean specialMove(FamiliarSpecial special) {
Player player = (Player) special.getNode();
player.getAudioManager().send(4372);
playAudio(player, Sounds.HEALING_AURA_4372);
visualize(Animation.create(8267), Graphics.create(1356));
player.getSkills().heal((int) (player.getSkills().getMaximumLifepoints() * 0.15));
return true;
@@ -77,7 +78,7 @@ public class UnicornStallionNPC extends Familiar {
player.sendMessage("You are not poisoned.");
return true;
}
player.getAudioManager().send(4372);
playAudio(player, Sounds.HEALING_AURA_4372);
familiar.visualize(Animation.create(8267), Graphics.create(1356));
curePoison(player);
player.getSkills().updateLevel(Skills.SUMMONING, -2, 0);
@@ -2,6 +2,7 @@ package content.minigame.mta
import content.global.skill.magic.SpellListener
import content.global.skill.magic.spellconsts.Modern
import core.api.playAudio
import core.game.node.item.Item
import core.game.world.map.Direction
import core.game.world.update.flag.context.Animation
@@ -10,6 +11,7 @@ import org.rs09.consts.Items
import org.rs09.consts.NPCs
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
import org.rs09.consts.Sounds
class MTAListeners : InteractionListener {
override fun defineListeners() {
@@ -55,7 +57,7 @@ class MTASpellListeners : SpellListener("modern"){
p.lock(3)
p.visualize(HIGH_ALCH_ANIM,HIGH_ALCH_GFX)
if(p.inventory.remove(Item(item.id,1))){
p.audioManager.send(97)
playAudio(p, Sounds.HIGH_ALCHEMY_97)
if (coins.amount != 0) {
p.inventory.add(coins)
}
@@ -90,7 +92,7 @@ class MTASpellListeners : SpellListener("modern"){
p.lock(3)
p.visualize(LOW_ALCH_ANIM,LOW_ALCH_GFX)
if(p.inventory.remove(Item(item.id,1))){
p.audioManager.send(97)
playAudio(p, Sounds.HIGH_ALCHEMY_97)
if (coins.amount != 0) {
p.inventory.add(coins)
}
@@ -22,6 +22,9 @@ import core.game.world.update.flag.context.Graphics;
import core.plugin.Plugin;
import core.game.global.action.PickupHandler;
import core.game.world.GameWorld;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Represents the telekenitic grab spell.
@@ -143,7 +146,7 @@ public final class TelekineticGrabSpell extends MagicSpell {
player.getPacketDispatch().sendMessage("Too late!");
return true;
}
player.getAudioManager().send(3008);
playAudio(player, Sounds.VULNERABILITY_IMPACT_3008);
if (!teleZone) {
player.getInventory().add(new Item(g.getId(), g.getAmount(), g.getCharge()));
} else {
@@ -25,10 +25,6 @@ import core.game.world.update.flag.context.Animation
import core.game.world.update.flag.context.Graphics
import core.plugin.Initializable
import core.tools.RandomFunction
import org.rs09.consts.Animations
import org.rs09.consts.Components
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import content.minigame.vinesweeper.Vinesweeper.Companion.FARMERS
import content.minigame.vinesweeper.Vinesweeper.Companion.FARMER_CLEAR_RADIUS
import content.minigame.vinesweeper.Vinesweeper.Companion.HOLES
@@ -43,6 +39,7 @@ import core.game.interaction.IntType
import core.game.interaction.InterfaceListener
import core.game.world.GameWorld
import core.game.world.GameWorld.ticks
import org.rs09.consts.*
import org.rs09.consts.Graphics as Gfx
import org.rs09.consts.Scenery as Sceneries
@@ -505,7 +502,7 @@ class Vinesweeper : InteractionListener, InterfaceListener, MapArea {
npc.faceTemporary(player, 1)
npc.graphics(Graphics(108))
player.lock()
player.audioManager.send(125)
playAudio(player, Sounds.CURSE_ALL_125, 0, 1)
Projectile.create(npc, player, 109).send()
npc.sendChat("Avach nimporto!")
GameWorld.Pulser.submit(object : Pulse(1, player) {
@@ -18,6 +18,9 @@ import core.game.world.map.zone.ZoneBuilder;
import core.game.world.update.flag.context.Animation;
import core.plugin.Initializable;
import core.plugin.Plugin;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Handles the animation
@@ -132,7 +135,7 @@ public final class AnimationRoom extends MapZone implements Plugin<Object> {
return true;
}
}
player.getAudioManager().send(1909);
playAudio(player, Sounds.WARGUILD_ANIMATE_1909);
player.logoutListeners.put("animation-room", player1 -> {
for(int item : set.getPieces()) player1.getInventory().add(new Item(item));
return Unit.INSTANCE;
@@ -144,7 +147,7 @@ public final class AnimationRoom extends MapZone implements Plugin<Object> {
}
if (getDelay() == 4) {
setDelay(1);
player.getAudioManager().send(1910);
playAudio(player, Sounds.WARGUILD_ANIMATOR_ACTIVATE_1910);
ForceMovement.run(player, player.getLocation().transform(0, 1, 0)).setDirection(Direction.SOUTH);
return false;
}
@@ -33,7 +33,9 @@ import core.plugin.Plugin;
import core.plugin.ClassScanner;
import core.plugin.Initializable;
import core.tools.RandomFunction;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
import static core.api.ContentAPIKt.setVarp;
/**
@@ -148,9 +150,8 @@ public final class CatapultRoom extends MapZone implements Plugin<Object> {
Scenery object = RegionManager.getObject(Location.create(2840, 3552, 1));
if(object != null)
SceneryBuilder.replace(object, object.transform(attack.objectId), 4);
Audio sound = new Audio(1911);
for (Player p : players) {
p.getAudioManager().send(sound);
playAudio(p, Sounds.WARGUILD_CATAPULT_ANVIL_1911);
}
return players.isEmpty();
}
@@ -33,6 +33,9 @@ import core.net.packet.out.Interface;
import core.plugin.Plugin;
import core.plugin.Initializable;
import core.tools.RandomFunction;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Handles the Giant Mole NPC.
@@ -239,7 +242,7 @@ public final class GiantMoleNPC extends AbstractNPC {
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
if (button == 17) {
player.getProperties().setTeleportLocation(Location.create(1752, 5237, 0));
player.getAudioManager().send(1384);
playAudio(player, Sounds.ROOF_COLLAPSE_1384);
player.getPacketDispatch().sendMessage("You seem to have dropped down into a network of mole tunnels.");
if (!player.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).isComplete(0, 5)) {
@@ -295,7 +295,7 @@ public final class RugMerchantDialogue extends DialoguePlugin {
player.getInterfaceManager().removeTabs(0,1,2,3,4,5,6,7,8,9,10,11,12,13);
player.getEquipment().replace(new Item(Items.MAGIC_CARPET_5614),EquipmentContainer.SLOT_WEAPON);
player.getPacketDispatch().sendInterfaceConfig(548,69,true);
player.getAudioManager().send(Sounds.CARPET_RISE_1196);
playAudio(player, Sounds.CARPET_RISE_1196);
playJingle(player, 132);
registerLogoutListener(player, "magic-carpet", (pl) -> {
@@ -342,7 +342,7 @@ public final class RugMerchantDialogue extends DialoguePlugin {
player.unlock();
player.animate(new Animation(-1));
setVarp(player, 499, 0);
player.getAudioManager().send(Sounds.CARPET_DESCEND_1195);
playAudio(player, Sounds.CARPET_DESCEND_1195);
clearLogoutListener(player, "magic-carpet");
@@ -15,6 +15,7 @@ import core.game.global.action.DoorActionHandler
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
import org.rs09.consts.NPCs
import org.rs09.consts.Sounds
class SeersHouseListeners : InteractionListener {
@@ -269,7 +270,7 @@ class SeersHouseListeners : InteractionListener {
onUseWith(IntType.SCENERY,REDHERRING,COOKINGRANGE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
player.audioManager.send(Audio(2577, 1, 1))
playAudio(player, Sounds.FRY_2577)
removeItem(player,REDHERRING)
addItem(player,REDGOOP)
sendDialogue(player,"As you cook the herring on the stove, the colouring on it peels off separately as a red sticky goop...")
@@ -894,7 +895,7 @@ class SeersHouseListeners : InteractionListener {
onUseWith(IntType.SCENERY, FROZENBUCKET, COOKINGRANGE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
player.audioManager.send(Audio(2577, 1, 1))
playAudio(player, Sounds.FRY_2577)
removeItem(player,FROZENBUCKET)
addItem(player,EMPTYBUCKET)
sendMessage(player,"You place the frozen bucket on the range. The ice turns to steam.")
@@ -903,7 +904,7 @@ class SeersHouseListeners : InteractionListener {
onUseWith(IntType.SCENERY, FROZENJUG, COOKINGRANGE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
player.audioManager.send(Audio(2577, 1, 1))
playAudio(player, Sounds.FRY_2577)
removeItem(player,FROZENJUG)
addItem(player,EMPTYJUG)
sendMessage(player,"You place the frozen jug on the range. The ice turns to steam.")
@@ -912,7 +913,7 @@ class SeersHouseListeners : InteractionListener {
onUseWith(IntType.SCENERY, FROZENVASE, COOKINGRANGE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
player.audioManager.send(Audio(2577, 1, 1))
playAudio(player, Sounds.FRY_2577)
removeItem(player,FROZENVASE)
addItem(player,VASE)
sendMessage(player,"You place the frozen vase on the range. The ice turns into steam.")
@@ -921,7 +922,7 @@ class SeersHouseListeners : InteractionListener {
onUseWith(IntType.SCENERY, FROZENKEY, COOKINGRANGE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
player.audioManager.send(Audio(2577, 1, 1))
playAudio(player, Sounds.FRY_2577)
removeItem(player,FROZENKEY)
addItem(player,SEERSKEY)
sendMessage(player,"The heat of the range melts the ice around the key.")
@@ -17,6 +17,9 @@ import core.game.world.map.Location;
import core.game.world.update.flag.context.Animation;
import core.plugin.Plugin;
import core.plugin.ClassScanner;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Handles wilderness levers.
@@ -64,7 +67,7 @@ public final class WildernessLeverPlugin extends OptionHandler {
private static void pullLever(final Player player, final LeverSets lever, final int index) {
player.lock(2);
player.animate(lever.getAnimation());
player.getAudioManager().send(new Audio(2400));
playAudio(player, Sounds.LEVER_2400);
GameWorld.getPulser().submit(new Pulse(2, player) {
@Override
public boolean pulse() {
@@ -21,6 +21,7 @@ import core.tools.RandomFunction;
import org.jetbrains.annotations.NotNull;
import core.game.node.entity.combat.CombatSwingHandler;
import core.game.world.GameWorld;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.*;
@@ -75,13 +76,13 @@ public final class DMCHandler implements LogoutListener {
}
player.getPacketDispatch().sendSceneryAnimation(cannon, Animation.create(direction.getAnimationId()));
Location l = cannon.getLocation().transform(1, 1, 0);
player.getAudioManager().send(new Audio(2877), true, l);
playGlobalAudio(l, Sounds.MCANNON_TURN_2877);
direction = DMCRevolution.values()[(direction.ordinal() + 1) % DMCRevolution.values().length];
for (NPC npc : RegionManager.getLocalNpcs(l, 10)) {
if (direction.isInSight(npc.getLocation().getX() - l.getX(), npc.getLocation().getY() - l.getY()) && npc.isAttackable(player, CombatStyle.RANGE, false) && CombatSwingHandler.isProjectileClipped(npc, l, false)) {
int speed = (int) (25 + (l.getDistance(npc.getLocation()) * 10));
Projectile.create(l, npc.getLocation(), 53, 40, 36, 20, speed, 0, 128).send();
player.getAudioManager().send(new Audio(1667), true, l);
playGlobalAudio(l, Sounds.MCANNON_FIRE_1667);
cannonballs--;
int hit = 0;
if (player.getSwingHandler(false).isAccurateImpact(player, npc, CombatStyle.RANGE, 1.2, 1.0)) {
@@ -197,7 +198,7 @@ public final class DMCHandler implements LogoutListener {
registerTimer (player, handler.timer);
return true;
}
player.getAudioManager().send(new Audio(2876), true);
playGlobalAudio(player.getLocation(), Sounds.MCANNON_SETUP_2876);
if(count != 0) {
SceneryBuilder.remove(object);
SceneryBuilder.add(object = object.transform(object.getId() + 1));
@@ -10,7 +10,9 @@ import core.game.world.update.flag.context.Graphics
import core.plugin.Initializable
import org.rs09.consts.NPCs
import content.global.travel.EssenceTeleport
import core.api.playAudio
import core.game.world.GameWorld
import org.rs09.consts.Sounds
@Initializable
class CrompertyDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) {
@@ -102,7 +104,7 @@ class CrompertyDialogue(player: Player? = null) : core.game.dialogue.DialoguePlu
npc.faceTemporary(player, 1)
npc.graphics(Graphics(108))
player.lock()
player.audioManager.send(125)
playAudio(player, Sounds.CURSE_ALL_125, 0, 1)
Projectile.create(npc, player, 109).send()
npc.sendChat("Dipsolum sententa sententi!")
GameWorld.Pulser.submit(object : Pulse(1) {
@@ -32,6 +32,8 @@ import core.plugin.Initializable;
import core.tools.RandomFunction;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Handles the strong hold of security.
* @author Vexia
@@ -131,7 +133,7 @@ public final class StrongHoldSecurityPlugin extends MapZone implements Plugin<Ob
if (player.getSavedData().getGlobalData().hasStrongholdReward(1)) {
player.getDialogueInterpreter().open(70099, "You have already claimed your reward from this level.");
} else {
player.getAudioManager().send(Sounds.DOOR_CREAK_61);
playAudio(player, Sounds.DOOR_CREAK_61);
PacketRepository.send(MusicPacket.class, new MusicContext(player, 157, true));
player.getDialogueInterpreter().open(54678);
}
@@ -140,7 +142,7 @@ public final class StrongHoldSecurityPlugin extends MapZone implements Plugin<Ob
if (player.getSavedData().getGlobalData().hasStrongholdReward(3)) {
player.getDialogueInterpreter().open(70099, "You have already claimed your reward from this level.");
} else {
player.getAudioManager().send(Sounds.DOOR_CREAK_61);
playAudio(player, Sounds.DOOR_CREAK_61);
PacketRepository.send(MusicPacket.class, new MusicContext(player, 177, true));
player.getDialogueInterpreter().open(96878);
}
@@ -149,7 +151,7 @@ public final class StrongHoldSecurityPlugin extends MapZone implements Plugin<Ob
if (player.getSavedData().getGlobalData().hasStrongholdReward(2)) {
player.getDialogueInterpreter().open(70099, "You have already claimed your reward from this level.");
} else {
player.getAudioManager().send(Sounds.DOOR_CREAK_61);
playAudio(player, Sounds.DOOR_CREAK_61);
PacketRepository.send(MusicPacket.class, new MusicContext(player, 179, true));
player.getDialogueInterpreter().open(56875);
}
@@ -158,7 +160,7 @@ public final class StrongHoldSecurityPlugin extends MapZone implements Plugin<Ob
if (!player.getSavedData().getGlobalData().hasStrongholdReward(4)) {
PacketRepository.send(MusicPacket.class, new MusicContext(player, 158, true));
}
player.getAudioManager().send(Sounds.SOS_CHOIR_1246);
playAudio(player, Sounds.SOS_CHOIR_1246);
player.getDialogueInterpreter().open(96873);
return true;
case 16152:// skeleton
@@ -237,7 +239,7 @@ public final class StrongHoldSecurityPlugin extends MapZone implements Plugin<Ob
private static void openDoor(final Player player, final Scenery object) {
player.lock(3);
player.animate(Animation.create(4282));
player.getAudioManager().send(Sounds.SOS_THROUGH_DOOR_2858);
playAudio(player, Sounds.SOS_THROUGH_DOOR_2858);
GameWorld.getPulser().submit(new Pulse(1, player) {
int counter;
@@ -33,9 +33,9 @@ import core.game.world.update.flag.context.Animation;
import core.plugin.Plugin;
import core.plugin.ClassScanner;
import core.tools.RandomFunction;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.teleport;
import static core.api.ContentAPIKt.hasRequirement;
import static core.api.ContentAPIKt.*;
/**
* Handles the animal magnetism plugin.
@@ -132,7 +132,7 @@ public final class AnimalMagnetismPlugin extends OptionHandler {
if(teleport(player,Location.create(3658, 3517, 0), TeleportType.ECTOPHIAL)) {
player.getInventory().replace(new Item(4252), item.getSlot());
player.sendMessage("...and the world changes around you.", 4);
player.getAudioManager().send(4580);
playAudio(player, 4580);
player.sendMessage("You empty the ectoplasm onto the ground around your feet...");
player.getPulseManager().run(new Pulse(9, player) {
@Override
@@ -140,7 +140,7 @@ public final class AnimalMagnetismPlugin extends OptionHandler {
player.faceLocation(new Location(3659, 3519, 0));
if (player.getInventory().containsItem(new Item(4252))) {
player.animate(Animation.create(1652));
player.getAudioManager().send(1132);
playAudio(player, Sounds.FILL_ECTOPLASM_1132);
player.getInventory().remove(new Item(4252));
player.getInventory().add(item);
player.sendMessage("You refill the ectophial from the Ectofuntus.");
@@ -7,6 +7,9 @@ import core.game.node.item.Item;
import core.game.system.task.Pulse;
import core.game.world.update.flag.context.Animation;
import core.plugin.Plugin;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Handles the ectoplasm filling.
@@ -38,7 +41,7 @@ public class EctoplasmFillPlugin extends UseWithHandler {
public boolean handle(NodeUsageEvent event) {
final Player player = event.getPlayer();
player.animate(Animation.create(4471));
player.getAudioManager().send(1132);
playAudio(player, Sounds.FILL_ECTOPLASM_1132);
player.getPacketDispatch().sendMessage("You fill the bucket with ectoplasm.");
player.getPulseManager().run(new Pulse(3, player) {
@Override
@@ -47,7 +50,7 @@ public class EctoplasmFillPlugin extends UseWithHandler {
player.getInventory().add(new Item(4286));
if (player.getInventory().contains(1925, 1)) {
player.animate(Animation.create(4471), 1);
player.getAudioManager().send(1132);
playAudio(player, Sounds.FILL_ECTOPLASM_1132);
return false;
}
}
@@ -11,6 +11,7 @@ import core.game.world.update.flag.context.Graphics
import core.tools.RandomFunction
import org.rs09.consts.Items
import content.region.morytania.handlers.MortMyreGhastNPC
import org.rs09.consts.Sounds
object NSUtils {
fun flagFungusPlaced(player: Player) {
@@ -122,7 +123,7 @@ object NSUtils {
*/
private fun handleVisuals(player: Player) {
player.skills.decrementPrayerPoints(RandomFunction.random(1, 3).toDouble())
player.audioManager.send(1493)
playAudio(player, Sounds.CAST_BLOOM_1493)
val AROUND_YOU = player.location.surroundingTiles
for (location in AROUND_YOU) {
// The graphic is meant to play on a 3x3 radius around you, but not
@@ -8,7 +8,6 @@ import core.game.node.entity.combat.equipment.SwitchAttack;
import core.game.node.entity.impl.Projectile;
import core.game.node.entity.npc.AbstractNPC;
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.map.Location;
import core.game.world.update.flag.context.Animation;
@@ -17,8 +16,9 @@ import core.plugin.Initializable;
import core.tools.RandomFunction;
import core.game.node.entity.combat.CombatSwingHandler;
import core.game.node.entity.combat.MultiSwingHandler;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.getPathableRandomLocalCoordinate;
import static core.api.ContentAPIKt.*;
/**
* Handles the chaos elemental npc.
@@ -138,14 +138,14 @@ public class ChaosElementalNPC extends AbstractNPC {
return;
}
if (attack.getProjectile().getProjectileId() == 557) {
player.getAudioManager().send(new Audio(350), true); // C. Elemental Discord Impact SFX
playGlobalAudio(player.getLocation(), Sounds.CHAOS_ELEMENTAL_HIT_351); // C. Elemental Discord Impact SFX
}
else if (attack.getProjectile().getProjectileId() == 554) {
player.getAudioManager().send(new Audio(346), true); // C. Elemental Confusion Impact SFX
playAudio(player, Sounds.CHAOS_ELEMENTAL_CONFUSION_IMPACT_346); // C. Elemental Confusion Impact SFX
Location loc = getPathableRandomLocalCoordinate(player, 10, entity.getLocation(), 3);
player.teleport(loc);
} else if (attack.getProjectile().getProjectileId() == 551) {
player.getAudioManager().send(new Audio(353), true); // C. Elemental Madness Impact SFX
playGlobalAudio(player.getLocation(), Sounds.CHAOS_ELEMENTAL_MADNESS_IMPACT_353); // C. Elemental Madness Impact SFX
if (player.getInventory().freeSlots() < 1 || player.getEquipment().itemCount() < 1) {
return;
}
@@ -12,6 +12,9 @@ import core.game.node.scenery.Scenery;
import core.game.world.map.Location;
import core.game.world.update.flag.context.Animation;
import core.plugin.Plugin;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Represents the wilderness interface plugin.
@@ -67,7 +70,7 @@ public final class WildernessInterfacePlugin extends ComponentPlugin {
ForceMovement.run(player, Location.create(l.getX() - 1, y, 0), Location.create(l.getX() + 2, y, 0), ANIMATION, 20).setEndAnimation(null);
}
}
player.getAudioManager().send(new Audio(2462, 10, 30));
playAudio(player, Sounds.JUMP2_2462, 30);
/*if (GameWorld.getSettings().isPvp()) {
ActivityManager.register(new BountyHunterActivity(CraterType.MID_LEVEL));
ActivityManager.register(new BountyHunterActivity(CraterType.HIGH_LEVEL));
@@ -92,7 +95,7 @@ public final class WildernessInterfacePlugin extends ComponentPlugin {
ForceMovement.run(player, Location.create(l.getX() - 1, y, 0), Location.create(l.getX() + 2, y, 0), ANIMATION, 20).setEndAnimation(null);
}
}
player.getAudioManager().send(new Audio(2462, 10, 30));
playAudio(player, Sounds.JUMP2_2462, 30);
/*if (GameWorld.getSettings().isPvp()) {
ActivityManager.register(new BountyHunterActivity(CraterType.MID_LEVEL));
ActivityManager.register(new BountyHunterActivity(CraterType.HIGH_LEVEL));
@@ -16,6 +16,9 @@ import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
import core.tools.RandomFunction;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
/**
* Represents the wilderness obelisk plugin.
@@ -77,7 +80,7 @@ public final class WildernessObeliskPlugin extends OptionHandler {
break;
}
}
player.getAudioManager().send(204);
playAudio(player, Sounds.WILDERNESS_TELEPORT_204);
GameWorld.getPulser().submit(new Pulse(6, player) {
@Override
public boolean pulse() {
@@ -12,6 +12,7 @@ import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.game.node.entity.combat.MultiSwingHandler;
import core.game.world.GameWorld;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.*;
@@ -44,7 +45,7 @@ public class RevenantCombatHandler extends MultiSwingHandler {
SwitchAttack attack = getCurrent();
if (attack != null) {
if (attack.getStyle() == CombatStyle.RANGE) {
victim.asPlayer().getAudioManager().send(4061, true);
playGlobalAudio(victim.getLocation(), 4061, 0, 1, 10);
}
}
}
@@ -59,14 +60,14 @@ public class RevenantCombatHandler extends MultiSwingHandler {
if (attack.getStyle() == CombatStyle.RANGE && !hasTimerActive(victim, "frozen") && !hasTimerActive(victim, "frozen:immunity")) {
registerTimer(victim, spawnTimer("frozen", 16, true));
sendMessage((Player) victim, "The icy darts freeze your muscles!");
victim.asPlayer().getAudioManager().send(4059, true);
playGlobalAudio(victim.getLocation(), 4059, 0, 1, 10);
} else if (attack.getStyle() == CombatStyle.MAGIC) {
int ticks = 500;
if (victim.asPlayer().getPrayer().get(PrayerType.PROTECT_FROM_MAGIC)) {
ticks /= 2;
}
if (hasTimerActive(victim, "teleblock")) {
victim.asPlayer().getAudioManager().send(4064, true);
playGlobalAudio(victim.getLocation(), 4064, 0, 1, 10);
} else {
registerTimer (victim, spawnTimer("teleblock", ticks));
}
@@ -86,9 +87,9 @@ public class RevenantCombatHandler extends MultiSwingHandler {
SwitchAttack attack = getCurrent();
if (attack != null) {
if (attack.getStyle() == CombatStyle.MAGIC) {
victim.asPlayer().getAudioManager().send(202, true);
playGlobalAudio(entity.getLocation(), Sounds.TELEPORTBLOCK_CAST_202, 0, 1, 10);
} else if (attack.getStyle() == CombatStyle.RANGE) {
victim.asPlayer().getAudioManager().send(4062, true);
playGlobalAudio(entity.getLocation(), 4062, 0, 1, 10);
}
}
}
@@ -19,6 +19,10 @@ import core.tools.RandomFunction;
import core.game.node.entity.combat.CombatSwingHandler;
import core.game.system.config.NPCConfigParser;
import core.game.world.GameWorld;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
import static core.api.ContentAPIKt.playGlobalAudio;
/**
* Handles a revenant NPC.
@@ -105,9 +109,7 @@ public class RevenantNPC extends AbstractNPC {
@Override
public void finalizeDeath(Entity killer) {
super.finalizeDeath(killer);
if (killer instanceof Player) {
killer.asPlayer().getAudioManager().send(4063, true);
}
playGlobalAudio(killer.getLocation(),4063);
}
@Override
@@ -121,7 +123,7 @@ public class RevenantNPC extends AbstractNPC {
getProperties().getCombatPulse().delayNextAttack(3);
getSkills().heal(10);
for (Player p : RegionManager.getLocalPlayers(this)) {
p.getAudioManager().send(2393);
playAudio(p, Sounds.EAT_2393);
}
setAttribute("eat-delay", GameWorld.getTicks() + 6);
}
+7 -7
View File
@@ -810,30 +810,30 @@ fun <T> animate(entity: Entity, anim: T, forced: Boolean = false) {
/**
* Plays audio for the player
* @param player the player to play the defined audio for
* @param audio the audio id to play
* @param id the audio id to play
* @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 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, 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))
fun playAudio(player: Player, id: Int, delay: Int = 0, loops: Int = 1, location: Location? = null, radius: Int = Audio.defaultAudioRadius) {
PacketRepository.send(AudioPacket::class.java, DefaultContext(player, Audio(id, delay, loops, 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 id the audio id to play
* @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, delay: Int = 0, loops: Int = 1, radius: Int = 8) {
fun playGlobalAudio(location: Location, id: Int, delay: Int = 0, loops: Int = 1, radius: Int = Audio.defaultAudioRadius) {
val nearbyPlayers = RegionManager.getLocalPlayers(location, radius)
for (player in nearbyPlayers) {
PacketRepository.send(AudioPacket::class.java, DefaultContext(player, Audio(audio, loops, delay, radius), location))
PacketRepository.send(AudioPacket::class.java, DefaultContext(player, Audio(id, delay, loops, radius), location))
}
}
@@ -2803,7 +2803,7 @@ fun stun(entity: Entity, ticks: Int) {
entity.clocks[Clocks.STUN] = getWorldTicks() + ticks
entity.graphics(Graphics(80, 96))
if (entity is Player) {
entity.audioManager.send(Audio(2727, 1, 0))
playAudio(entity.asPlayer(), Sounds.STUNNED_2727)
entity.animate(Animation(424, Animator.Priority.VERY_HIGH))
sendMessage(entity, "You have been stunned!")
}
@@ -1,13 +1,12 @@
package core.game.consumable;
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;
public class Drink extends Consumable {
import static core.api.ContentAPIKt.playAudio;
public static final Audio SOUND = new Audio(4580, 1, 1);
public class Drink extends Consumable {
public Drink(int[] ids, ConsumableEffect effect, String... messages) {
super(ids, effect, messages);
@@ -26,7 +25,7 @@ public class Drink extends Consumable {
@Override
protected void executeConsumptionActions(Player player) {
player.animate(animation);
player.getAudioManager().send(SOUND);
playAudio(player, 4580);
}
@Override
@@ -1,14 +1,14 @@
package core.game.consumable;
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.Sounds;
import static core.api.ContentAPIKt.playAudio;
public class Food extends Consumable {
public static final Audio SOUND = new Audio(2393, 1, 1);
public Food(final int[] ids, final ConsumableEffect effect, final String... messages) {
super(ids, effect, messages);
animation = new Animation(829);
@@ -30,6 +30,6 @@ public class Food extends Consumable {
}
private void playEatingSound(Player player) {
player.getAudioManager().send(SOUND);
playAudio(player, Sounds.EAT_2393);
}
}
@@ -1,10 +1,12 @@
package core.game.consumable;
import content.data.consumables.Consumables;
import content.region.kandarin.barcrawl.BarcrawlManager;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.audio.Audio;
import core.game.node.item.Item;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.playAudio;
public class Potion extends Drink {
@@ -40,7 +42,7 @@ public class Potion extends Drink {
@Override
protected void executeConsumptionActions(Player player) {
player.animate(animation);
player.getAudioManager().send(SOUND);
playAudio(player, Sounds.LIQUID_2401);
}
@Override
@@ -5,7 +5,6 @@ import core.api.*
import core.cache.def.impl.ItemDefinition
import core.game.node.entity.player.Player
import core.game.node.entity.player.info.PlayerDetails
import core.game.node.entity.player.link.audio.Audio
import core.game.system.command.Privilege
import core.game.system.config.ItemConfigParser
import core.game.system.task.Pulse
@@ -14,6 +13,7 @@ import core.game.world.repository.Repository
import core.tools.Log
import core.tools.SystemLogger
import core.tools.colorize
import org.rs09.consts.Sounds
import java.lang.Integer.max
import java.util.concurrent.LinkedBlockingDeque
@@ -279,7 +279,7 @@ class GrandExchange : StartupListener, Commands {
buyer.completedAmount += amount
if(seller.amountLeft < 1 && seller.player != null)
seller.player!!.audioManager.send(Audio(4042,1,1))
playAudio(seller.player!!, Sounds.GE_COLLECT_COINS_4042)
seller.addWithdrawItem(995, amount * if(sellerBias) buyer.offeredValue else seller.offeredValue)
buyer.addWithdrawItem(seller.itemID, amount)
@@ -2,7 +2,6 @@ package core.game.global.action;
import core.game.node.entity.Entity;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.audio.Audio;
import core.game.node.entity.player.link.diary.DiaryType;
import core.game.node.scenery.Constructed;
import core.game.node.scenery.Scenery;
@@ -18,6 +17,7 @@ import core.game.world.GameWorld;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.hasRequirement;
import static core.api.ContentAPIKt.playAudio;
import java.awt.*;
@@ -45,11 +45,11 @@ public final class DoorActionHandler {
if (object instanceof Constructed && (o = ((Constructed) object).getReplaced()) != null) {
DoorConfigLoader.Door d = DoorConfigLoader.Companion.forId(object.getId());
if (d != null && d.isMetal()) {
player.getAudioManager().send(Sounds.IRON_DOOR_CLOSE_70);
playAudio(player, Sounds.IRON_DOOR_CLOSE_70);
} else if (d != null && d.isFence()){
player.getAudioManager().send(Sounds.GATE_CLOSE_66);
playAudio(player, Sounds.GATE_CLOSE_66);
} else {
player.getAudioManager().send(60);
playAudio(player, 60);
}
SceneryBuilder.replace(object, o);
if (second instanceof Constructed && (o = ((Constructed) second).getReplaced()) != null) {
@@ -61,20 +61,20 @@ public final class DoorActionHandler {
if (object.getDefinition().hasAction("close")) {
if (second != null) {
player.getPacketDispatch().sendMessage("The doors appear to be stuck.");
player.getAudioManager().send(Sounds.DOOR_CREAK_61);
playAudio(player, Sounds.DOOR_CREAK_61);
return;
}
DoorConfigLoader.Door d = DoorConfigLoader.Companion.forId(object.getId());
if (d != null && d.isMetal()) {
player.getAudioManager().send(Sounds.IRON_DOOR_OPEN_71);
playAudio(player, Sounds.IRON_DOOR_OPEN_71);
} else if (d != null && d.isFence()){
player.getAudioManager().send(Sounds.GATE_OPEN_67);
playAudio(player, Sounds.GATE_OPEN_67);
} else {
player.getAudioManager().send(Sounds.DOOR_OPEN_62);
playAudio(player, Sounds.DOOR_OPEN_62);
}
if (d == null) {
player.getPacketDispatch().sendMessage("The door appears to be stuck.");
player.getAudioManager().send(Sounds.DOOR_CREAK_61);
playAudio(player, Sounds.DOOR_CREAK_61);
return;
}
int firstDir = (object.getRotation() + 3) % 4;
@@ -93,11 +93,11 @@ public final class DoorActionHandler {
return;
}
if (d.isMetal()) {
player.getAudioManager().send(Sounds.IRON_DOOR_OPEN_71);
playAudio(player, Sounds.IRON_DOOR_OPEN_71);
} else if (d.isFence()){
player.getAudioManager().send(Sounds.GATE_OPEN_67);
playAudio(player, Sounds.GATE_OPEN_67);
} else {
player.getAudioManager().send(Sounds.DOOR_OPEN_62);
playAudio(player, Sounds.DOOR_OPEN_62);
}
if (second != null) {
DoorConfigLoader.Door s = DoorConfigLoader.Companion.forId(second.getId());
@@ -124,14 +124,14 @@ public final class DoorActionHandler {
if (entity instanceof Player) {
DoorConfigLoader.Door d = DoorConfigLoader.Companion.forId(object.getId());
if (d != null && d.isMetal()) {
((Player) entity).getAudioManager().send(Sounds.IRON_DOOR_OPEN_71, 10);
((Player) entity).getAudioManager().send(Sounds.IRON_DOOR_CLOSE_70, 10, 60);
playAudio(entity.asPlayer(), Sounds.IRON_DOOR_OPEN_71);
playAudio(entity.asPlayer(), Sounds.IRON_DOOR_CLOSE_70, 60);
} else if (d != null && d.isFence()){
((Player) entity).getAudioManager().send(Sounds.GATE_OPEN_67, 10);
((Player) entity).getAudioManager().send(Sounds.GATE_CLOSE_66, 10, 60);
playAudio(entity.asPlayer(), Sounds.GATE_OPEN_67);
playAudio(entity.asPlayer(), Sounds.GATE_CLOSE_66, 60);
} else {
((Player) entity).getAudioManager().send(Sounds.DOOR_OPEN_62,10);
((Player) entity).getAudioManager().send(60,10,60);
playAudio(entity.asPlayer(), Sounds.DOOR_OPEN_62);
playAudio(entity.asPlayer(), 60, 60);
}
entity.asPlayer().logoutListeners.put("autowalk", player -> {
player.setLocation(loc);
@@ -5,6 +5,7 @@ import core.game.event.ItemUnequipEvent
import core.game.container.impl.EquipmentContainer
import content.global.handlers.item.equipment.brawling_gloves.BrawlingGlovesManager
import content.global.skill.slayer.SlayerEquipmentFlags
import core.api.playAudio
import core.game.node.Node
import core.game.node.entity.combat.equipment.WeaponInterface
import core.game.node.entity.player.Player
@@ -14,6 +15,7 @@ import core.game.interaction.InteractionListener
import core.game.interaction.IntType
import core.game.interaction.InteractionListeners
import core.game.system.config.ItemConfigParser
import org.rs09.consts.Sounds
/**
* Represents the equipment equipping handler plugin.
@@ -65,7 +67,7 @@ class EquipHandler : InteractionListener {
player.dialogueInterpreter.close()
/* TODO: Send different equip sound based on what is being equip.*/
player.audioManager.send(item.definition.getConfiguration(ItemConfigParser.EQUIP_AUDIO, 2244))
playAudio(player, item.definition.getConfiguration(ItemConfigParser.EQUIP_AUDIO, 2244))
if (player.properties.autocastSpell != null) {
val itemEquipmentSlot = item.definition.getConfiguration<Int>(ItemConfigParser.EQUIP_SLOT, -1)
@@ -125,7 +127,7 @@ class EquipHandler : InteractionListener {
}
if (player.equipment.remove(item)) {
/* TODO: Send different unequip sound based on what is being unequipped.*/
player.audioManager.send(Audio(2238, 10, 1))
playAudio(player, Sounds.EQUIP_FUN_2238)
player.dialogueInterpreter.close()
player.inventory.add(item)
@@ -4,8 +4,8 @@ import core.game.event.PickUpEvent
import core.api.getItemName
import content.data.GodType
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.audio.Audio
import content.global.skill.runecrafting.RunePouch
import core.api.playAudio
import core.game.node.entity.player.info.LogType
import core.game.node.item.GroundItem
import core.game.node.item.GroundItemManager
@@ -13,9 +13,9 @@ import core.game.node.item.Item
import core.game.world.map.RegionManager
import core.game.world.update.flag.context.Animation
import core.game.node.entity.player.info.PlayerMonitor
import core.tools.SystemLogger
import core.game.system.config.GroundSpawnLoader
import core.game.world.GameWorld
import org.rs09.consts.Sounds
/**
* A class used to handle the picking up of ground items.
@@ -66,7 +66,7 @@ object PickupHandler {
}
*/
player.audioManager.send(Audio(2582, 10, 1))
playAudio(player, Sounds.PICK2_2582)
player.dispatch(PickUpEvent(item.id))
}
return true
@@ -367,7 +367,7 @@ abstract class CombatSwingHandler(var type: CombatStyle?) {
} else if (entity is NPC && victim is Player) {
val npc = entity.asNpc()
val audio = npc.getAudio(0)
audio?.send(victim.asPlayer(), true, entity.location)
if (audio != null) playGlobalAudio(entity.location, audio.id)
}
}
@@ -53,7 +53,7 @@ public final class DeathTask extends NodeTask {
Player p = killer.asPlayer();
Audio audio = e.asNpc().getAudio(2);
if (audio != null) {
playGlobalAudio(e.getLocation(), audio.getId());
playGlobalAudio(e.getLocation(), audio.id);
}
}
}
@@ -229,10 +229,10 @@ public enum BoltEffect {
if (sound != null) {
Entity attacker = state.getAttacker();
if (attacker instanceof Player) {
sound.send(attacker.asPlayer(), true);
playGlobalAudio(attacker.getLocation(), sound.id);
}
if (victim instanceof Player) {
sound.send(victim.asPlayer(), true);
playGlobalAudio(victim.getLocation(), sound.id);
}
}
if (graphics != null) {
@@ -173,7 +173,7 @@ public abstract class CombatSpell extends MagicSpell {
entity.animate(animation);
}
}
playGlobalAudio(entity.getLocation(), audio.getId(), 20);
playGlobalAudio(entity.getLocation(), audio.id, 20);
}
@Override
@@ -160,7 +160,7 @@ public abstract class MagicSpell implements Plugin<SpellType> {
public void visualize(Entity entity, Node target) {
entity.graphics(graphic);
entity.animate(animation);
playGlobalAudio(entity.getLocation(), audio.getId(), 20);
playGlobalAudio(entity.getLocation(), audio.id, 20);
}
/**
@@ -628,7 +628,7 @@ public class NPC extends Entity {
int[] audios = getDefinition().getConfiguration(NPCConfigParser.COMBAT_AUDIO, null);
if (audios != null) {
Audio audio = new Audio(audios[index]);
if (audio != null && audio.getId() != 0) {
if (audio != null && audio.id != 0) {
return audio;
}
}
@@ -24,7 +24,6 @@ import core.game.node.entity.player.info.login.LoginConfiguration;
import core.game.node.entity.player.info.login.PlayerParser;
import core.game.node.entity.player.link.*;
import core.game.node.entity.player.link.appearance.Appearance;
import core.game.node.entity.player.link.audio.AudioManager;
import core.game.node.entity.player.link.diary.AchievementDiaryManager;
import core.game.node.entity.player.link.emote.EmoteManager;
import core.game.node.entity.player.link.music.MusicPlayer;
@@ -60,6 +59,7 @@ import core.tools.*;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import org.rs09.consts.Items;
import org.rs09.consts.Sounds;
import proto.management.ClanLeaveNotification;
import proto.management.PlayerStatusUpdate;
import core.GlobalStats;
@@ -90,8 +90,6 @@ import static core.api.ContentAPIKt.*;
import static core.game.system.command.sets.StatAttributeKeysKt.STATS_BASE;
import static core.game.system.command.sets.StatAttributeKeysKt.STATS_DEATHS;
import static core.tools.GlobalsKt.colorize;
import static core.game.world.map.zone.impl.WildernessZone.WILDERNESS_PROT_ATTR;
import static core.game.world.map.zone.impl.WildernessZone.WILDERNESS_HIGHER_NEXTFEE;
/**
* Represents a player entity.
@@ -267,11 +265,6 @@ public class Player extends Entity {
*/
private final HouseManager houseManager = new HouseManager();
/**
* The audio manager.
*/
private final AudioManager audioManager = new AudioManager(this);
/**
* The bank pin manager.
*/
@@ -448,12 +441,12 @@ public class Player extends Entity {
int time = getAttribute("fire:immune",0) - GameWorld.getTicks();
if(time == TickUtilsKt.secondsToTicks(30)){
sendMessage(colorize("%RYou have 30 seconds remaining on your antifire potion."));
getAudioManager().send(3120);
playAudio(this, Sounds.CLOCK_TICK_1_3120, 0, 3);
}
if(time == 0){
sendMessage(colorize("%RYour antifire potion has expired."));
removeAttribute("fire:immune");
getAudioManager().send(2607);
playAudio(this, Sounds.DRAGON_POTION_FINISHED_2607);
}
}
if(getAttribute("poison:immunity",0) > 0){
@@ -461,12 +454,12 @@ public class Player extends Entity {
debug(time + "");
if(time == TickUtilsKt.secondsToTicks(30)){
sendMessage(colorize("%RYou have 30 seconds remaining on your antipoison potion."));
getAudioManager().send(3120);
playAudio(this, Sounds.CLOCK_TICK_1_3120, 0, 3);
}
if(time == 0){
sendMessage(colorize("%RYour antipoison potion has expired."));
removeAttribute("poison:immunity");
getAudioManager().send(2607);
playAudio(this, Sounds.DRAGON_POTION_FINISHED_2607);
}
}
if(getAttribute("infinite-special", false)) {
@@ -1293,14 +1286,6 @@ public class Player extends Entity {
return houseManager;
}
/**
* Gets the audioManager.
* @return the audioManager
*/
public AudioManager getAudioManager() {
return audioManager;
}
/**
* Gets the bankPinManager.
* @return the bankPinManager
@@ -14,6 +14,7 @@ import core.net.packet.out.RepositionChild;
import core.net.packet.out.StringPacket;
import core.tools.RandomFunction;
import org.json.simple.JSONObject;
import org.rs09.consts.Sounds;
import java.util.ArrayList;
import java.util.Arrays;
@@ -148,7 +149,7 @@ public class BankPinManager {
player.getInterfaceManager().close();
tempPin = null;
sendMessages(messages);
player.getAudioManager().send(1040);
playAudio(player, Sounds.PIN_PENDING_1040);
player.getInterfaceManager().open(new Component(14));
}
@@ -268,7 +269,7 @@ public class BankPinManager {
for (int i = 60; i < 66; i++) {
player.getPacketDispatch().sendInterfaceConfig(14, i, show);
}
player.getAudioManager().send(1040);
playAudio(player, Sounds.PIN_PENDING_1040);
player.getPacketDispatch().sendInterfaceConfig(14, 89, !show);
player.getPacketDispatch().sendInterfaceConfig(14, 91, !show);
player.getPacketDispatch().sendInterfaceConfig(14, 87, !show);
@@ -341,13 +342,13 @@ public class BankPinManager {
public void handlePinStage(int stage) {
if (stage == 4) {
if (!hasPin() || changeState == 2) {
player.getAudioManager().send(1040);
playAudio(player, Sounds.PIN_PENDING_1040);
player.getPacketDispatch().sendString("Now please enter that number again!", 13, 28);
shuffleDigits();
return;
} else {
if (!tempPin.equals(pin)) {
player.getAudioManager().send(1042);
playAudio(player, Sounds.PIN_CANCEL_1042);
player.getInterfaceManager().close();
player.sendMessage("The PIN you entered is incorrect.");
if (setTries(getTries() + 1) >= 2) {
@@ -394,7 +395,7 @@ public class BankPinManager {
}
shuffleDigits();
if (stage != 0) {
player.getAudioManager().send(1041);
playAudio(player, Sounds.PIN_BEEP_1041);
}
}
@@ -475,7 +476,7 @@ public class BankPinManager {
pendingDelay = -1;
pin = null;
unlocked = false;
player.getAudioManager().send(1042);
playAudio(player, Sounds.PIN_CANCEL_1042);
openSettings(messages);
}
@@ -13,7 +13,7 @@ import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.hasTimerActive;
import static core.api.ContentAPIKt.*;
/**
* Handles the entity teleport.
@@ -203,18 +203,14 @@ public class TeleportManager {
@Override
public boolean pulse() {
if (delay == 0) {
if (entity instanceof Player) {
entity.asPlayer().getAudioManager().send(new Audio(200), true);
}
playGlobalAudio(entity.getLocation(), Sounds.TELEPORT_ALL_200);
entity.getAnimator().forceAnimation(new Animation(getSettings().getStartEmote()));
entity.graphics(new Graphics(getSettings().getStartGfx()));
} else if (delay == 3) {
entity.getProperties().setTeleportLocation(Location.create(location));
fireRandom(entity, location);
} else if (delay == 4) {
if (entity instanceof Player) {
entity.asPlayer().getAudioManager().send(new Audio(201), true);
}
playGlobalAudio(entity.getLocation(), Sounds. TELEPORT_REVERSE_201);
entity.getAnimator().forceAnimation(new Animation(getSettings().getEndEmote(), Priority.HIGH));
entity.graphics(new Graphics(getSettings().getEndGfx()));
return true;
@@ -241,10 +237,7 @@ public class TeleportManager {
@Override
public boolean pulse() {
if (delay == 0) {
if (entity instanceof Player) {
entity.asPlayer().getAudioManager().send(new Audio(Sounds.BLOCK_TELEPORT_197), true);
}
playGlobalAudio(entity.getLocation(), Sounds.BLOCK_TELEPORT_197, 0, 7);
entity.getAnimator().forceAnimation(new Animation(getSettings().getStartEmote()));
entity.graphics(new Graphics(getSettings().getStartGfx()));
} else if (delay == 4) {
@@ -311,9 +304,7 @@ public class TeleportManager {
@Override
public boolean pulse() {
if (delay == 0) {
if (entity instanceof Player) {
entity.asPlayer().getAudioManager().send(979);
}
playGlobalAudio(entity.getLocation(), Sounds.POH_TABLET_BREAK_979);
entity.getAnimator().forceAnimation(new Animation(4069));
} else if (delay == 2) {
entity.getAnimator().forceAnimation(new Animation(getSettings().getStartEmote(), Priority.HIGH));
@@ -354,7 +345,7 @@ public class TeleportManager {
player.getProperties().setTeleportLocation(location);
return true;
default:
entity.asPlayer().getAudioManager().send(getAudio(count));
playGlobalAudio(entity.getLocation(), getAudio(count));
player.getPacketDispatch().sendGraphic(HOME_GRAPHICS[count]);
player.getPacketDispatch().sendAnimation(HOME_ANIMATIONS[count]);
break;
@@ -424,9 +415,7 @@ public class TeleportManager {
@Override
public boolean pulse() {
if (delay == 0) {
if (entity instanceof Player) {
entity.asPlayer().getAudioManager().send(199);
}
playGlobalAudio(entity.getLocation(), Sounds.TELE_OTHER_CAST_199);
entity.getAnimator().forceAnimation(new Animation(getSettings().getStartEmote()));
entity.graphics(new Graphics(getSettings().getStartGfx()));
} else if (delay == 3) {
@@ -455,7 +444,7 @@ public class TeleportManager {
case 2:
entity.animate(Animation.create(3265));
if(entity instanceof Player) {
((Player) entity).getAudioManager().send(1098, 1);
playAudio(entity.asPlayer(), Sounds.FT_FAIRY_TELEPORT_1098);
}
break;
case 4:
@@ -503,18 +492,14 @@ public class TeleportManager {
@Override
public boolean pulse() {
if (delay == 0) {
if (entity instanceof Player) {
entity.asPlayer().getAudioManager().send(200);
}
playGlobalAudio(entity.getLocation(), Sounds.TELEPORT_ALL_200);
entity.getAnimator().forceAnimation(new Animation(getSettings().getStartEmote()));
entity.graphics(new Graphics(getSettings().getStartGfx()));
} else if (delay == 3) {
entity.getProperties().setTeleportLocation(Location.create(location));
fireRandom(entity, location);
} else if (delay == 4) {
if (entity instanceof Player) {
entity.asPlayer().getAudioManager().send(201);
}
playGlobalAudio(entity.getLocation(), Sounds.TELEPORT_REVERSE_201);
entity.getAnimator().forceAnimation(new Animation(getSettings().getEndEmote(), Priority.HIGH));
entity.graphics(new Graphics(getSettings().getEndGfx()));
return true;
@@ -541,18 +526,14 @@ public class TeleportManager {
@Override
public boolean pulse() {
if (delay == 0) {
if (entity instanceof Player) {
entity.asPlayer().getAudioManager().send(200);
}
playGlobalAudio(entity.getLocation(), Sounds.TELEPORT_ALL_200);
entity.getAnimator().forceAnimation(new Animation(getSettings().getStartEmote()));
entity.graphics(new Graphics(getSettings().getStartGfx()));
} else if (delay == 3) {
entity.getProperties().setTeleportLocation(Location.create(location));
fireRandom(entity, location);
} else if (delay == 4) {
if (entity instanceof Player) {
entity.asPlayer().getAudioManager().send(201);
}
playGlobalAudio(entity.getLocation(), Sounds.TELEPORT_REVERSE_201);
entity.getAnimator().forceAnimation(new Animation(getSettings().getEndEmote(), Priority.HIGH));
entity.graphics(new Graphics(getSettings().getEndGfx()));
return true;
@@ -580,7 +561,7 @@ public class TeleportManager {
public boolean pulse() {
if (delay == 0) {
if (entity instanceof Player) {
entity.asPlayer().getAudioManager().send(5036);
playAudio(entity.asPlayer(), 5036);
}
entity.getAnimator().forceAnimation(new Animation(getSettings().getStartEmote()));
entity.graphics(new Graphics(getSettings().getStartGfx()));
@@ -588,7 +569,7 @@ public class TeleportManager {
entity.getProperties().setTeleportLocation(Location.create(location));
fireRandom(entity, location);
if (entity instanceof Player) {
entity.asPlayer().getAudioManager().send(5034);
playAudio(entity.asPlayer(), 5034);
}
entity.getAnimator().forceAnimation(new Animation(getSettings().getEndEmote(), Priority.HIGH));
entity.graphics(new Graphics(getSettings().getEndGfx()));
@@ -616,18 +597,14 @@ public class TeleportManager {
@Override
public boolean pulse() {
if (delay == 0) {
if (entity instanceof Player) {
entity.asPlayer().getAudioManager().send(200);
}
playGlobalAudio(entity.getLocation(), Sounds.TELEPORT_ALL_200);
entity.getAnimator().forceAnimation(new Animation(getSettings().getStartEmote()));
entity.graphics(new Graphics(getSettings().getStartGfx()));
} else if (delay == 3) {
entity.getProperties().setTeleportLocation(Location.create(location));
fireRandom(entity, location);
} else if (delay == 4) {
if (entity instanceof Player) {
entity.asPlayer().getAudioManager().send(201);
}
playGlobalAudio(entity.getLocation(), Sounds.TELEPORT_REVERSE_201);
entity.getAnimator().forceAnimation(new Animation(getSettings().getEndEmote(), Priority.HIGH));
entity.graphics(new Graphics(getSettings().getEndGfx()));
return true;
@@ -1,155 +0,0 @@
package core.game.node.entity.player.link.audio;
import core.game.node.entity.player.Player;
import core.game.world.map.Location;
import java.util.List;
/**
* An audio piece to play.
* @author Vexia
*/
public class Audio {
/**
* The default volume.
*/
public static final int VOLUME = 10;
/**
* The default delay.
*/
public static final int DELAY = 0;
/**
* The default radius in tiles of positional audio in [0,16).
*/
public static final int RADIUS = 8;
/**
* The id of the audio piece.
*/
private final int id;
/**
* The volume.
*/
private final int volume;
/**
* The delay.
*/
private final int delay;
/**
* The radius.
*/
private final int radius;
/**
* Constructs a new {@Code Audio} {@Code Object}
* @param id the id.
* @param volume the volume.
* @param delay the delay.
* @param radius the radius.
*/
public Audio(int id, int volume, int delay, int radius) {
this.id = id;
this.volume = volume;
this.delay = delay;
this.radius = radius;
}
/**
* Constructs a new {@Code Audio} {@Code Object}
* @param id the id.
* @param volume the volume.
* @param delay the delay.
*/
public Audio(int id, int volume, int delay) {
this(id, volume, delay, RADIUS);
}
/**
* Constructs a new {@Code Audio} {@Code Object}
* @param id the id.
* @param volume the volume.
*/
public Audio(int id, int volume) {
this(id, volume, DELAY);
}
/**
* Constructs a new {@Code Audio} {@Code Object}
* @param id the id.
*/
public Audio(int id) {
this(id, VOLUME, 0);
}
/**
* Sends an audio through the manager.
* @param player the player.
* @param global the global.
*/
public void send(Player player, boolean global) {
send(player, global, null);
}
public void send(Player player, boolean global, Location loc) {
player.getAudioManager().send(this, global, loc);
}
/**
* Sends this audio.
* @param player the player.
*/
public void send(Player player) {
send(player, false);
}
/**
* Sends the sound to a list of players.
* @param players the players.
*/
public void send(List<Player> players) {
for (Player p : players) {
if (p == null) {
continue;
}
send(p, false);
}
}
/**
* Gets the id.
* @return the id
*/
public int getId() {
return id;
}
/**
* Gets the volume.
* @return the volume
*/
public int getVolume() {
return volume;
}
/**
* Gets the delay.
* @return the delay
*/
public int getDelay() {
return delay;
}
/**
* Gets the radius.
* @return the radius
*/
public int getRadius() {
return radius;
}
}

Some files were not shown because too many files have changed in this diff Show More