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:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package core.game.node.entity.player.link.audio
|
||||
|
||||
/**
|
||||
* An audio object to play.
|
||||
* @author Zerken
|
||||
*/
|
||||
class Audio
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
@JvmField
|
||||
val id: Int,
|
||||
@JvmField
|
||||
val delay: Int = 0,
|
||||
@JvmField
|
||||
val loops: Int = 1,
|
||||
@JvmField
|
||||
val radius: Int = defaultAudioRadius
|
||||
) {
|
||||
companion object {
|
||||
/**
|
||||
* ----Audio Radius Constants----
|
||||
* Values which represent the tile distance/radius from which certain groups of audio can be heard from
|
||||
* Certain sounds can be heard from a further distance than others
|
||||
* This is a common place where audio distances can be adjusted if needed
|
||||
*/
|
||||
// TODO: Add specific groups of audios to have the correct radius (some sounds should be heard from a farther radius than others)
|
||||
const val defaultAudioRadius = 8
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
package core.game.node.entity.player.link.audio;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.map.RegionManager;
|
||||
import core.net.packet.PacketRepository;
|
||||
import core.net.packet.context.DefaultContext;
|
||||
import core.net.packet.out.AudioPacket;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Manages audio for a player.
|
||||
* @author Vexia
|
||||
*/
|
||||
public class AudioManager {
|
||||
|
||||
/**
|
||||
* The player instance.
|
||||
*/
|
||||
private final Player player;
|
||||
|
||||
/**
|
||||
* Constructs a new {@Code AudioManager} {@Code Object}
|
||||
* @param player the player.
|
||||
*/
|
||||
public AudioManager(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an audio packet.
|
||||
* @param audioId the audio id.
|
||||
*/
|
||||
public void send(int audioId) {
|
||||
send(audioId, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an audio.
|
||||
* @param audioId the audio id.
|
||||
* @param global the global.
|
||||
*/
|
||||
public void send(int audioId, boolean global) {
|
||||
send(new Audio(audioId), global);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an audio packet.
|
||||
* @param audioId the audio id.
|
||||
* @param volume the volume.
|
||||
*/
|
||||
public void send(int audioId, int volume) {
|
||||
send(new Audio(audioId, volume), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an audio packet.
|
||||
* @param audioId the audio id.
|
||||
* @param volume the volume.
|
||||
* @param delay the delay.
|
||||
*/
|
||||
public void send(int audioId, int volume, int delay) {
|
||||
send(new Audio(audioId, volume, delay), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an audio packet.
|
||||
* @param audioId the audio id.
|
||||
* @param volume the volume.
|
||||
* @param delay the delay.
|
||||
* @param radius the distance the sound can be heard.
|
||||
* @param loc the location.
|
||||
*/
|
||||
public void send(int audioId, int volume, int delay, int radius, Location loc) {
|
||||
send(new Audio(audioId, volume, delay, radius), false, loc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an audio packet.
|
||||
* @param audio the audio.
|
||||
*/
|
||||
public void send(Audio audio) {
|
||||
send(audio, false);
|
||||
}
|
||||
|
||||
public void send(Audio audio, boolean global) {
|
||||
send(audio, global, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an audio packet.
|
||||
* @param audio the audio.
|
||||
* @param global if the audio can be heard globally by other players.
|
||||
* @param loc the location where the audio will play from. If location = null the players location is used.
|
||||
*/
|
||||
public void send(Audio audio, boolean global, Location loc) {
|
||||
if (global) {
|
||||
List<Player> players = RegionManager.getLocalPlayers(loc != null ? loc : player.getLocation(), audio.getRadius());
|
||||
for (Player p : players) {
|
||||
if (p == null) {
|
||||
continue;
|
||||
}
|
||||
PacketRepository.send(AudioPacket.class, new DefaultContext(p, audio, loc));
|
||||
}
|
||||
} else PacketRepository.send(AudioPacket.class, new DefaultContext(player, audio, loc));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an audio packet for a bunch of players.
|
||||
* @param audio the audio.
|
||||
* @param players the players.
|
||||
*/
|
||||
public void send(Audio audio, List<Player> players, Location loc) {
|
||||
for (Player p : players) {
|
||||
if (p == null) {
|
||||
continue;
|
||||
}
|
||||
p.getAudioManager().send(audio, false, loc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the player.
|
||||
* @return the player
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,12 +15,12 @@ import core.game.world.map.RegionManager;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
import core.tools.RandomFunction;
|
||||
import core.game.world.GameWorld;
|
||||
import org.rs09.consts.Sounds;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static core.api.ContentAPIKt.setVarp;
|
||||
import static core.api.ContentAPIKt.setVarbit;
|
||||
import static core.api.ContentAPIKt.*;
|
||||
|
||||
/**
|
||||
* Represents a managing class of a players prayers.
|
||||
@@ -82,7 +82,7 @@ public final class Prayer {
|
||||
* Starts the redemption effect.
|
||||
*/
|
||||
public void startRedemption() {
|
||||
player.getAudioManager().send(2681);
|
||||
playAudio(player, Sounds.REDEMPTION_HEAL_2681);
|
||||
player.graphics(Graphics.create(436));
|
||||
player.getSkills().heal((int) (player.getSkills().getStaticLevel(Skills.PRAYER) * 0.25));
|
||||
player.getSkills().setPrayerPoints(0.0);
|
||||
@@ -102,7 +102,7 @@ public final class Prayer {
|
||||
}
|
||||
}
|
||||
}
|
||||
player.getAudioManager().send(159);
|
||||
playAudio(player, Sounds.FIREBREATH_159);
|
||||
player.graphics(Graphics.create(437));
|
||||
int maximum = (int) (player.getSkills().getStaticLevel(Skills.PRAYER) * 0.25) - 1;
|
||||
if (killer != player && killer.getLocation().withinDistance(player.getLocation(), 1)) {
|
||||
@@ -131,7 +131,7 @@ public final class Prayer {
|
||||
|
||||
if(prayerActiveTicks > 0 && prayerActiveTicks % 2 == 0){
|
||||
if(getPlayer().getSkills().getPrayerPoints() == 0){
|
||||
getPlayer().getAudioManager().send(2672);
|
||||
playAudio(getPlayer(), Sounds.PRAYER_DRAIN_2672);
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ public enum PrayerType {
|
||||
*/
|
||||
public boolean permitted(final Player player) {
|
||||
if (player.getSkills().getStaticLevel(Skills.PRAYER) < getLevel() || player.getSkills().getStaticLevel(Skills.DEFENCE) < defenceReq) {
|
||||
player.getAudioManager().send(2673);
|
||||
playAudio(player, Sounds.PRAYER_OFF_2673);
|
||||
player.getDialogueInterpreter().sendDialogue("You need a <col=08088A>Prayer level of " + getLevel() + (player.getSkills().getStaticLevel(Skills.DEFENCE) < defenceReq ? (" and a Defence level of " + defenceReq) : "") + " to use " + StringUtils.formatDisplayName(name().toLowerCase().replace("_", " ")) + ".");
|
||||
return false;
|
||||
}
|
||||
@@ -240,7 +240,7 @@ public enum PrayerType {
|
||||
flag(player, this);
|
||||
player.getPrayer().getActive().add(this);
|
||||
iconify(player, getIcon(player, this));
|
||||
player.getAudioManager().send(getSound());
|
||||
playAudio(player, sound.id);
|
||||
|
||||
if (this == PrayerType.PIETY
|
||||
&& new ZoneBorders(2732, 3467, 2739, 3471, 0).insideBorder(player)) {
|
||||
@@ -249,7 +249,7 @@ public enum PrayerType {
|
||||
player.dispatch (new PrayerActivatedEvent(this));
|
||||
} else {
|
||||
player.getPrayer().getActive().remove(this);
|
||||
player.getAudioManager().send(Sounds.CANCEL_PRAYER_2663);
|
||||
playAudio(player, Sounds.CANCEL_PRAYER_2663);
|
||||
findNextIcon(player);
|
||||
player.dispatch (new PrayerDeactivatedEvent(this));
|
||||
}
|
||||
|
||||
@@ -154,8 +154,8 @@ public final class AssistSession extends Pulse implements RequestModule {
|
||||
player.animate(ANIMATION);
|
||||
player.graphics(GRAPHIC);
|
||||
partener.animate(ANIMATION);
|
||||
partener.getAudioManager().send(4010);
|
||||
player.getAudioManager().send(4010);
|
||||
playAudio(partener, 4010);
|
||||
playAudio(player, 4010);
|
||||
toggleIcon(player, false);
|
||||
toggleIcon(partener, false);
|
||||
GameWorld.getPulser().submit(this);
|
||||
|
||||
@@ -22,11 +22,13 @@ import core.game.world.GameWorld;
|
||||
import core.game.world.repository.Repository;
|
||||
import core.plugin.CorePluginTypes.XPGainPlugins;
|
||||
import org.rs09.consts.Items;
|
||||
import org.rs09.consts.Sounds;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static core.api.ContentAPIKt.getWorldTicks;
|
||||
import static core.api.ContentAPIKt.playAudio;
|
||||
import static java.lang.Math.floor;
|
||||
import static java.lang.Math.max;
|
||||
|
||||
@@ -362,7 +364,7 @@ public final class Skills {
|
||||
setLevel(i, staticLevel);
|
||||
}
|
||||
if (entity instanceof Player) {
|
||||
entity.asPlayer().getAudioManager().send(2674);
|
||||
playAudio(entity.asPlayer(), Sounds.PRAYER_RECHARGE_2674);
|
||||
}
|
||||
rechargePrayerPoints();
|
||||
}
|
||||
|
||||
@@ -416,10 +416,6 @@ class VisualCommand : CommandPlugin() {
|
||||
player!!.impactHandler.manualHit(player, toInteger(args!![1]!!), HitsplatType.NORMAL)
|
||||
return true
|
||||
}
|
||||
"sound" -> {
|
||||
player!!.audioManager.send(Audio(args!![1]!!.toInt(), 10, 1))
|
||||
return true
|
||||
}
|
||||
"noclip" -> {
|
||||
player!!.setAttribute("no_clip", !player.getAttribute("no_clip", false))
|
||||
return true
|
||||
|
||||
+31
@@ -1,7 +1,11 @@
|
||||
package core.game.system.command.sets
|
||||
|
||||
import core.api.playAudio
|
||||
import core.api.playGlobalAudio
|
||||
import core.game.node.entity.player.link.music.MusicEntry
|
||||
import core.game.system.command.Privilege
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.repository.Repository
|
||||
import core.net.packet.PacketRepository
|
||||
import core.net.packet.context.MusicContext
|
||||
import core.net.packet.out.MusicPacket
|
||||
@@ -64,5 +68,32 @@ class MusicCommandSet : CommandSet(Privilege.STANDARD){
|
||||
player.musicPlayer.unlock(me.id)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Command that lets you play an audio id
|
||||
*/
|
||||
define("audio", Privilege.ADMIN, "::audio id loops[optional]", "Plays audio by id") { player, args ->
|
||||
if (args.size < 2 || args.size > 3)
|
||||
reject(player, "Usage: ::audio id loops[optional]")
|
||||
val id = args[1].toInt()
|
||||
val loops = if (args.size > 2) args[2].toInt() else 1
|
||||
playAudio(player, id, 0, loops)
|
||||
}
|
||||
/**
|
||||
* Command that lets you play an audio id globally by playername or coords
|
||||
*/
|
||||
define("globalaudio", Privilege.ADMIN, "::globalaudio id radius[max 15] location[player name or x y z]", "Play global audio by id, radius, and location") { player, args ->
|
||||
if (args.size < 3)
|
||||
reject(player, "Usage: ::globalaudio id radius[max 15] location[player name or x y z]")
|
||||
val loc = when (args.size) {
|
||||
6 -> Location(args[3].toInt(),args[4].toInt(),args[5].toInt())
|
||||
4 -> Repository.getPlayerByName(args[3])?.location
|
||||
else -> null
|
||||
}
|
||||
if (loc == null)
|
||||
reject(player, "Invalid player name / location")
|
||||
val id = args[1].toInt()
|
||||
val radius = if (args[2].toInt() > 15) 15 else args[2].toInt()
|
||||
if (loc != null) playGlobalAudio(loc, id, 0, 1, radius)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,15 +15,15 @@ public class AudioPacket implements OutgoingPacket<DefaultContext> {
|
||||
public static IoBuffer write(IoBuffer buffer, Audio audio, Location loc) {
|
||||
if(loc == null) {
|
||||
buffer.put((byte) 172);
|
||||
buffer.putShort(audio.getId());
|
||||
buffer.put((byte) audio.getVolume());
|
||||
buffer.putShort(audio.getDelay());
|
||||
buffer.putShort(audio.id);
|
||||
buffer.put((byte) audio.loops);
|
||||
buffer.putShort(audio.delay);
|
||||
} else {
|
||||
buffer.put((byte) 97);
|
||||
buffer.put((byte) (loc.getChunkOffsetX() << 4 | loc.getChunkOffsetY()));
|
||||
buffer.putShort(audio.getId());
|
||||
buffer.put((byte) (audio.getRadius() << 4 | audio.getVolume() & 7));
|
||||
buffer.put((byte) audio.getDelay());
|
||||
buffer.putShort(audio.id);
|
||||
buffer.put((byte) (audio.radius << 4 | audio.loops & 7));
|
||||
buffer.put((byte) audio.delay);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user