Implemented water filling sounds for filling water vessels from all water sources

Implemented specific bucket water filling sound when filling from a well
Implemented emptying sounds for emptying vessels
Implemented cow milking sound
Implemented sound when smelting at a furnace
Implemented sound when smelting cannonballs at a furnace
Implemented sound when glassblowing
Fixed herb cleaning sound
Fixed regular wood door opening and closing sounds
Implemented metal door/gate opening and closing sounds
Implemented fence opening and closing sounds
Added Camelot castle main gate in door_configs.json
Fixed Sinclair mansion main gate to be a metal type door in door_configs.json
Implemented drinking sound when drinking from a waterskin in the desert
Implemented desert magic carpet travel take off and landing sound
Implemented desert magic carpet travel jingle/music
Fence around Falador cow farm is now properly identified as a fence and opens correctly
Fence id 34780 is now properly identified as a fence in door_configs.json so it opens correctly
Fence id 8810 is now properly identified as a fence in door_configs.json so it opens correctly
Fence id 2050-2051 is now properly identified as a fence in door_configs.json so it opens correctly
Fence id 1553 now has the correct open id in door_configs.json so it opens correctly
Fixed music tracks Relleka(289), Saga(290), and Borderlands(291) so they now play in their correct locations
Implemented jingle/music for sailing/chartering a ship(Trader crewmembers)
Implemented jingle/music for sailing/chartering a ship from/to Port Sarim/Karamja
Implemented jingle/music for sailing/chartering a ship from/to Port Sarim/Entrana
Implemented jingle/music for sailing/chartering a ship from/to Relleka/Neitiznot
Implemented jingle/music for sailing/chartering a ship from/to Relleka/Jatizso
Implemented jingle/music for sailing/chartering a ship from/to Ardougne/Brimmhaven
Implemented jingle/music for sailing/chartering a ship from/to Port Sarim/Pest control
Fixed the music player to be more authentic. Now when songs end they will repeat instead of playing a random inauthentic song. The loop function now works correctly so the currently playing song will play endlessly without changing as the player moves.
Implemented playJingle function in contentAPI.kt
This commit is contained in:
Zerken
2023-06-21 14:57:01 +00:00
committed by Ryan
parent 1672646e87
commit cef956722a
23 changed files with 141 additions and 26 deletions
+22 -8
View File
@@ -193,7 +193,7 @@
}, },
{ {
"id": "1553", "id": "1553",
"replaceId": "1552", "replaceId": "1556",
"fence": "true", "fence": "true",
"metal": "false" "metal": "false"
}, },
@@ -332,13 +332,13 @@
{ {
"id": "2050", "id": "2050",
"replaceId": "15511", "replaceId": "15511",
"fence": "false", "fence": "true",
"metal": "false" "metal": "false"
}, },
{ {
"id": "2051", "id": "2051",
"replaceId": "15513", "replaceId": "15513",
"fence": "false", "fence": "true",
"metal": "false" "metal": "false"
}, },
{ {
@@ -1238,12 +1238,12 @@
{ {
"id": "7049", "id": "7049",
"replaceId": "7051", "replaceId": "7051",
"fence": "false", "fence": "true",
"metal": "false" "metal": "false"
}, },
{ {
"id": "7050", "id": "7050",
"replaceId": "23919", "replaceId": "7052",
"fence": "true", "fence": "true",
"metal": "false" "metal": "false"
}, },
@@ -1340,7 +1340,7 @@
{ {
"id": "8810", "id": "8810",
"replaceId": "8812", "replaceId": "8812",
"fence": "false", "fence": "true",
"metal": "false" "metal": "false"
}, },
{ {
@@ -2367,11 +2367,25 @@
"fence": "false", "fence": "false",
"metal": "true" "metal": "true"
}, },
{
"id": "26081",
"replaceId": "26083",
"fence": "false",
"metal": "true",
"autowalk": "true"
},
{
"id": "26082",
"replaceId": "26084",
"fence": "false",
"metal": "true",
"autowalk": "true"
},
{ {
"id": "26130", "id": "26130",
"replaceId": "26132", "replaceId": "26132",
"fence": "false", "fence": "false",
"metal": "false" "metal": "true"
}, },
{ {
"id": "26131", "id": "26131",
@@ -2802,7 +2816,7 @@
{ {
"id": "34780", "id": "34780",
"replaceId": "34778", "replaceId": "34778",
"fence": "false", "fence": "true",
"metal": "false" "metal": "false"
}, },
{ {
+3 -3
View File
@@ -873,15 +873,15 @@
}, },
{ {
"id": "289", "id": "289",
"borders": "{2560,3648,2623,3711}" "borders": "{2563,3647,2687,3776}"
}, },
{ {
"id": "290", "id": "290",
"borders": "{2560,3584,2623,3647}" "borders": "{2560,3584,2689,3647}"
}, },
{ {
"id": "291", "id": "291",
"borders": "{2688,3648,2751,3711}" "borders": "{2688,3648,2751,3776}"
}, },
{ {
"id": "292", "id": "292",
@@ -13,6 +13,7 @@ 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 kotlin.Unit; import kotlin.Unit;
import org.rs09.consts.Sounds;
/** /**
* Represents the glass making interface plugin. * Represents the glass making interface plugin.
@@ -105,6 +106,7 @@ public final class GlassInterface extends ComponentPlugin {
return true; return true;
} }
player.animate(ANIMATION); player.animate(ANIMATION);
player.getAudioManager().send(Sounds.GLASSBLOWING_2724);
player.getInventory().remove(MOLTEN_GLASS); player.getInventory().remove(MOLTEN_GLASS);
player.getInventory().add(new Item(glass.getProduct(), 1)); player.getInventory().add(new Item(glass.getProduct(), 1));
player.getSkills().addExperience(Skills.CRAFTING, glass.getExperience(), true); player.getSkills().addExperience(Skills.CRAFTING, glass.getExperience(), true);
@@ -7,6 +7,7 @@ import core.game.node.entity.player.Player;
import core.game.node.item.Item; import core.game.node.item.Item;
import core.plugin.Initializable; import core.plugin.Initializable;
import core.plugin.Plugin; import core.plugin.Plugin;
import org.rs09.consts.Sounds;
import java.util.HashMap; import java.util.HashMap;
@@ -28,6 +29,7 @@ public final class EmptyOptionPlugin extends OptionHandler {
} }
if(EmptyItem.emptyItemMap.get(node.getId()) != null){ if(EmptyItem.emptyItemMap.get(node.getId()) != null){
player.getInventory().remove(node.asItem()); player.getInventory().remove(node.asItem());
player.getAudioManager().send(Sounds.LIQUID_2401, 1);
player.getInventory().add(EmptyItem.getEmpty(node.getId())); player.getInventory().add(EmptyItem.getEmpty(node.getId()));
player.getPacketDispatch().sendMessage(EmptyItem.getEmptyMessage(node.getId())); player.getPacketDispatch().sendMessage(EmptyItem.getEmptyMessage(node.getId()));
} else { } else {
@@ -10,6 +10,7 @@ import org.rs09.consts.Items
import core.game.dialogue.SkillDialogueHandler import core.game.dialogue.SkillDialogueHandler
import core.game.interaction.InteractionListener import core.game.interaction.InteractionListener
import core.game.interaction.IntType import core.game.interaction.IntType
import org.rs09.consts.Sounds
class AmmoMouldOnFurnace : InteractionListener { class AmmoMouldOnFurnace : InteractionListener {
private val furnaces = intArrayOf(4304, 6189, 11010, 11666, 12100, 12809, 18497, 26814, 30021, 30510, 36956, 37651) // abstract when smelting converted to kotlin private val furnaces = intArrayOf(4304, 6189, 11010, 11666, 12100, 12809, 18497, 26814, 30021, 30510, 36956, 37651) // abstract when smelting converted to kotlin
@@ -39,6 +40,7 @@ class AmmoMouldOnFurnace : InteractionListener {
0 -> { 0 -> {
sendMessage(player,"You heat the steel bar into a liquid state.") sendMessage(player,"You heat the steel bar into a liquid state.")
animate(player, 3243) // 899 would be preferable but the arms spaz out animate(player, 3243) // 899 would be preferable but the arms spaz out
player.audioManager.send(Sounds.FURNACE_2725, 1)
} }
3 -> { 3 -> {
sendMessage(player,"You pour the molten metal into your cannonball mould.") sendMessage(player,"You pour the molten metal into your cannonball mould.")
@@ -7,6 +7,7 @@ import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items import org.rs09.consts.Items
import core.game.interaction.InteractionListener import core.game.interaction.InteractionListener
import core.game.interaction.IntType import core.game.interaction.IntType
import org.rs09.consts.Sounds
/** /**
* Handles filling most water sources. * Handles filling most water sources.
@@ -44,6 +45,13 @@ class WaterSourceListener : InteractionListener {
animate(player, animation) animate(player, animation)
sendMessage(player, formatMsgText(used.name, vessel.fillMsg)) sendMessage(player, formatMsgText(used.name, vessel.fillMsg))
addItemOrDrop(player, vessel.output) addItemOrDrop(player, vessel.output)
if(with.name.contains("well", ignoreCase = true)) {
playAudio(player, getAudio(Sounds.WELL_FILL_2615, 1))
}
else {
playAudio(player, getAudio(Sounds.TAP_FILL_2609, 1))
}
} }
return !vessel.autofill || amountInInventory(player, used.id) == 0 return !vessel.autofill || amountInInventory(player, used.id) == 0
} }
@@ -13,6 +13,7 @@ import core.game.world.update.flag.context.Animation;
import core.plugin.Plugin; import core.plugin.Plugin;
import core.plugin.Initializable; import core.plugin.Initializable;
import core.plugin.ClassScanner; import core.plugin.ClassScanner;
import org.rs09.consts.Sounds;
/** /**
* Represents the plugin used to milk a cow. * Represents the plugin used to milk a cow.
@@ -55,6 +56,7 @@ public final class CowMilkingPlugin extends OptionHandler {
} }
player.animate(ANIMATION); player.animate(ANIMATION);
player.getAudioManager().send(Sounds.MILK_COW_372);
player.getPulseManager().run(new Pulse(8, player) { player.getPulseManager().run(new Pulse(8, player) {
@Override @Override
public boolean pulse() { public boolean pulse() {
@@ -19,7 +19,6 @@ import core.tools.RandomFunction;
*/ */
@Initializable @Initializable
public final class HerbCleanPlugin extends OptionHandler { public final class HerbCleanPlugin extends OptionHandler {
private static final int[] SFX_IDS = new int[] { 5153, 5155, 5157 };
@Override @Override
public Plugin<Object> newInstance(Object arg) throws Throwable { public Plugin<Object> newInstance(Object arg) throws Throwable {
@@ -42,7 +41,7 @@ public final class HerbCleanPlugin extends OptionHandler {
if (removeItem(player, node.asItem(), Container.INVENTORY)){ if (removeItem(player, node.asItem(), Container.INVENTORY)){
player.getSkills().addExperience(Skills.HERBLORE, exp, true); player.getSkills().addExperience(Skills.HERBLORE, exp, true);
addItem(player, herb.getProduct().getId(), 1, Container.INVENTORY); addItem(player, herb.getProduct().getId(), 1, Container.INVENTORY);
player.getAudioManager().send(SFX_IDS[RandomFunction.random(SFX_IDS.length)], 1); player.getAudioManager().send(5153, 1);
player.getPacketDispatch().sendMessage("You clean the dirt from the " + herb.getProduct().getName().toLowerCase().replace("clean", "").trim() + " leaf."); player.getPacketDispatch().sendMessage("You clean the dirt from the " + herb.getProduct().getName().toLowerCase().replace("clean", "").trim() + " leaf.");
} }
player.lock(1); player.lock(1);
@@ -15,6 +15,7 @@ import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics; import core.game.world.update.flag.context.Graphics;
import core.tools.RandomFunction; import core.tools.RandomFunction;
import core.tools.StringUtils; import core.tools.StringUtils;
import org.rs09.consts.Sounds;
/** /**
* Represents the pulse used to smelt. * Represents the pulse used to smelt.
@@ -110,6 +111,7 @@ public class SmeltingPulse extends SkillPulse<Item> {
player.visualize(Animation.create(725), new Graphics(148, 96)); player.visualize(Animation.create(725), new Graphics(148, 96));
} else { } else {
player.animate(Animation.create(3243)); // Used to be 899 but that looked wonky and broken player.animate(Animation.create(3243)); // Used to be 899 but that looked wonky and broken
player.getAudioManager().send(Sounds.FURNACE_2725, 1);
} }
} }
} }
@@ -10,6 +10,8 @@ import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.diary.DiaryType; import core.game.node.entity.player.link.diary.DiaryType;
import core.game.node.item.Item; import core.game.node.item.Item;
import static core.api.ContentAPIKt.*;
/** /**
* Represents the dialogue used to handle the sailing from and to karamja. * Represents the dialogue used to handle the sailing from and to karamja.
* *
@@ -148,6 +150,7 @@ public class SeamanDialoguePlugin extends DialoguePlugin {
public void travel() { public void travel() {
end(); end();
Ships.PORT_SARIM_TO_KARAMAJA.sail(player); Ships.PORT_SARIM_TO_KARAMAJA.sail(player);
playJingle(player, 172);
} }
@Override @Override
@@ -16,7 +16,7 @@ import core.tools.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static core.api.ContentAPIKt.requireQuest; import static core.api.ContentAPIKt.*;
/** /**
* Represents a class used to charter ships. * Represents a class used to charter ships.
@@ -341,6 +341,7 @@ public final class ShipCharter {
*/ */
public void sail(final Player player) { public void sail(final Player player) {
player.lock(7); player.lock(7);
playJingle(player, 171);
Location start = player.getLocation(); Location start = player.getLocation();
GameWorld.getPulser().submit(new Pulse(1) { GameWorld.getPulser().submit(new Pulse(1) {
int count = 0; int count = 0;
@@ -8,6 +8,8 @@ import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player; import core.game.node.entity.player.Player;
import core.plugin.Plugin; import core.plugin.Plugin;
import static core.api.ContentAPIKt.*;
/** /**
* Handles a pest control squire's options. * Handles a pest control squire's options.
* @author Emperor * @author Emperor
@@ -38,6 +40,7 @@ public final class PestControlSquire extends OptionHandler {
case "leave": case "leave":
if (session == null) { if (session == null) {
Ships.PEST_TO_PORT_SARIM.sail(player); Ships.PEST_TO_PORT_SARIM.sail(player);
playJingle(player, 172);
return true; return true;
} }
player.getProperties().setTeleportLocation(session.getActivity().getLeaveLocation()); player.getProperties().setTeleportLocation(session.getActivity().getLeaveLocation());
@@ -7,6 +7,8 @@ import core.game.node.entity.npc.NPC;
import core.plugin.Initializable; import core.plugin.Initializable;
import core.game.node.entity.player.Player; import core.game.node.entity.player.Player;
import static core.api.ContentAPIKt.*;
/** /**
* Handles the SquireDialogue dialogue. * Handles the SquireDialogue dialogue.
* @author 'Vexia * @author 'Vexia
@@ -94,6 +96,7 @@ public class SquireDialogue extends DialoguePlugin {
case 503: case 503:
end(); end();
Ships.PEST_TO_PORT_SARIM.sail(player); Ships.PEST_TO_PORT_SARIM.sail(player);
playJingle(player, 172);
break; break;
case 1: case 1:
switch (buttonId) { switch (buttonId) {
@@ -157,6 +160,7 @@ public class SquireDialogue extends DialoguePlugin {
case 24: case 24:
end(); end();
Ships.PORT_SARIM_TO_PEST_CONTROL.sail(player); Ships.PORT_SARIM_TO_PEST_CONTROL.sail(player);
playJingle(player, 172);
break; break;
case 200: case 200:
end(); end();
@@ -9,6 +9,8 @@ import core.game.node.entity.player.link.diary.DiaryType;
import core.plugin.Initializable; import core.plugin.Initializable;
import core.game.node.entity.player.Player; import core.game.node.entity.player.Player;
import static core.api.ContentAPIKt.*;
/** /**
* Represents the dialogue plugin used for the monk of entrana dialogue. * Represents the dialogue plugin used for the monk of entrana dialogue.
* @author 'Vexia * @author 'Vexia
@@ -105,6 +107,7 @@ public final class MonkOfEntranaDialogue extends DialoguePlugin {
case 25: case 25:
end(); end();
Ships.PORT_SARIM_TO_ENTRANA.sail(player); Ships.PORT_SARIM_TO_ENTRANA.sail(player);
playJingle(player, 172);
if (!player.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).isComplete(0, 14)) { if (!player.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).isComplete(0, 14)) {
player.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).updateTask(player, 0, 14, true); player.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).updateTask(player, 0, 14, true);
} }
@@ -132,6 +135,7 @@ public final class MonkOfEntranaDialogue extends DialoguePlugin {
case 511: case 511:
end(); end();
Ships.ENTRANA_TO_PORT_SARIM.sail(player); Ships.ENTRANA_TO_PORT_SARIM.sail(player);
playJingle(player, 172);
break; break;
case 520: case 520:
end(); end();
@@ -22,7 +22,7 @@ import core.game.world.update.flag.context.Animation;
import core.plugin.Plugin; import core.plugin.Plugin;
import core.plugin.ClassScanner; import core.plugin.ClassScanner;
import org.rs09.consts.Items; import org.rs09.consts.Items;
import org.rs09.consts.Sounds;
/** /**
@@ -295,6 +295,8 @@ public final class RugMerchantDialogue extends DialoguePlugin {
player.getInterfaceManager().removeTabs(0,1,2,3,4,5,6,7,8,9,10,11,12,13); 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.getEquipment().replace(new Item(Items.MAGIC_CARPET_5614),EquipmentContainer.SLOT_WEAPON);
player.getPacketDispatch().sendInterfaceConfig(548,69,true); player.getPacketDispatch().sendInterfaceConfig(548,69,true);
player.getAudioManager().send(Sounds.CARPET_RISE_1196);
playJingle(player, 132);
registerLogoutListener(player, "magic-carpet", (pl) -> { registerLogoutListener(player, "magic-carpet", (pl) -> {
removeItem(pl, Items.MAGIC_CARPET_5614, Container.EQUIPMENT); removeItem(pl, Items.MAGIC_CARPET_5614, Container.EQUIPMENT);
@@ -340,6 +342,7 @@ public final class RugMerchantDialogue extends DialoguePlugin {
player.unlock(); player.unlock();
player.animate(new Animation(-1)); player.animate(new Animation(-1));
setVarp(player, 499, 0); setVarp(player, 499, 0);
player.getAudioManager().send(Sounds.CARPET_DESCEND_1195);
clearLogoutListener(player, "magic-carpet"); clearLogoutListener(player, "magic-carpet");
@@ -17,6 +17,7 @@ import core.game.world.update.flag.context.Animation;
import core.plugin.Plugin; import core.plugin.Plugin;
import core.plugin.Initializable; import core.plugin.Initializable;
import core.tools.RandomFunction; import core.tools.RandomFunction;
import org.rs09.consts.Sounds;
/** /**
* The desert zone map. * The desert zone map.
@@ -104,6 +105,7 @@ public final class DesertZone extends MapZone implements Plugin<Object> {
p.getInventory().add(new Item(i.getId() + 2)); p.getInventory().add(new Item(i.getId() + 2));
p.animate(ANIMATION); p.animate(ANIMATION);
p.getPacketDispatch().sendMessage("You take a drink of water."); p.getPacketDispatch().sendMessage("You take a drink of water.");
p.getAudioManager().send(Sounds.LIQUID_2401, 1);
return true; return true;
} }
} }
@@ -1,10 +1,10 @@
package content.region.fremennik.rellekka.handlers package content.region.fremennik.rellekka.handlers
import core.api.* import core.api.*
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.world.map.Location import core.game.world.map.Location
import org.rs09.consts.NPCs import org.rs09.consts.NPCs
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
/** /**
* File to be used for anything Rellekka related. * File to be used for anything Rellekka related.
@@ -51,11 +51,13 @@ class RellekkaListeners : InteractionListener {
if (!hasRequirement(player, "Fremennik Trials")) if (!hasRequirement(player, "Fremennik Trials"))
return@on true return@on true
RellekkaUtils.sail(player, RellekkaDestination.RELLEKKA_TO_NEITIZNOT) RellekkaUtils.sail(player, RellekkaDestination.RELLEKKA_TO_NEITIZNOT)
playJingle(player, 171)
return@on true return@on true
} }
on(NPCs.MARIA_GUNNARS_5507, IntType.NPC, "ferry-rellekka"){ player, node -> on(NPCs.MARIA_GUNNARS_5507, IntType.NPC, "ferry-rellekka"){ player, node ->
RellekkaUtils.sail(player, RellekkaDestination.NEITIZNOT_TO_RELLEKKA) RellekkaUtils.sail(player, RellekkaDestination.NEITIZNOT_TO_RELLEKKA)
playJingle(player, 171)
return@on true return@on true
} }
@@ -63,11 +65,13 @@ class RellekkaListeners : InteractionListener {
if (!hasRequirement(player, "Fremennik Trials")) if (!hasRequirement(player, "Fremennik Trials"))
return@on true return@on true
RellekkaUtils.sail(player, RellekkaDestination.RELLEKKA_TO_JATIZSO) RellekkaUtils.sail(player, RellekkaDestination.RELLEKKA_TO_JATIZSO)
playJingle(player, 171)
return@on true return@on true
} }
on(NPCs.MORD_GUNNARS_5482, IntType.NPC, "ferry-rellekka"){ player, node -> on(NPCs.MORD_GUNNARS_5482, IntType.NPC, "ferry-rellekka"){ player, node ->
RellekkaUtils.sail(player, RellekkaDestination.JATIZSO_TO_RELLEKKA) RellekkaUtils.sail(player, RellekkaDestination.JATIZSO_TO_RELLEKKA)
playJingle(player, 171)
return@on true return@on true
} }
} }
@@ -8,6 +8,8 @@ import core.game.node.entity.player.Player;
import core.plugin.Initializable; import core.plugin.Initializable;
import core.game.node.item.Item; import core.game.node.item.Item;
import static core.api.ContentAPIKt.*;
/** /**
* Represents the captain barnaby dialogue plugin. * Represents the captain barnaby dialogue plugin.
* @author 'Vexia * @author 'Vexia
@@ -82,6 +84,7 @@ public final class CaptainBarnabyDialogue extends DialoguePlugin {
if (player.getInventory().remove(COINS)) { if (player.getInventory().remove(COINS)) {
end(); end();
player.getPacketDispatch().sendMessage("You pay 30 coins and board the ship."); player.getPacketDispatch().sendMessage("You pay 30 coins and board the ship.");
playJingle(player, 171);
Ships.ARDOUGNE_TO_BRIMHAVEN.sail(player); Ships.ARDOUGNE_TO_BRIMHAVEN.sail(player);
} }
break; break;
@@ -9,6 +9,8 @@ import core.game.node.item.Item;
import core.plugin.Initializable; import core.plugin.Initializable;
import core.game.world.map.Location; import core.game.world.map.Location;
import static core.api.ContentAPIKt.*;
/** /**
* Represents the dialogue plugin used to handle the customs officer. * Represents the dialogue plugin used to handle the customs officer.
* @author Vexia * @author Vexia
@@ -184,6 +186,11 @@ public final class CustomsOfficerDialogue extends DialoguePlugin {
} }
player.getPacketDispatch().sendMessage("You pay " + getPrice() + " coins and board the ship."); player.getPacketDispatch().sendMessage("You pay " + getPrice() + " coins and board the ship.");
ship.sail(player); ship.sail(player);
if(ship == Ships.BRIMHAVEN_TO_ARDOUGNE) {
playJingle(player, 171);
} else {
playJingle(player, 172);
}
break; break;
case 220: case 220:
end(); end();
+12
View File
@@ -70,6 +70,9 @@ import core.tools.*
import core.game.world.update.flag.* import core.game.world.update.flag.*
import core.game.world.update.flag.context.* import core.game.world.update.flag.context.*
import core.game.requirement.* import core.game.requirement.*
import core.net.packet.PacketRepository
import core.net.packet.context.MusicContext
import core.net.packet.out.MusicPacket
import java.util.regex.* import java.util.regex.*
import java.io.* import java.io.*
import kotlin.math.* import kotlin.math.*
@@ -553,6 +556,15 @@ fun getAudio(id: Int, volume: Int = 10, delay: Int = 1): Audio {
return Audio(id, volume, delay) return Audio(id, volume, delay)
} }
/**
* Plays a jingle by id
* @param player the player to play the jingle for
* @param jingleId the jingle to play
*/
fun playJingle(player: Player, jingleId: Int) {
PacketRepository.send(MusicPacket::class.java, MusicContext(player, jingleId, true))
}
/** /**
* Impact an enemy with the given amount of damage and the given hitsplat type * Impact an enemy with the given amount of damage and the given hitsplat type
* @param entity the entity to damage * @param entity the entity to damage
@@ -15,6 +15,7 @@ import core.game.world.map.path.Pathfinder;
import kotlin.Unit; import kotlin.Unit;
import core.game.system.config.DoorConfigLoader; import core.game.system.config.DoorConfigLoader;
import core.game.world.GameWorld; import core.game.world.GameWorld;
import org.rs09.consts.Sounds;
import static core.api.ContentAPIKt.hasRequirement; import static core.api.ContentAPIKt.hasRequirement;
@@ -42,7 +43,14 @@ public final class DoorActionHandler {
final Scenery second = (object.getId() == 1530 || object.getId() == 1531) ? null : getSecondDoor(object, player); final Scenery second = (object.getId() == 1530 || object.getId() == 1531) ? null : getSecondDoor(object, player);
Scenery o = null; Scenery o = null;
if (object instanceof Constructed && (o = ((Constructed) object).getReplaced()) != null) { if (object instanceof Constructed && (o = ((Constructed) object).getReplaced()) != null) {
player.getAudioManager().send(new Audio(43)); DoorConfigLoader.Door d = DoorConfigLoader.Companion.forId(object.getId());
if (d != null && d.isMetal()) {
player.getAudioManager().send(Sounds.IRON_DOOR_CLOSE_70);
} else if (d != null && d.isFence()){
player.getAudioManager().send(Sounds.GATE_CLOSE_66);
} else {
player.getAudioManager().send(60);
}
SceneryBuilder.replace(object, o); SceneryBuilder.replace(object, o);
if (second instanceof Constructed && (o = ((Constructed) second).getReplaced()) != null) { if (second instanceof Constructed && (o = ((Constructed) second).getReplaced()) != null) {
SceneryBuilder.replace(second, o); SceneryBuilder.replace(second, o);
@@ -53,11 +61,20 @@ public final class DoorActionHandler {
if (object.getDefinition().hasAction("close")) { if (object.getDefinition().hasAction("close")) {
if (second != null) { if (second != null) {
player.getPacketDispatch().sendMessage("The doors appear to be stuck."); player.getPacketDispatch().sendMessage("The doors appear to be stuck.");
player.getAudioManager().send(Sounds.DOOR_CREAK_61);
return; return;
} }
DoorConfigLoader.Door d = DoorConfigLoader.Companion.forId(object.getId()); DoorConfigLoader.Door d = DoorConfigLoader.Companion.forId(object.getId());
if (d != null && d.isMetal()) {
player.getAudioManager().send(Sounds.IRON_DOOR_OPEN_71);
} else if (d != null && d.isFence()){
player.getAudioManager().send(Sounds.GATE_OPEN_67);
} else {
player.getAudioManager().send(Sounds.DOOR_OPEN_62);
}
if (d == null) { if (d == null) {
player.getPacketDispatch().sendMessage("The door appears to be stuck."); player.getPacketDispatch().sendMessage("The door appears to be stuck.");
player.getAudioManager().send(Sounds.DOOR_CREAK_61);
return; return;
} }
int firstDir = (object.getRotation() + 3) % 4; int firstDir = (object.getRotation() + 3) % 4;
@@ -76,9 +93,11 @@ public final class DoorActionHandler {
return; return;
} }
if (d.isMetal()) { if (d.isMetal()) {
player.getAudioManager().send(new Audio(71)); player.getAudioManager().send(Sounds.IRON_DOOR_OPEN_71);
} else if (d.isFence()){
player.getAudioManager().send(Sounds.GATE_OPEN_67);
} else { } else {
player.getAudioManager().send(new Audio(81)); player.getAudioManager().send(Sounds.DOOR_OPEN_62);
} }
if (second != null) { if (second != null) {
DoorConfigLoader.Door s = DoorConfigLoader.Companion.forId(second.getId()); DoorConfigLoader.Door s = DoorConfigLoader.Companion.forId(second.getId());
@@ -103,7 +122,17 @@ public final class DoorActionHandler {
entity.lock(4); entity.lock(4);
final Location loc = entity.getLocation(); final Location loc = entity.getLocation();
if (entity instanceof Player) { if (entity instanceof Player) {
((Player) entity).getAudioManager().send(new Audio(3419)); 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);
} 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);
} else {
((Player) entity).getAudioManager().send(Sounds.DOOR_OPEN_62,10);
((Player) entity).getAudioManager().send(60,10,60);
}
entity.asPlayer().logoutListeners.put("autowalk", player -> { entity.asPlayer().logoutListeners.put("autowalk", player -> {
player.setLocation(loc); player.setLocation(loc);
return Unit.INSTANCE; return Unit.INSTANCE;
@@ -169,10 +169,12 @@ public final class MusicPlayer {
* @param entry The song. * @param entry The song.
*/ */
public void play(MusicEntry entry) { public void play(MusicEntry entry) {
PacketRepository.send(MusicPacket.class, new MusicContext(player, entry.getId())); if (!looping || currentMusicId == entry.getId()) {
PacketRepository.send(StringPacket.class, new StringContext(player, entry.getName() + (player.isDebug() ? (" (" + entry.getId() + ")") : ""), 187, 14)); PacketRepository.send(MusicPacket.class, new MusicContext(player, entry.getId()));
currentMusicId = entry.getId(); PacketRepository.send(StringPacket.class, new StringContext(player, entry.getName() + (player.isDebug() ? (" (" + entry.getId() + ")") : ""), 187, 14));
playing = true; currentMusicId = entry.getId();
playing = true;
}
} }
/** /**
@@ -216,7 +218,7 @@ public final class MusicPlayer {
if(GameWorld.getTicks() % 20 == 0){ if(GameWorld.getTicks() % 20 == 0){
if(!isPlaying()){ if(!isPlaying()){
try { try {
play((MusicEntry) unlocked.values().toArray()[new Random().nextInt(unlocked.values().size())]); PacketRepository.send(MusicPacket.class, new MusicContext(player, currentMusicId));
} catch (Exception e){} } catch (Exception e){}
} }
} }
@@ -33,6 +33,13 @@ class DoorConfigLoader {
door.isAutoWalk = e["autowalk"]?.toString()?.toBoolean() ?: false door.isAutoWalk = e["autowalk"]?.toString()?.toBoolean() ?: false
door.questRequirement = e["questRequirement"]?.toString() ?: "" door.questRequirement = e["questRequirement"]?.toString() ?: ""
DOORS[door.id] = door DOORS[door.id] = door
val replacedDoor = Door(door.replaceId)
replacedDoor.replaceId = door.id
replacedDoor.isFence = door.isFence
replacedDoor.isMetal = door.isMetal
replacedDoor.isAutoWalk = door.isAutoWalk
replacedDoor.questRequirement = door.questRequirement
DOORS[door.replaceId] = replacedDoor
count++ count++
} }
log(this::class.java, Log.FINE, "Parsed $count door configs.") log(this::class.java, Log.FINE, "Parsed $count door configs.")