mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-12 09:30:19 -07:00
Implemented a new playAudio function in ContentAPI.kt
Implemented a new Send function in AudioManager.java Implemented KBD lair teleport levers lever operating sound using the new playAudio function Implemented KBD lair teleport levers pulling animation
This commit is contained in:
parent
cef956722a
commit
e0f99de75b
3 changed files with 34 additions and 1 deletions
|
|
@ -12,8 +12,9 @@ import core.game.world.map.Location;
|
||||||
import core.game.world.update.flag.context.Animation;
|
import core.game.world.update.flag.context.Animation;
|
||||||
import core.plugin.Initializable;
|
import core.plugin.Initializable;
|
||||||
import core.plugin.Plugin;
|
import core.plugin.Plugin;
|
||||||
|
import org.rs09.consts.Sounds;
|
||||||
|
|
||||||
import static core.api.ContentAPIKt.hasRequirement;
|
import static core.api.ContentAPIKt.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a plugin used to handle wilderness nodes.
|
* Represents a plugin used to handle wilderness nodes.
|
||||||
|
|
@ -120,6 +121,8 @@ public final class WildernessPlugin extends OptionHandler {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case 1816:// kbd lever.
|
case 1816:// kbd lever.
|
||||||
if (player.getLocation().withinDistance(LOCATIONS[5])) {
|
if (player.getLocation().withinDistance(LOCATIONS[5])) {
|
||||||
|
animate(player, 2140, false);
|
||||||
|
playAudio(player, Sounds.LEVER_2400);
|
||||||
player.getPacketDispatch().sendMessage("You pull the lever...");
|
player.getPacketDispatch().sendMessage("You pull the lever...");
|
||||||
player.getTeleporter().send(LOCATIONS[4], TeleportType.NORMAL);
|
player.getTeleporter().send(LOCATIONS[4], TeleportType.NORMAL);
|
||||||
player.getPacketDispatch().sendMessage("... and teleport into the lair of the King Black Dragon!", 5);
|
player.getPacketDispatch().sendMessage("... and teleport into the lair of the King Black Dragon!", 5);
|
||||||
|
|
@ -127,6 +130,8 @@ public final class WildernessPlugin extends OptionHandler {
|
||||||
break;
|
break;
|
||||||
case 1817:
|
case 1817:
|
||||||
if (player.getLocation().withinDistance(LOCATIONS[4])) {
|
if (player.getLocation().withinDistance(LOCATIONS[4])) {
|
||||||
|
animate(player, 2140, false);
|
||||||
|
playAudio(player, Sounds.LEVER_2400);
|
||||||
player.getPacketDispatch().sendMessage("You pull the lever...");
|
player.getPacketDispatch().sendMessage("You pull the lever...");
|
||||||
player.getTeleporter().send(LOCATIONS[5], TeleportType.NORMAL);
|
player.getTeleporter().send(LOCATIONS[5], TeleportType.NORMAL);
|
||||||
player.getPacketDispatch().sendMessage("... and teleport out of the lair of the King Black Dragon!", 5);
|
player.getPacketDispatch().sendMessage("... and teleport out of the lair of the King Black Dragon!", 5);
|
||||||
|
|
|
||||||
|
|
@ -818,6 +818,21 @@ fun playAudio(player: Player, audio: Audio, global: Boolean = false) {
|
||||||
player.audioManager.send(audio, global)
|
player.audioManager.send(audio, global)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plays the given Audio for the given Entity
|
||||||
|
* @param player the player to play the audio for
|
||||||
|
* @param audio the audio to play
|
||||||
|
* @param volume the volume
|
||||||
|
* @param delay the delay
|
||||||
|
* @param global if other nearby entities should be able to hear it
|
||||||
|
* @param location the location where the audio will play
|
||||||
|
* @param radius the distance the audio can be heard from the given location
|
||||||
|
*/
|
||||||
|
@JvmOverloads
|
||||||
|
fun playAudio(player: Player, audio: Int, volume: Int = 10, delay: Int = 0, global: Boolean = false, location: Location? = null, radius: Int = 15) {
|
||||||
|
player.audioManager.send(audio, volume, delay, global, location, radius)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a dialogue with the given dialogue key or dialogue file, depending which is passed.
|
* Opens a dialogue with the given dialogue key or dialogue file, depending which is passed.
|
||||||
* @param player the player to open the dialogue for
|
* @param player the player to open the dialogue for
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,19 @@ public class AudioManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plays the given Audio for the given Entity.
|
||||||
|
* @param audioId the audio to play.
|
||||||
|
* @param volume the volume.
|
||||||
|
* @param delay the delay.
|
||||||
|
* @param global if other nearby entities should be able to hear it.
|
||||||
|
* @param location the location where the audio will play.
|
||||||
|
* @param radius the distance the audio can be heard from the given location.
|
||||||
|
*/
|
||||||
|
public void send(int audioId, int volume, int delay, boolean global, Location location, int radius) {
|
||||||
|
send(new Audio(audioId, volume, delay, radius), global, location);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the player.
|
* Gets the player.
|
||||||
* @return the player
|
* @return the player
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue