From defe780c39b45eebd3a457d47f1d738546d43367 Mon Sep 17 00:00:00 2001 From: Zerken Date: Sun, 23 Jul 2023 14:40:08 +0000 Subject: [PATCH] Agility Pyramid Fixes Can now properly fail the jump and cross gap obstacles Fixed an issue when failing the the 2nd level north cross gap obstacle when going west causing the player to get stuck inside the pyramid Fixed jump/cross gap obstacle sounds Fixed moving block obstacle audio so the sliding sound plays for all players within 3-4 tiles of the block when it moves Implemented music/jingle that plays when you get the pyramid top Updated all agility pyramid sounds to use the new playAudio ContentAPI function and constlib Added inauthentic gold reward from selling pyramid tops to Simon Templeton based on agility level. GP reward = 1000 + ((agility level / 99) * 9000). Can be toggled with server config option better_agility_pyramid_gp --- .../agility/pyramid/AgilityPyramidCourse.java | 33 ++++++++++--------- .../skill/agility/pyramid/MovingBlockNPC.java | 9 +++-- .../desert/dialogue/SimonTempleton.java | 21 +++++++----- Server/src/main/core/ServerConstants.kt | 3 ++ .../game/system/config/ServerConfigParser.kt | 1 + Server/worldprops/default.conf | 2 ++ 6 files changed, 42 insertions(+), 27 deletions(-) diff --git a/Server/src/main/content/global/skill/agility/pyramid/AgilityPyramidCourse.java b/Server/src/main/content/global/skill/agility/pyramid/AgilityPyramidCourse.java index c2d4a6a2c..b52dc1d03 100644 --- a/Server/src/main/content/global/skill/agility/pyramid/AgilityPyramidCourse.java +++ b/Server/src/main/content/global/skill/agility/pyramid/AgilityPyramidCourse.java @@ -18,6 +18,7 @@ import core.game.world.map.Direction; import core.game.world.map.Location; import core.game.world.update.flag.context.Animation; import core.plugin.ClassScanner; +import org.rs09.consts.Sounds; import static core.api.ContentAPIKt.*; @@ -195,7 +196,7 @@ public final class AgilityPyramidCourse extends AgilityCourse { player.getPacketDispatch().sendMessage("You must be level 30 agility or higher to climb down the rocks."); return; } - player.getAudioManager().send(2454, 6); + playAudio(player, Sounds.CLIMBING_LOOP_2454, 6); if (!scale) { ForceMovement.run(player, player.getLocation(), end, Animation.create(740), Animation.create(740), Direction.WEST, 13).setEndAnimation(Animation.RESET); } else { @@ -225,12 +226,12 @@ public final class AgilityPyramidCourse extends AgilityCourse { if (fail) { Location end = player.getLocation().transform(d, 1); player.lock(3); - player.getAudioManager().send(1397, 10, 25); + 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; } - player.getAudioManager().send(2453,10, 40); + 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); } @@ -247,10 +248,10 @@ public final class AgilityPyramidCourse extends AgilityCourse { final boolean fail = player.getSkills().getLevel(Skills.AGILITY) < 75 && hasFailed(player); final Location end = player.getLocation().transform(dir.getStepX() * (fail ? 3 : 5), dir.getStepY() * (fail ? 3 : 5), 0); player.getPacketDispatch().sendMessage("You put your foot on the ledge and try to edge across..."); - player.getAudioManager().send(2451, 5); + playAudio(player, Sounds.BALANCING_LEDGE_2451, 5); if (fail) { player.lock(4); - player.getAudioManager().send(2455, 10, 125); + playAudio(player, Sounds.FALL_LAND_2455, 10, 125); AgilityHandler.walk(player, -1, player.getLocation(), end, Animation.create(157 - diff), 0.0, "You slip and fall to the level below."); GameWorld.getPulser().submit(new Pulse(3, player) { @Override @@ -297,13 +298,13 @@ public final class AgilityPyramidCourse extends AgilityCourse { final boolean fail = player.getSkills().getLevel(Skills.AGILITY) >= 75 ? false : hasFailed(player) ; final Location end = object.getLocation().transform(object.getId() != 10868 ? dir : dir.getOpposite(), fail ? 2 : 5); AgilityHandler.walk(player, fail ? -1 : 1, player.getLocation(), end, Animation.create(155), fail ? 0.0 : 56.4, fail ? null : "You walk carefully across the slippery plank..."); - player.getAudioManager().send(2480, 3); + playAudio(player, Sounds.PLANKWALK_2480, 3); if (fail) { GameWorld.getPulser().submit(new Pulse(2, player) { @Override public boolean pulse() { final Location dest = transformLevel(end.transform(!custom ? 2 : 0, custom ? -2 : 0, 0)); - player.getAudioManager().send(2455, 10, 50); + playAudio(player, Sounds.FALL_LAND_2455, 10, 50); AgilityHandler.failWalk(player, 2, end, dest, dest, Animation.create(764), 10, 10, null); return true; } @@ -331,12 +332,13 @@ public final class AgilityPyramidCourse extends AgilityCourse { } dest = transformLevel(dest); player.lock(8); - player.getAudioManager().send(2463, 10, 30); + playAudio(player, Sounds.JUMP_NO_LAND_2467, 10, 30); + playAudio(player, Sounds.FALL_LAND_2455, 10, 200); AgilityHandler.forceWalk(player, -1, player.getLocation(), end, Animation.create(3068), 10, 0.0, "... and miss your footing."); - AgilityHandler.fail(player, 8, dest, null, 8, null); + AgilityHandler.fail(player, 8, dest, Animation.create(3068), 8, null); return; } - player.getAudioManager().send(2462, 10 , 30); + playAudio(player, Sounds.JUMP2_2462, 10 , 30); player.lock(4); AgilityHandler.forceWalk(player, 2, player.getLocation(), player.getLocation().transform(dir, 3), Animation.create(3067), 20, 22, null); } @@ -353,17 +355,17 @@ public final class AgilityPyramidCourse extends AgilityCourse { final int rot = object.getRotation(); int mod = player.getLocation().equals(new Location(3359, 2849, 2)) ? 0 : player.getLocation().equals(new Location(3357, 2841, 2)) ? 1 : player.getLocation().equals(new Location(3367, 2832, 1)) ? 1 : player.getLocation().equals(new Location(3372, 2832, 1)) ? 0 : object.getLocation().equals(new Location(3370, 2831, 1)) ? 0 : rot == 1 && dir == Direction.EAST ? 0 : rot == 3 && (dir == Direction.WEST || dir == Direction.EAST) ? 1 : rot == 0 && dir == Direction.SOUTH ? 1 : dir == Direction.WEST && rot != 3 || dir == Direction.EAST ? 1 : 0; final Animation animation = Animation.create(387 - mod); - player.getAudioManager().send(2450); - player.getAudioManager().send(2455, 10, 170); + playAudio(player, Sounds.HANDHOLDS_GRAB_TO_SECOND_2450); + playAudio(player, Sounds.FALL_LAND_2455, 10, 170); if (fail) { Location dest = object.getLocation().transform(dir, 1); - dest = rot == 1 && dir == Direction.EAST ? dest.transform(1, 2, 0) : rot == 1 && dir == Direction.WEST ? dest.transform(0, -2, 0) : dest.transform(dir == Direction.NORTH || dir == Direction.SOUTH ? -1 : dir == Direction.WEST ? 1 : 0, dir == Direction.SOUTH ? 1 : dir == Direction.WEST || dir == Direction.EAST ? -1 : 0, 0); + dest = rot == 1 && dir == Direction.EAST ? dest.transform(1, 2, 0) : rot == 1 && dir == Direction.WEST && player.getLocation().getY() < 2841 ? dest.transform(0, -2, 0) : rot == 1 && dir == Direction.WEST ? dest.transform(0, 2, 0): dest.transform(dir == Direction.NORTH || dir == Direction.SOUTH ? -1 : dir == Direction.WEST ? 1 : 0, dir == Direction.SOUTH ? 1 : dir == Direction.WEST || dir == Direction.EAST ? -1 : 0, 0); AgilityHandler.walk(player, -1, player.getLocation(), end, animation, 10, null); - AgilityHandler.fail(player, 3, transformLevel(dest), null, 8, null); - // player.animate(Animation.create(3056 - mod), 2); + Location finalDest = dest; GameWorld.getPulser().submit(new Pulse(3, player) { @Override public boolean pulse() { + AgilityHandler.fail(player, 3, transformLevel(finalDest), Animation.create(3056 - mod), 8, null); player.getAppearance().setDefaultAnimations(); player.getAppearance().sync(); return true; @@ -397,6 +399,7 @@ public final class AgilityPyramidCourse extends AgilityCourse { player.getSavedData().getActivityData().setTopGrabbed(true); player.getInventory().add(PYRAMID_TOP, player); player.getDialogueInterpreter().sendItemMessage(PYRAMID_TOP, "You find a golden pyramid!"); + playJingle(player, 151); return true; } }); diff --git a/Server/src/main/content/global/skill/agility/pyramid/MovingBlockNPC.java b/Server/src/main/content/global/skill/agility/pyramid/MovingBlockNPC.java index cce534d05..f709095d9 100644 --- a/Server/src/main/content/global/skill/agility/pyramid/MovingBlockNPC.java +++ b/Server/src/main/content/global/skill/agility/pyramid/MovingBlockNPC.java @@ -11,6 +11,9 @@ import core.game.world.map.Direction; import core.game.world.map.Location; import core.game.world.map.RegionManager; import core.game.world.update.flag.context.Animation; +import org.rs09.consts.Sounds; + +import static core.api.ContentAPIKt.playAudio; /** * The moving block npc. @@ -58,8 +61,9 @@ public final class MovingBlockNPC extends AbstractNPC { Location loc = getLocation().transform(dir, 2); getWalkingQueue().reset(); getWalkingQueue().addPath(loc.getX(), loc.getY()); - for (Player p : RegionManager.getLocalPlayers(getTileLocations()[0], 2)) { + for (Player p : RegionManager.getLocalPlayers(getTileLocations()[0], 4)) { checkBlock(p); + playAudio(p, Sounds.PYRAMID_BLOCK_1395, 10, 30); } moving = true; GameWorld.getPulser().submit(new Pulse(1, this) { @@ -133,8 +137,7 @@ public final class MovingBlockNPC extends AbstractNPC { } } player.lock(4); - player.getAudioManager().send(1395); - player.getAudioManager().send(2469, 10 , 40); + playAudio(player, Sounds.LAND_FLAT_2469, 10 , 50); player.setAttribute("block-move", GameWorld.getTicks() + 4); if(dest != null) { AgilityHandler.failWalk(player, close ? 1 : 3, player.getLocation(), dest, AgilityPyramidCourse.transformLevel(dest), Animation.create(3066), 10, 8, null, getId() == 3124 ? Direction.WEST : Direction.SOUTH); diff --git a/Server/src/main/content/region/desert/dialogue/SimonTempleton.java b/Server/src/main/content/region/desert/dialogue/SimonTempleton.java index 06267e58a..fe695172a 100644 --- a/Server/src/main/content/region/desert/dialogue/SimonTempleton.java +++ b/Server/src/main/content/region/desert/dialogue/SimonTempleton.java @@ -1,10 +1,15 @@ package content.region.desert.dialogue; +import core.ServerConstants; +import core.api.Container; import core.game.dialogue.DialoguePlugin; import core.game.node.entity.npc.NPC; import core.game.node.entity.player.Player; import core.plugin.Initializable; import core.game.node.item.Item; +import org.rs09.consts.Items; + +import static core.api.ContentAPIKt.*; /** * Handles the dialog for Simon Templeton @@ -39,7 +44,7 @@ public final class SimonTempleton extends DialoguePlugin { return true; } } - npc("G'day, mate!. Got any new", "pyramid artefacts for me?"); + npc("G'day, mate. Got any new", "pyramid artefacts for me?"); return true; } @@ -47,6 +52,8 @@ public final class SimonTempleton extends DialoguePlugin { public boolean handle(int interfaceId, int buttonId){ boolean hasArtefacts = false; boolean hasPyramidTopper = false; + int goldReward = 1000; + if (ServerConstants.BETTER_AGILITY_PYRAMID_GP) goldReward =(int)(1000 + ((getStatLevel(player, 16) / 99.0) * 9000)); switch(stage){ case 0: for(int i = 0; i < ARTIFACTS.length; i++){ @@ -92,7 +99,7 @@ public final class SimonTempleton extends DialoguePlugin { stage = 999; break; case 6: - npc("Hmmm, very nice. I'll buy them for 10k each."); + npc("Hmmm, very nice. I'll buy them for " + goldReward + " each."); stage = 7; break; case 7: @@ -102,13 +109,9 @@ public final class SimonTempleton extends DialoguePlugin { case 8: switch(buttonId){ case 1: - for(int j = 0; j < 28; j++){ - switch(player.getInventory().getId(j)){ - case 6970: - player.getInventory().remove(new Item(6970),j,true); - player.getInventory().add(new Item(995, 10000)); - break; - } + int pyramidTopsInInv = amountInInventory(player, Items.PYRAMID_TOP_6970); + if (removeItem(player, new Item(Items.PYRAMID_TOP_6970, pyramidTopsInInv), Container.INVENTORY)) { + addItem(player, Items.COINS_995, goldReward * pyramidTopsInInv, Container.INVENTORY); } end(); break; diff --git a/Server/src/main/core/ServerConstants.kt b/Server/src/main/core/ServerConstants.kt index 0f3826ec1..3d8def976 100644 --- a/Server/src/main/core/ServerConstants.kt +++ b/Server/src/main/core/ServerConstants.kt @@ -293,5 +293,8 @@ class ServerConstants { @JvmField var BOTSTOCK_LIMIT = 5000 + + @JvmField + var BETTER_AGILITY_PYRAMID_GP = true } } diff --git a/Server/src/main/core/game/system/config/ServerConfigParser.kt b/Server/src/main/core/game/system/config/ServerConfigParser.kt index 1ca8e70de..0dd445649 100644 --- a/Server/src/main/core/game/system/config/ServerConfigParser.kt +++ b/Server/src/main/core/game/system/config/ServerConfigParser.kt @@ -155,6 +155,7 @@ object ServerConfigParser { ServerConstants.PLAYER_STOCK_CLEAR_INTERVAL = data.getLong("world.playerstock_clear_mins", 180L).toInt() ServerConstants.PLAYER_STOCK_RECIRCULATE = data.getBoolean("world.playerstock_bot_offers", true) ServerConstants.BOTSTOCK_LIMIT = data.getLong("world.botstock_limit", 5000L).toInt() + ServerConstants.BETTER_AGILITY_PYRAMID_GP = data.getBoolean("world.better_agility_pyramid_gp", true) val logLevel = data.getString("server.log_level", "VERBOSE").uppercase() ServerConstants.LOG_LEVEL = parseEnumEntry(logLevel) ?: LogLevel.VERBOSE diff --git a/Server/worldprops/default.conf b/Server/worldprops/default.conf index c80e4c6e4..546549699 100644 --- a/Server/worldprops/default.conf +++ b/Server/worldprops/default.conf @@ -82,6 +82,8 @@ show_rules = true revenant_population = 30 #enable auto-buy/auto-sell on the GE. i_want_to_cheat = false +#better agility pyramid gp reward (gp reward = 1000 + ((agility level / 99) * 9000)) +better_agility_pyramid_gp = true [paths] #path to the data folder, which contains the cache subfolder and such