mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
More sounds + audio refactoring
Modified default audio radius default parameter to be safer, 8 tiles instead of 15 Improved location/direction based sounds Fixed the way sounds are handled for magic spells (All modern and ancient combat spells. All lunar teleport spells.) Magic spells now correctly fade in volume the further away you are from a target/player casting or being hit by a spell. The sound starts to fade after a few tiles until it cant be heard anymore Refactored lunar teleport sounds to use playGlobalAudio Humidfy now can be heard globally by other players Fixed Lunar fertile soil spell graphics and animation to be authentic Weapon attack sounds now start to fade after a few tiles until it cant be heard anymore NPC attack sound now fades with distance NPC hurt sound now fades with distance NPC death sound now fades with distance Fixed combat punching sound when no weapon is equipped so it can be heard globally Fixed a issue where you would hear a punching sound when casting any combat spell Fixed male player hurt sounds when in combat Implemented female player hurt sounds when in combat Failing agility obstacles will now play the correct hurt sound based on gender Fixed low wall agility pyramid sound Fixed taking damage from dying of thirst in the desert to use correct sounds Fixed the sound of drinking from a waterskin in the desert Implemented sound when attaching godsword blades to a hilt Fixed rune essence mine teleport sound so it no longer loops 10 times and plays authentically Implemented undead tree attack sound at Draynor manor Implemented all ectofunctus bone grinder sounds and the sound when offering to the ectofunctus Implemented mort myre ghast attack and player hurt sounds Fixed thieving pickpocket fail sounds Implemented falador guards combat sounds Implemented varrock guards combat sounds Implemented draynor market guard combat sounds Implemented cyclops combat sounds (warriors guild cyclops) Implemented animated armor combat sounds (all warriors guild animated armors) Implemented white wolf/big wolf/wolf combat sounds (wolves on white wolf mountain)
This commit is contained in:
parent
3d2c0f2baa
commit
dd017c85d2
29 changed files with 192 additions and 137 deletions
|
|
@ -184,7 +184,7 @@
|
|||
"examine": "He tries to keep order around here.",
|
||||
"melee_animation": "400",
|
||||
"range_animation": "0",
|
||||
"combat_audio": "511,513,512",
|
||||
"combat_audio": "2549,1979,512",
|
||||
"attack_speed": "4",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "404",
|
||||
|
|
@ -1779,6 +1779,7 @@
|
|||
"slayer_task": "92",
|
||||
"melee_animation": "6579",
|
||||
"range_animation": "6579",
|
||||
"combat_audio": "909,912,911",
|
||||
"attack_speed": "4",
|
||||
"defence_animation": "6578",
|
||||
"weakness": "9",
|
||||
|
|
@ -1800,6 +1801,7 @@
|
|||
"slayer_task": "92",
|
||||
"melee_animation": "6579",
|
||||
"range_animation": "6579",
|
||||
"combat_audio": "909,912,911",
|
||||
"attack_speed": "4",
|
||||
"defence_animation": "6578",
|
||||
"weakness": "7",
|
||||
|
|
@ -14195,6 +14197,7 @@
|
|||
"examine": "Keeps the stalls secure.",
|
||||
"melee_animation": "390",
|
||||
"range_animation": "0",
|
||||
"combat_audio": "",
|
||||
"defence_animation": "0",
|
||||
"weakness": "9",
|
||||
"magic_animation": "0",
|
||||
|
|
@ -16007,9 +16010,9 @@
|
|||
"range_animation": "0",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "285",
|
||||
"death_animation": "287",
|
||||
"weakness": "9",
|
||||
"magic_animation": "0",
|
||||
"death_animation": "287",
|
||||
"name": "Ice Troll",
|
||||
"defence_level": "60",
|
||||
"safespot": null,
|
||||
|
|
@ -16027,9 +16030,9 @@
|
|||
"range_animation": "0",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "285",
|
||||
"death_animation": "287",
|
||||
"weakness": "9",
|
||||
"magic_animation": "0",
|
||||
"death_animation": "287",
|
||||
"name": "Ice Troll",
|
||||
"defence_level": "60",
|
||||
"safespot": null,
|
||||
|
|
@ -16046,9 +16049,9 @@
|
|||
"range_animation": "0",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "285",
|
||||
"death_animation": "287",
|
||||
"weakness": "9",
|
||||
"magic_animation": "0",
|
||||
"death_animation": "287",
|
||||
"name": "Ice Troll",
|
||||
"defence_level": "60",
|
||||
"safespot": null,
|
||||
|
|
@ -16066,9 +16069,9 @@
|
|||
"range_animation": "0",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "285",
|
||||
"death_animation": "287",
|
||||
"weakness": "9",
|
||||
"magic_animation": "0",
|
||||
"death_animation": "287",
|
||||
"name": "Ice Troll",
|
||||
"defence_level": "60",
|
||||
"safespot": null,
|
||||
|
|
@ -16085,9 +16088,9 @@
|
|||
"range_animation": "0",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "285",
|
||||
"death_animation": "287",
|
||||
"weakness": "9",
|
||||
"magic_animation": "0",
|
||||
"death_animation": "287",
|
||||
"name": "Ice Troll",
|
||||
"defence_level": "60",
|
||||
"safespot": null,
|
||||
|
|
@ -16105,9 +16108,9 @@
|
|||
"range_animation": "0",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "285",
|
||||
"death_animation": "287",
|
||||
"weakness": "9",
|
||||
"magic_animation": "0",
|
||||
"death_animation": "287",
|
||||
"name": "Ice Troll",
|
||||
"defence_level": "60",
|
||||
"safespot": null,
|
||||
|
|
@ -16125,9 +16128,9 @@
|
|||
"range_animation": "0",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "285",
|
||||
"death_animation": "287",
|
||||
"weakness": "9",
|
||||
"magic_animation": "0",
|
||||
"death_animation": "287",
|
||||
"name": "Ice Troll",
|
||||
"defence_level": "60",
|
||||
"safespot": null,
|
||||
|
|
@ -20173,9 +20176,9 @@
|
|||
"range_animation": "0",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "285",
|
||||
"death_animation": "287",
|
||||
"weakness": "9",
|
||||
"magic_animation": "0",
|
||||
"death_animation": "287",
|
||||
"name": "Ice troll",
|
||||
"defence_level": "64",
|
||||
"safespot": null,
|
||||
|
|
@ -20193,9 +20196,9 @@
|
|||
"range_animation": "0",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "285",
|
||||
"death_animation": "287",
|
||||
"weakness": "9",
|
||||
"magic_animation": "0",
|
||||
"death_animation": "287",
|
||||
"name": "Ice troll",
|
||||
"defence_level": "64",
|
||||
"safespot": null,
|
||||
|
|
@ -20212,9 +20215,9 @@
|
|||
"range_animation": "0",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "285",
|
||||
"death_animation": "287",
|
||||
"weakness": "9",
|
||||
"magic_animation": "0",
|
||||
"death_animation": "287",
|
||||
"name": "Ice troll",
|
||||
"defence_level": "64",
|
||||
"safespot": null,
|
||||
|
|
@ -20232,9 +20235,9 @@
|
|||
"range_animation": "0",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "285",
|
||||
"death_animation": "287",
|
||||
"weakness": "9",
|
||||
"magic_animation": "0",
|
||||
"death_animation": "287",
|
||||
"name": "Ice troll",
|
||||
"defence_level": "64",
|
||||
"safespot": null,
|
||||
|
|
@ -20251,9 +20254,9 @@
|
|||
"range_animation": "0",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "285",
|
||||
"death_animation": "287",
|
||||
"weakness": "9",
|
||||
"magic_animation": "0",
|
||||
"death_animation": "287",
|
||||
"name": "Ice troll",
|
||||
"defence_level": "64",
|
||||
"safespot": null,
|
||||
|
|
@ -20271,9 +20274,9 @@
|
|||
"range_animation": "0",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "285",
|
||||
"death_animation": "287",
|
||||
"weakness": "9",
|
||||
"magic_animation": "0",
|
||||
"death_animation": "287",
|
||||
"name": "Ice troll",
|
||||
"defence_level": "64",
|
||||
"safespot": null,
|
||||
|
|
@ -20291,9 +20294,9 @@
|
|||
"range_animation": "0",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "285",
|
||||
"death_animation": "287",
|
||||
"weakness": "9",
|
||||
"magic_animation": "0",
|
||||
"death_animation": "287",
|
||||
"name": "Ice troll",
|
||||
"defence_level": "64",
|
||||
"safespot": null,
|
||||
|
|
@ -22861,6 +22864,7 @@
|
|||
"examine": "He guards the Draynor Market stalls from thieves.",
|
||||
"melee_animation": "390",
|
||||
"range_animation": "0",
|
||||
"combat_audio": "2547,1979,512",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "0",
|
||||
"weakness": "6",
|
||||
|
|
@ -36310,6 +36314,7 @@
|
|||
"examine": "Animated bronze armour.",
|
||||
"melee_animation": "386",
|
||||
"range_animation": "386",
|
||||
"combat_audio": "2549,1979,512",
|
||||
"attack_speed": "4",
|
||||
"respawn_delay": "20",
|
||||
"defence_animation": "388",
|
||||
|
|
@ -36332,6 +36337,7 @@
|
|||
"examine": "Animated iron armour.",
|
||||
"melee_animation": "386",
|
||||
"range_animation": "386",
|
||||
"combat_audio": "2549,1979,512",
|
||||
"attack_speed": "4",
|
||||
"respawn_delay": "20",
|
||||
"defence_animation": "388",
|
||||
|
|
@ -36354,6 +36360,7 @@
|
|||
"examine": "Animated steel armour.",
|
||||
"melee_animation": "386",
|
||||
"range_animation": "386",
|
||||
"combat_audio": "2549,1979,512",
|
||||
"attack_speed": "4",
|
||||
"respawn_delay": "20",
|
||||
"defence_animation": "388",
|
||||
|
|
@ -36376,6 +36383,7 @@
|
|||
"examine": "Animated black armour.",
|
||||
"melee_animation": "386",
|
||||
"range_animation": "386",
|
||||
"combat_audio": "2549,1979,512",
|
||||
"attack_speed": "4",
|
||||
"respawn_delay": "20",
|
||||
"defence_animation": "388",
|
||||
|
|
@ -36398,6 +36406,7 @@
|
|||
"examine": "Animated mithril armour.",
|
||||
"melee_animation": "386",
|
||||
"range_animation": "386",
|
||||
"combat_audio": "2549,1979,512",
|
||||
"attack_speed": "4",
|
||||
"respawn_delay": "20",
|
||||
"defence_animation": "388",
|
||||
|
|
@ -36420,6 +36429,7 @@
|
|||
"examine": "Animated adamant armour.",
|
||||
"melee_animation": "386",
|
||||
"range_animation": "386",
|
||||
"combat_audio": "2549,1979,512",
|
||||
"attack_speed": "4",
|
||||
"respawn_delay": "20",
|
||||
"defence_animation": "388",
|
||||
|
|
@ -36442,6 +36452,7 @@
|
|||
"examine": "Animated rune armour.",
|
||||
"melee_animation": "386",
|
||||
"range_animation": "386",
|
||||
"combat_audio": "2549,1979,512",
|
||||
"attack_speed": "4",
|
||||
"respawn_delay": "20",
|
||||
"defence_animation": "388",
|
||||
|
|
@ -36495,6 +36506,7 @@
|
|||
"slayer_task": "44",
|
||||
"melee_animation": "4652",
|
||||
"range_animation": "0",
|
||||
"combat_audio": "448,451,450",
|
||||
"attack_speed": "4",
|
||||
"magic_level": "1",
|
||||
"respawn_delay": "30",
|
||||
|
|
@ -36520,6 +36532,7 @@
|
|||
"slayer_task": "44",
|
||||
"melee_animation": "4652",
|
||||
"range_animation": "0",
|
||||
"combat_audio": "448,451,450",
|
||||
"attack_speed": "4",
|
||||
"magic_level": "1",
|
||||
"respawn_delay": "30",
|
||||
|
|
@ -50368,7 +50381,7 @@
|
|||
"examine": "He tries to keep order around here. His bizarre uniform isn't helping.",
|
||||
"melee_animation": "6489",
|
||||
"range_animation": "0",
|
||||
"combat_audio": "511,513,512",
|
||||
"combat_audio": "2548,1979,512",
|
||||
"attack_speed": "5",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "0",
|
||||
|
|
@ -50389,7 +50402,7 @@
|
|||
"examine": "He tries to keep order around here. His bizarre uniform isn't helping.",
|
||||
"melee_animation": "6489",
|
||||
"range_animation": "0",
|
||||
"combat_audio": "511,513,512",
|
||||
"combat_audio": "2548,1979,512",
|
||||
"attack_speed": "5",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "0",
|
||||
|
|
@ -51823,6 +51836,7 @@
|
|||
},
|
||||
{
|
||||
"melee_animation": "6559",
|
||||
"combat_audio": "909,912,911",
|
||||
"respawn_delay": "60",
|
||||
"defence_animation": "6557",
|
||||
"slayer_exp": "74",
|
||||
|
|
@ -51841,7 +51855,7 @@
|
|||
"examine": "A vicious mountain wolf.",
|
||||
"melee_animation": "6579",
|
||||
"range_animation": "6579",
|
||||
"combat_audio": "481,491,490",
|
||||
"combat_audio": "909,912,911",
|
||||
"attack_speed": "6",
|
||||
"defence_animation": "6578",
|
||||
"slayer_exp": "34",
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ import core.game.node.item.Item;
|
|||
import core.plugin.Plugin;
|
||||
import core.plugin.Initializable;
|
||||
import core.tools.StringUtils;
|
||||
import org.rs09.consts.Sounds;
|
||||
|
||||
import static core.api.ContentAPIKt.playAudio;
|
||||
|
||||
/**
|
||||
* Handles the attaching of a hilt on the godsword blade.
|
||||
|
|
@ -40,6 +43,7 @@ public final class GodswordHiltAttachPlugin extends UseWithHandler {
|
|||
item = new Item(item.getId() - 8);
|
||||
player.getInventory().add(item);
|
||||
String name = item.getDefinition().getName();
|
||||
playAudio(player, Sounds.GODWARS_GODSWORD_FIX_3889);
|
||||
player.getPacketDispatch().sendMessage("You attach the hilt to the blade and make a" + (StringUtils.isPlusN(name) ? "n " : " ") + name + ".");
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public final class AgilityHandler {
|
|||
player.getProperties().setTeleportLocation(dest);
|
||||
if (hit > 0) {
|
||||
player.getImpactHandler().setDisabledTicks(0);
|
||||
player.getImpactHandler().manualHit(player, hit, HitsplatType.NORMAL);
|
||||
impact(player, hit, HitsplatType.NORMAL);
|
||||
}
|
||||
if (message != null) {
|
||||
player.getPacketDispatch().sendMessage(message);
|
||||
|
|
|
|||
|
|
@ -223,15 +223,14 @@ public final class AgilityPyramidCourse extends AgilityCourse {
|
|||
}
|
||||
player.lock(4);
|
||||
player.getPacketDispatch().sendMessage("You climb the low wall...");
|
||||
playAudio(player, Sounds.CLIMB_WALL_2453,10, 40);
|
||||
if (fail) {
|
||||
Location end = player.getLocation().transform(d, 1);
|
||||
player.lock(3);
|
||||
playAudio(player, Sounds.PYRAMID_SLIP_1397, 10, 25);
|
||||
AgilityHandler.failWalk(player, 2, player.getLocation(), end, end, Animation.create(1106), 15, getHitAmount(player), "You lost your balance!");
|
||||
AgilityHandler.forceWalk(player, -1, end, player.getLocation(), ForceMovement.WALK_ANIMATION, 10, 0.0, null, 4);
|
||||
return;
|
||||
}
|
||||
playAudio(player, Sounds.CLIMB_WALL_2453,10, 40);
|
||||
AgilityHandler.forceWalk(player, 0, player.getLocation(), player.getLocation().transform(d, 2), Animation.create(1252), 6, 8, "... and make it over.");
|
||||
player.animate(Animation.RESET, 4);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ import core.plugin.Initializable;
|
|||
import core.plugin.Plugin;
|
||||
import org.rs09.consts.Sounds;
|
||||
|
||||
import static core.api.ContentAPIKt.playGlobalAudio;
|
||||
|
||||
/**
|
||||
* Handles the Blood spells from the Ancient spellbook.
|
||||
* @author Emperor
|
||||
|
|
@ -95,7 +97,7 @@ public final class BloodSpells extends CombatSpell {
|
|||
projectile.transform(entity, (Entity) target, false, 58, 10).send();
|
||||
}
|
||||
entity.animate(animation);
|
||||
sendAudio(entity, getAudio());
|
||||
playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -11,9 +11,7 @@ import core.game.node.entity.combat.spell.SpellType;
|
|||
import core.game.node.entity.impl.Projectile;
|
||||
import core.game.node.entity.impl.Animator.Priority;
|
||||
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
|
||||
import core.game.node.entity.player.link.audio.Audio;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.GameWorld;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
import core.plugin.Initializable;
|
||||
|
|
@ -104,15 +102,14 @@ public final class IceSpells extends CombatSpell {
|
|||
projectile.transform(entity, (Entity) target, false, 58, 10).send();
|
||||
}
|
||||
entity.animate(animation);
|
||||
sendAudio(entity, audio);
|
||||
playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visualizeImpact(Entity entity, Entity target, BattleState state) {
|
||||
if (state.isFrozen()) {
|
||||
if (target == entity.getProperties().getCombatPulse().getVictim()) {
|
||||
sendAudio(target, new Audio(impactAudio, 1, 20));
|
||||
}
|
||||
playGlobalAudio(target.getLocation(), impactAudio, 1, 20);
|
||||
target.graphics(BARRAGE_ORB);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public final class MiasmicSpells extends CombatSpell {
|
|||
projectile.transform(entity, (Entity) target, false, 58, 10).send();
|
||||
}
|
||||
entity.animate(animation);
|
||||
sendAudio(entity, audio);
|
||||
playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package content.global.skill.magic.ancient;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.combat.spell.Runes;
|
||||
import core.game.node.Node;
|
||||
|
|
@ -19,6 +20,9 @@ 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 Shadow spells from the Ancient spellbook.
|
||||
* @author Emperor
|
||||
|
|
@ -96,7 +100,7 @@ public final class ShadowSpells extends CombatSpell {
|
|||
projectile.transform(entity, (Entity) target, false, 58, 10).send();
|
||||
}
|
||||
entity.animate(animation);
|
||||
sendAudio(entity, audio);
|
||||
playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import core.game.node.entity.combat.spell.CombatSpell;
|
|||
import core.game.node.entity.combat.spell.SpellType;
|
||||
import core.game.node.entity.impl.Projectile;
|
||||
import core.game.node.entity.impl.Animator.Priority;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
|
|
@ -107,7 +108,7 @@ public final class SmokeSpells extends CombatSpell {
|
|||
projectile.transform(entity, (Entity) target, false, 58, 10).send();
|
||||
}
|
||||
entity.animate(animation);
|
||||
sendAudio(entity, audio);
|
||||
playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -12,6 +12,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;
|
||||
|
||||
/**
|
||||
* Represents the humidify spell.
|
||||
|
|
@ -74,7 +77,7 @@ public final class HumidifySpell extends MagicSpell {
|
|||
p.lock(ANIMATION.getDuration() + 1);
|
||||
p.animate(ANIMATION);
|
||||
p.graphics(GRAPHIC);
|
||||
p.getAudioManager().send(3614);
|
||||
playGlobalAudio(p.getLocation(), Sounds.LUNAR_HUMIDIFY_3614, 1, 20);
|
||||
for (int k = 0; k < 28; k++) {
|
||||
for (int i = 0; i < 21; i++) {
|
||||
if (p.getInventory().contains(EMPTY[i], 1)) {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ val NPC_CONTACT_ANIM = Animation(4413)
|
|||
val PLANK_MAKE_ANIM = Animation(6298)
|
||||
val STRING_JEWELLERY_ANIM = Animation(4412)
|
||||
val SUPERGLASS_MAKE_ANIM = Animation(4413)
|
||||
val FERTILE_SOIL_ANIM = Animation(724)
|
||||
val FERTILE_SOIL_ANIM = Animation(4413)
|
||||
val CURE_ME_ANIM = Animation(4411)
|
||||
val CURE_GROUP_ANIM = Animation(4409)
|
||||
val CURE_OTHER_ANIM = Animation(4411)
|
||||
|
|
@ -31,7 +31,7 @@ val NPC_CONTACT_GFX = Graphics(730,130)
|
|||
val PLANK_MAKE_GFX = Graphics(1063, 120)
|
||||
val STRING_JEWELLERY_GFX = Graphics(728, 100)
|
||||
val SUPERGLASS_MAKE_GFX = Graphics(729, 120)
|
||||
val FERTILE_SOIL_GFX = Graphics(141, 96)
|
||||
val FERTILE_SOIL_GFX = Graphics(724)
|
||||
val CURE_ME_GFX = Graphics(731, 90)
|
||||
val CURE_GROUP_GFX = Graphics(751, 130)
|
||||
val CURE_OTHER_GFX = Graphics(738, 130)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import core.game.world.repository.Repository
|
|||
import core.tools.RandomFunction
|
||||
import org.rs09.consts.Components
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.Sounds
|
||||
import kotlin.math.floor
|
||||
|
||||
class LunarListeners : SpellListener("lunar"), Commands {
|
||||
|
|
@ -39,91 +40,91 @@ class LunarListeners : SpellListener("lunar"), Commands {
|
|||
|
||||
onCast(Lunar.MOONCLAN_TELEPORT, NONE) { player, _ ->
|
||||
requires(player,69, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563,1), Item(Items.EARTH_RUNE_557,2)))
|
||||
player.getAudioManager().send(Audio(200), true)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
sendTeleport(player,66.0, Location.create(2111, 3916, 0))
|
||||
}
|
||||
|
||||
onCast(Lunar.MOONCLAN_GR_TELEPORT, NONE) { player, _ ->
|
||||
requires(player,70, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563,1), Item(Items.EARTH_RUNE_557,4)))
|
||||
player.getAudioManager().send(Audio(200), true)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
sendGroupTeleport(player,67.0,"Moonclan Island",Location.create(2111, 3916, 0))
|
||||
}
|
||||
|
||||
onCast(Lunar.OURANIA_TELEPORT, NONE) { player, _ ->
|
||||
requires(player,71, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563,1), Item(Items.EARTH_RUNE_557,6)))
|
||||
player.getAudioManager().send(Audio(200), true)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
sendTeleport(player,69.0, Location.create(2469, 3247, 0))
|
||||
}
|
||||
|
||||
onCast(Lunar.WATERBIRTH_TELEPORT, NONE){ player, _ ->
|
||||
requires(player,72, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563), Item(Items.WATER_RUNE_555)))
|
||||
player.getAudioManager().send(Audio(200), true)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
sendTeleport(player,71.0, Location.create(2527, 3739, 0))
|
||||
}
|
||||
|
||||
onCast(Lunar.WATERBIRTH_GR_TELEPORT, NONE) { player, _ ->
|
||||
requires(player,73, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563), Item(Items.WATER_RUNE_555,5)))
|
||||
player.getAudioManager().send(Audio(200), true)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
sendGroupTeleport(player,72.0,"Waterbirth Island", Location.create(2527, 3739, 0))
|
||||
}
|
||||
|
||||
onCast(Lunar.BARBARIAN_TELEPORT, NONE) { player, _ ->
|
||||
requires(player,75, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563,2), Item(Items.FIRE_RUNE_554,3)))
|
||||
player.getAudioManager().send(Audio(200), true)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
sendTeleport(player,76.0, Location.create(2544, 3572, 0))
|
||||
}
|
||||
|
||||
onCast(Lunar.BARBARIAN_GR_TELEPORT, NONE) { player, _ ->
|
||||
requires(player,77, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563,2), Item(Items.FIRE_RUNE_554,6)))
|
||||
player.getAudioManager().send(Audio(200), true)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
sendGroupTeleport(player,77.0,"Barbarian Outpost", Location.create(2544, 3572, 0))
|
||||
}
|
||||
|
||||
onCast(Lunar.KHAZARD_TELEPORT, NONE) { player, _ ->
|
||||
requires(player,78, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563,2), Item(Items.WATER_RUNE_555,4)))
|
||||
player.getAudioManager().send(Audio(200), true)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
sendTeleport(player,80.0, Location.create(2656, 3157, 0))
|
||||
}
|
||||
|
||||
onCast(Lunar.KHAZARD_GR_TELEPORT, NONE) { player, _ ->
|
||||
requires(player,79, arrayOf(Item(Items.ASTRAL_RUNE_9075,2), Item(Items.LAW_RUNE_563,2), Item(Items.WATER_RUNE_555,8)))
|
||||
player.getAudioManager().send(Audio(200), true)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
sendGroupTeleport(player,81.0, "Port Khazard", Location.create(2656, 3157, 0))
|
||||
}
|
||||
|
||||
onCast(Lunar.FISHING_GUILD_TELEPORT, NONE) { player, _ ->
|
||||
requires(player,85, arrayOf(Item(Items.ASTRAL_RUNE_9075,3), Item(Items.LAW_RUNE_563,3), Item(Items.WATER_RUNE_555,10)))
|
||||
player.getAudioManager().send(Audio(200), true)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
sendTeleport(player,89.0, Location.create(2611, 3393, 0))
|
||||
}
|
||||
|
||||
onCast(Lunar.FISHING_GUILD_GR_TELEPORT, NONE) { player, _ ->
|
||||
requires(player,86, arrayOf(Item(Items.ASTRAL_RUNE_9075,3), Item(Items.LAW_RUNE_563,3), Item(Items.WATER_RUNE_555,14)))
|
||||
player.getAudioManager().send(Audio(200), true)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
sendGroupTeleport(player,90.0,"Fishing Guild", Location.create(2611, 3393, 0))
|
||||
}
|
||||
|
||||
onCast(Lunar.CATHERBY_TELEPORT, NONE) { player, _ ->
|
||||
requires(player,87, arrayOf(Item(Items.ASTRAL_RUNE_9075,3), Item(Items.LAW_RUNE_563,3), Item(Items.WATER_RUNE_555,10)))
|
||||
player.getAudioManager().send(Audio(200), true)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
sendTeleport(player,92.0, Location.create(2804, 3433, 0))
|
||||
}
|
||||
|
||||
onCast(Lunar.CATHERBY_GR_TELEPORT, NONE) { player, _ ->
|
||||
requires(player,88, arrayOf(Item(Items.ASTRAL_RUNE_9075,3), Item(Items.LAW_RUNE_563,3), Item(Items.WATER_RUNE_555,15)))
|
||||
player.getAudioManager().send(Audio(200), true)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
sendGroupTeleport(player,93.0,"Catherby", Location.create(2804, 3433, 0))
|
||||
}
|
||||
|
||||
onCast(Lunar.ICE_PLATEAU_TELEPORT, NONE) { player, _ ->
|
||||
requires(player,89, arrayOf(Item(Items.ASTRAL_RUNE_9075,3), Item(Items.LAW_RUNE_563,3), Item(Items.WATER_RUNE_555,8)))
|
||||
player.getAudioManager().send(Audio(200), true)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
sendTeleport(player,96.0, Location.create(2972, 3873, 0))
|
||||
}
|
||||
|
||||
onCast(Lunar.ICE_PLATEAU_GR_TELEPORT, NONE) { player, _ ->
|
||||
requires(player,90, arrayOf(Item(Items.ASTRAL_RUNE_9075,3), Item(Items.LAW_RUNE_563,3), Item(Items.WATER_RUNE_555,16)))
|
||||
player.getAudioManager().send(Audio(200), true)
|
||||
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
|
||||
sendGroupTeleport(player,99.0, "Ice Plateau", Location.create(2972, 3873, 0))
|
||||
}
|
||||
|
||||
|
|
@ -468,7 +469,9 @@ class LunarListeners : SpellListener("lunar"), Commands {
|
|||
}
|
||||
requires(player, 83, arrayOf(Item(Items.ASTRAL_RUNE_9075, 3), Item(Items.NATURE_RUNE_561, 2), Item(Items.EARTH_RUNE_557, 15)))
|
||||
removeRunes(player, true)
|
||||
visualizeSpell(player, FERTILE_SOIL_ANIM, FERTILE_SOIL_GFX, 2891)
|
||||
animate(player, FERTILE_SOIL_ANIM)
|
||||
sendGraphics(FERTILE_SOIL_GFX, target.location)
|
||||
playGlobalAudio(target.location, Sounds.LUNAR_FERTILIZE_2891)
|
||||
patch.compost = CompostType.SUPER
|
||||
sendMessage(player, "You fertilize the soil.")
|
||||
addXP(player, 87.0)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ 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.SpellBookManager.SpellBook;
|
||||
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;
|
||||
|
|
@ -23,6 +22,8 @@ import core.plugin.Plugin;
|
|||
import org.rs09.consts.Items;
|
||||
import org.rs09.consts.Sounds;
|
||||
|
||||
import static core.api.ContentAPIKt.*;
|
||||
|
||||
/**
|
||||
* Handles the god spells.
|
||||
* @author Emperor
|
||||
|
|
@ -192,19 +193,19 @@ public final class GodSpells extends CombatSpell {
|
|||
if (state.getEstimatedHit() == -1) {
|
||||
target.graphics(SPLASH_GRAPHIC);
|
||||
if (projectile == SARA_PROJECTILE) {
|
||||
sendAudio(target, new Audio(Sounds.SARADOMIN_STRIKE_FAIL_1656, 1, 20));
|
||||
playGlobalAudio(target.getLocation(), Sounds.SARADOMIN_STRIKE_FAIL_1656, 1, 20);
|
||||
}
|
||||
if (projectile == GUTHIX_PROJECTILE) {
|
||||
sendAudio(target, new Audio(Sounds.CLAWS_OF_GUTHIX_FAIL_1652, 1, 20));
|
||||
playGlobalAudio(target.getLocation(), Sounds.CLAWS_OF_GUTHIX_FAIL_1652, 1, 20);
|
||||
}
|
||||
if (projectile == ZAM_PROJECTILE) {
|
||||
sendAudio(target, new Audio(Sounds.FLAMES_OF_ZAMORAK_FAIL_1654, 1, 20));
|
||||
playGlobalAudio(target.getLocation(), Sounds.FLAMES_OF_ZAMORAK_FAIL_1654, 1, 20);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
target.graphics(endGraphic);
|
||||
sendAudio(entity, new Audio(impactAudio, 1));
|
||||
playGlobalAudio(target.getLocation(), impactAudio, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public final class TeleblockSpell extends CombatSpell {
|
|||
projectile.transform(entity, (Entity) target, false, 58, 10).send();
|
||||
}
|
||||
entity.animate(animation);
|
||||
sendAudio(entity, audio);
|
||||
playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,24 +1,21 @@
|
|||
package content.global.skill.thieving
|
||||
|
||||
import content.global.skill.skillcapeperks.SkillcapePerks
|
||||
import core.api.stun
|
||||
import core.api.*
|
||||
import core.game.node.entity.combat.ImpactHandler
|
||||
import core.game.node.entity.impl.Animator
|
||||
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.world.update.flag.context.Animation
|
||||
import core.tools.RandomFunction
|
||||
import org.rs09.consts.Items
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.interaction.IntType
|
||||
import core.tools.secondsToTicks
|
||||
import org.rs09.consts.Sounds
|
||||
|
||||
class ThievingListeners : InteractionListener {
|
||||
|
||||
private val PICKPOCKET_ANIM = Animation(881,Animator.Priority.HIGH)
|
||||
private val NPC_ANIM = Animation(422)
|
||||
private val SUCCESS = Audio(2581, 1, 0)
|
||||
|
||||
override fun defineListeners() {
|
||||
|
||||
|
|
@ -56,8 +53,7 @@ class ThievingListeners : InteractionListener {
|
|||
node.asNpc().face(player)
|
||||
node.asNpc().animator.animate(NPC_ANIM)
|
||||
|
||||
val hitSoundId = 518 + RandomFunction.random(4) // choose 1 of 4 possible hit noises
|
||||
player.audioManager.send(hitSoundId, 1, 20) // OSRS defines a delay of 20
|
||||
playHurtAudio(player, 20)
|
||||
|
||||
stun(player, pickpocketData.stunTime)
|
||||
|
||||
|
|
@ -65,7 +61,7 @@ class ThievingListeners : InteractionListener {
|
|||
|
||||
node.asNpc().face(null)
|
||||
} else {
|
||||
player.audioManager.send(SUCCESS)
|
||||
playAudio(player, Sounds.PICK_2581)
|
||||
player.lock(2)
|
||||
pickpocketData.table.roll().forEach { player.inventory.add(it) }
|
||||
player.skills.addExperience(Skills.THIEVING,pickpocketData.experience)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import core.game.world.update.flag.context.Animation
|
|||
import core.game.world.update.flag.context.Graphics
|
||||
import core.tools.RandomFunction
|
||||
import core.game.world.GameWorld
|
||||
import org.rs09.consts.Sounds
|
||||
|
||||
/**
|
||||
* Represents a utilitity class for rune essence teleporting.
|
||||
|
|
@ -57,7 +58,7 @@ object EssenceTeleport {
|
|||
npc.faceTemporary(player, 1)
|
||||
npc.graphics(GLOWING_HANDS_GFX)
|
||||
lock(player,4)
|
||||
player.audioManager.send(125)
|
||||
playGlobalAudio(player.location, Sounds.CURSE_ALL_125, 1)
|
||||
Projectile.create(npc, player, CURSE_PROJECTILE).send()
|
||||
npc.sendChat("Senventior Disthine Molenko!")
|
||||
GameWorld.Pulser.submit(object : Pulse(1) {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ import core.plugin.Initializable;
|
|||
import core.tools.RandomFunction;
|
||||
import org.rs09.consts.Sounds;
|
||||
|
||||
import static core.api.ContentAPIKt.impact;
|
||||
import static core.api.ContentAPIKt.playAudio;
|
||||
|
||||
/**
|
||||
* The desert zone map.
|
||||
* @author Emperor
|
||||
|
|
@ -76,7 +79,7 @@ public final class DesertZone extends MapZone implements Plugin<Object> {
|
|||
if (drink(p)) {
|
||||
return;
|
||||
}
|
||||
p.getImpactHandler().manualHit(p, RandomFunction.random(1, p.getLocation().getY() < 2990 ? 12 : 8), HitsplatType.NORMAL);
|
||||
impact(p, RandomFunction.random(1, p.getLocation().getY() < 2990 ? 12 : 8), HitsplatType.NORMAL);
|
||||
p.getPacketDispatch().sendMessage("You start dying of thirst while you're in the desert.");
|
||||
}
|
||||
|
||||
|
|
@ -105,7 +108,7 @@ public final class DesertZone extends MapZone implements Plugin<Object> {
|
|||
p.getInventory().add(new Item(i.getId() + 2));
|
||||
p.animate(ANIMATION);
|
||||
p.getPacketDispatch().sendMessage("You take a drink of water.");
|
||||
p.getAudioManager().send(Sounds.LIQUID_2401, 1);
|
||||
playAudio(p, Sounds.LIQUID_2401, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ import core.game.world.map.RegionManager;
|
|||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Initializable;
|
||||
import core.tools.RandomFunction;
|
||||
import org.rs09.consts.Sounds;
|
||||
|
||||
import static core.api.ContentAPIKt.playAudio;
|
||||
import static core.api.ContentAPIKt.playHurtAudio;
|
||||
|
||||
/**
|
||||
* Represents the abstract draynor tree npc.
|
||||
|
|
@ -65,7 +69,9 @@ public final class DraynorTreeNPC extends AbstractNPC {
|
|||
for (Player p : players) {
|
||||
faceTemporary(p, 2);
|
||||
getAnimator().forceAnimation(ANIMATION);
|
||||
playAudio(p, Sounds.NASTY_TREE_ATTACK_651);
|
||||
int hit = RandomFunction.random(2);
|
||||
if (hit > 0) playHurtAudio(p, 20);
|
||||
p.getImpactHandler().manualHit(this, hit, hit > 0 ? HitsplatType.NORMAL : HitsplatType.MISS);
|
||||
attackDelay = GameWorld.getTicks() + 3;
|
||||
p.animate(p.getProperties().getDefenceAnimation());
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import kotlinx.coroutines.launch
|
|||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.NPCs
|
||||
import content.region.morytania.quest.naturespirit.NSUtils
|
||||
import org.rs09.consts.Sounds
|
||||
|
||||
@Initializable
|
||||
class MortMyreGhastNPC : AbstractNPC {
|
||||
|
|
@ -75,6 +76,7 @@ class MortMyreGhastNPC : AbstractNPC {
|
|||
break
|
||||
}
|
||||
}
|
||||
playAudio(player, Sounds.GHAST_ATTACK_433)
|
||||
|
||||
if(!hasFood && RandomFunction.roll(3)) {
|
||||
sendMessage(player, "An attacking Ghast just misses you.")
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import org.rs09.consts.Items
|
|||
import core.game.interaction.InteractionListener
|
||||
import core.game.interaction.IntType
|
||||
import core.game.world.GameWorld.Pulser
|
||||
import org.rs09.consts.Sounds
|
||||
|
||||
private const val LOADER = 11162
|
||||
private const val BONE_GRINDER = 11163
|
||||
|
|
@ -92,6 +93,7 @@ class BoneGrinderListener : InteractionListener {
|
|||
0 -> {
|
||||
lock(player, FILL_ANIM.duration)
|
||||
animate(player, FILL_ANIM)
|
||||
playAudio(player, Sounds.FILL_GRINDER_1133)
|
||||
}
|
||||
FILL_ANIM.duration -> {
|
||||
sendMessage(player,"You fill the hopper with bones.")
|
||||
|
|
@ -173,6 +175,7 @@ class BoneGrinderListener : InteractionListener {
|
|||
lock(player, WIND_ANIM.duration)
|
||||
animate(player, WIND_ANIM)
|
||||
sendMessage(player,"You wind the handle.")
|
||||
playAudio(player, Sounds.GRINDER_GRINDING_1131)
|
||||
}
|
||||
WIND_ANIM.duration -> {
|
||||
sendMessage(player,"The bonemeal falls into the bin.")
|
||||
|
|
@ -233,6 +236,7 @@ class BoneGrinderListener : InteractionListener {
|
|||
0 -> {
|
||||
face(player,Location(3658, 3525, 1))
|
||||
animate(player, SCOOP_ANIM)
|
||||
playAudio(player, Sounds.GRINDER_EMPTY_1136)
|
||||
}
|
||||
SCOOP_ANIM.duration -> {
|
||||
if(removeItem(player,Item(Items.EMPTY_POT_1931),Container.INVENTORY)){
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import core.plugin.Initializable;
|
|||
import core.plugin.Plugin;
|
||||
import org.rs09.consts.NPCs;
|
||||
import core.plugin.ClassScanner;
|
||||
import org.rs09.consts.Sounds;
|
||||
|
||||
/**
|
||||
* Handles the phasmatys zone area.
|
||||
|
|
@ -333,6 +334,7 @@ public final class PhasmatysZone extends MapZone implements Plugin<Object> {
|
|||
if (player.getInventory().remove(bone.getBoneMeal(), new Item(4286, 1))) {
|
||||
player.lock(1);
|
||||
player.animate(Animation.create(1651));
|
||||
playAudio(player, Sounds.PRAYER_BOOST_2671);
|
||||
player.getInventory().add(new Item(1925), new Item(1931));
|
||||
player.getSkills().addExperience(Skills.PRAYER, bone.getExperience() * 4, true);
|
||||
player.sendMessage("You put some ectoplasm and bonemeal into the Ectofuntus, and worship it.");
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@ import core.net.packet.out.MusicPacket
|
|||
import core.game.system.timer.*
|
||||
import core.game.system.timer.impl.*
|
||||
import core.game.node.entity.combat.CombatSwingHandler
|
||||
import core.net.packet.context.DefaultContext
|
||||
import core.net.packet.out.AudioPacket
|
||||
import org.rs09.consts.Sounds
|
||||
import java.util.regex.*
|
||||
import java.io.*
|
||||
import kotlin.math.*
|
||||
|
|
@ -576,6 +579,7 @@ fun playJingle(player: Player, jingleId: Int) {
|
|||
*/
|
||||
fun impact(entity: Entity, amount: Int, type: ImpactHandler.HitsplatType = ImpactHandler.HitsplatType.NORMAL) {
|
||||
entity.impactHandler.manualHit(entity, amount, type)
|
||||
if (entity is Player) playHurtAudio(entity)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -822,18 +826,56 @@ fun playAudio(player: Player, audio: Audio, global: Boolean = false) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Plays the given Audio for the given Entity
|
||||
* @param player the player to play the audio for
|
||||
* @param audio the audio to play
|
||||
* @param 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
|
||||
* Plays audio for the player
|
||||
* @param player the player to play the defined audio for
|
||||
* @param audio the audio id to play
|
||||
* @param volume the volume for the audio (for some audio ids it is used to define how many times to play/loop the audio)
|
||||
* @param delay the delay in client cycles (50 cycles = 1 second)
|
||||
* @param global if other nearby players should be able to hear the audio
|
||||
* @param location the location where the audio will play from (if a location is defined the sound will fade with distance)
|
||||
* @param radius the distance the audio can be heard from the defined location (default = 8 tiles if undefined)
|
||||
*/
|
||||
@JvmOverloads
|
||||
fun playAudio(player: Player, audio: Int, volume: Int = 10, delay: Int = 0, global: Boolean = false, location: Location? = null, radius: Int = 15) {
|
||||
player.audioManager.send(audio, volume, delay, global, location, radius)
|
||||
fun playAudio(player: Player, audio: Int, volume: Int = 10, delay: Int = 0, global: Boolean = false, location: Location? = null, radius: Int = 8) {
|
||||
if (global) {
|
||||
val nearbyPlayers = RegionManager.getLocalPlayers(location ?: player.location, radius)
|
||||
for ( player in nearbyPlayers ) {
|
||||
PacketRepository.send(AudioPacket::class.java, DefaultContext(player, Audio(audio, volume, delay, radius), location))
|
||||
}
|
||||
} else {
|
||||
PacketRepository.send(AudioPacket::class.java, DefaultContext(player, Audio(audio, volume, delay, radius), location))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays audio for players near a defined location
|
||||
* @param location the location where the audio will play from (The sound will fade with distance)
|
||||
* @param audio the audio id to play
|
||||
* @param volume the volume for the audio (for some audio ids it is used to define how many times to play/loop the audio)
|
||||
* @param delay the delay in client cycles (50 cycles = 1 second)
|
||||
* @param radius the distance the audio can be heard from the defined location (default = 8 tiles if undefined)
|
||||
*/
|
||||
@JvmOverloads
|
||||
fun playGlobalAudio(location: Location, audio: Int, volume: Int = 10, delay: Int = 0, radius: Int = 8) {
|
||||
val nearbyPlayers = RegionManager.getLocalPlayers(location, radius)
|
||||
for (player in nearbyPlayers) {
|
||||
PacketRepository.send(AudioPacket::class.java, DefaultContext(player, Audio(audio, volume, delay, radius), location))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays a random hurt audio for the player based on gender
|
||||
* @param player the player to play hurt audio for
|
||||
* @param delay the delay in client cycles (50 cycles = 1 second)
|
||||
*/
|
||||
fun playHurtAudio(player: Player, delay: Int = 0) {
|
||||
val maleHurtAudio = intArrayOf(Sounds.HUMAN_HIT4_516, Sounds.HUMAN_HIT5_517, Sounds.HUMAN_HIT_518, Sounds.HUMAN_HIT_6_522)
|
||||
val femaleHurtAudio = intArrayOf(Sounds.FEMALE_HIT_506, Sounds.FEMALE_HIT_507, Sounds.FEMALE_HIT2_508, Sounds.FEMALE_HIT_2_510)
|
||||
if (player.isMale) {
|
||||
playAudio(player, maleHurtAudio.random(), 10, delay)
|
||||
} else {
|
||||
playAudio(player, femaleHurtAudio.random(), 10, delay)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import core.game.node.entity.combat.equipment.WeaponInterface
|
|||
import core.game.node.entity.impl.Animator
|
||||
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.skill.Skills
|
||||
import core.game.node.item.Item
|
||||
import core.game.system.task.Pulse
|
||||
|
|
@ -446,12 +445,10 @@ class CombatPulse(
|
|||
val n = victim.asNpc()
|
||||
val audio = n.getAudio(1)
|
||||
if (audio != null) {
|
||||
entity.asPlayer().audioManager.send(audio, true)
|
||||
playGlobalAudio(victim.location, audio.id)
|
||||
}
|
||||
} else if (state.estimatedHit != 0 && victim is Player) {
|
||||
val sounds = intArrayOf(516, 517, 518)
|
||||
val audio = Audio(sounds[RandomFunction.random(sounds.size)])
|
||||
audio.send(victim.asPlayer(), true)
|
||||
playHurtAudio(victim.asPlayer())
|
||||
}
|
||||
handler.impact(entity, victim, state)
|
||||
handler.onImpact(entity, victim, state)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import core.game.node.entity.player.link.prayer.PrayerType
|
|||
import core.game.node.entity.skill.Skills
|
||||
import content.global.skill.summoning.familiar.Familiar
|
||||
import core.api.log
|
||||
import core.api.playGlobalAudio
|
||||
import core.game.world.map.Direction
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.RegionManager
|
||||
|
|
@ -20,9 +21,9 @@ import core.game.world.map.path.Pathfinder
|
|||
import core.game.world.map.path.Pathfinder.*
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.tools.RandomFunction
|
||||
import core.tools.SystemLogger
|
||||
import core.game.system.config.ItemConfigParser
|
||||
import core.tools.Log
|
||||
import org.rs09.consts.Sounds
|
||||
import java.util.*
|
||||
import kotlin.math.floor
|
||||
|
||||
|
|
@ -357,10 +358,11 @@ abstract class CombatSwingHandler(var type: CombatStyle?) {
|
|||
if (audio == null || audio.id == 0) {
|
||||
audio = audios[0]
|
||||
}
|
||||
entity.asPlayer().audioManager.send(audio, true, entity.location)
|
||||
playGlobalAudio(entity.location, audio.id)
|
||||
}
|
||||
} else {
|
||||
entity.asPlayer().audioManager.send(2564)
|
||||
} else if (type == CombatStyle.MELEE) {
|
||||
//plays a punching sound when no weapon is equipped
|
||||
playGlobalAudio(entity.location, Sounds.HUMAN_ATTACK_2564)
|
||||
}
|
||||
} else if (entity is NPC && victim is Player) {
|
||||
val npc = entity.asNpc()
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ import core.game.system.task.Pulse;
|
|||
import core.game.world.GameWorld;
|
||||
import core.game.world.map.Location;
|
||||
|
||||
import static core.api.ContentAPIKt.playGlobalAudio;
|
||||
|
||||
/**
|
||||
* Handles an entity death task.
|
||||
* @author Emperor
|
||||
|
|
@ -51,7 +53,7 @@ public final class DeathTask extends NodeTask {
|
|||
Player p = killer.asPlayer();
|
||||
Audio audio = e.asNpc().getAudio(2);
|
||||
if (audio != null) {
|
||||
audio.send(p, true);
|
||||
playGlobalAudio(e.getLocation(), audio.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ import org.rs09.consts.Sounds;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static core.api.ContentAPIKt.playGlobalAudio;
|
||||
|
||||
/**
|
||||
* Represents a combat magic spell.
|
||||
* @author Emperor
|
||||
|
|
@ -134,12 +136,12 @@ public abstract class CombatSpell extends MagicSpell {
|
|||
*/
|
||||
public void visualizeImpact(Entity entity, Entity target, BattleState state) {
|
||||
if (state.getEstimatedHit() == -1) {
|
||||
sendAudio(target, new Audio(Sounds.SPELLFAIL_227, 1, 20));
|
||||
playGlobalAudio(target.getLocation(), Sounds.SPELLFAIL_227, 1, 20);
|
||||
target.graphics(SPLASH_GRAPHIC);
|
||||
return;
|
||||
}
|
||||
target.graphics(endGraphic);
|
||||
sendAudio(target, new Audio(impactAudio, 1, 20));
|
||||
playGlobalAudio(target.getLocation(), impactAudio, 1, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -171,7 +173,7 @@ public abstract class CombatSpell extends MagicSpell {
|
|||
entity.animate(animation);
|
||||
}
|
||||
}
|
||||
sendAudio(entity);
|
||||
playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ import core.game.node.entity.player.link.SpellBookManager.SpellBook;
|
|||
import core.game.node.entity.player.link.audio.Audio;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.GameWorld;
|
||||
import core.game.world.map.MapDistance;
|
||||
import core.game.world.map.RegionManager;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.game.world.update.flag.context.Graphics;
|
||||
import core.plugin.Plugin;
|
||||
|
|
@ -22,6 +20,9 @@ import core.tools.RandomFunction;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static core.api.ContentAPIKt.playAudio;
|
||||
import static core.api.ContentAPIKt.playGlobalAudio;
|
||||
|
||||
/**
|
||||
* Represents a magic spell.
|
||||
* @author Emperor
|
||||
|
|
@ -160,7 +161,7 @@ public abstract class MagicSpell implements Plugin<SpellType> {
|
|||
public void visualize(Entity entity, Node target) {
|
||||
entity.graphics(graphic);
|
||||
entity.animate(animation);
|
||||
sendAudio(entity);
|
||||
playGlobalAudio(entity.getLocation(), audio.getId(), 1, 20);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -332,30 +333,6 @@ public abstract class MagicSpell implements Plugin<SpellType> {
|
|||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the Audio packet for all players to hear (in a distance specified
|
||||
* by ).
|
||||
* @param entity The entity from where this Audio comes from.
|
||||
*/
|
||||
public void sendAudio(Entity entity) {
|
||||
sendAudio(entity, audio);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the Audio packet for all players to hear (in a distance specified
|
||||
* by ).
|
||||
* @param entity The entity from where this Audio comes from.
|
||||
* @param audio The Audio to send.
|
||||
*/
|
||||
public void sendAudio(Entity entity, Audio audio) {
|
||||
if (audio == null || audio.getId() < 0) {
|
||||
return;
|
||||
}
|
||||
for (Player p : RegionManager.getLocalPlayers(entity, MapDistance.SOUND.getDistance())) {
|
||||
p.getAudioManager().send(audio);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object fireEvent(String identifier, Object... args) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class Audio {
|
|||
/**
|
||||
* The default radius in tiles of positional audio in [0,16).
|
||||
*/
|
||||
public static final int RADIUS = 15;
|
||||
public static final int RADIUS = 8;
|
||||
|
||||
/**
|
||||
* The id of the audio piece.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ 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.MapDistance;
|
||||
import core.game.world.map.RegionManager;
|
||||
import core.net.packet.PacketRepository;
|
||||
import core.net.packet.context.DefaultContext;
|
||||
|
|
@ -92,14 +91,19 @@ public class AudioManager {
|
|||
/**
|
||||
* Sends an audio packet.
|
||||
* @param audio the audio.
|
||||
* @param global if globally heard.
|
||||
* @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) {
|
||||
send(audio, RegionManager.getLocalPlayers(player, MapDistance.SOUND.getDistance()), loc);
|
||||
return;
|
||||
}
|
||||
PacketRepository.send(AudioPacket.class, new DefaultContext(player, audio, loc));
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -116,19 +120,6 @@ 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.
|
||||
* @return the player
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue