diff --git a/Server/src/main/java/core/game/content/consumable/Consumable.java b/Server/src/main/java/core/game/content/consumable/Consumable.java index 789099637..a3e82ff3f 100644 --- a/Server/src/main/java/core/game/content/consumable/Consumable.java +++ b/Server/src/main/java/core/game/content/consumable/Consumable.java @@ -1,5 +1,7 @@ package core.game.content.consumable; +import api.Container; +import api.ContentAPI; import core.game.node.entity.player.Player; import core.game.node.item.Item; import core.game.world.update.flag.context.Animation; @@ -46,10 +48,13 @@ public abstract class Consumable implements Plugin { public void consume(final Item item, final Player player) { executeConsumptionActions(player); final int nextItemId = getNextItemId(item.getId()); + + if(item.getAmount() > 1){ + ContentAPI.removeItem(player, item.getId(), Container.INVENTORY); + } else ContentAPI.removeItem(player, item, Container.INVENTORY); + if (nextItemId != -1) { - player.getInventory().replace(new Item(nextItemId), item.getSlot()); - } else { - player.getInventory().remove(item); + ContentAPI.addItem(player, nextItemId, 1); } final int initialLifePoints = player.getSkills().getLifepoints(); Consumables.getConsumableById(item.getId()).effect.activate(player); diff --git a/Server/src/main/java/core/game/content/consumable/Consumables.java b/Server/src/main/java/core/game/content/consumable/Consumables.java index cef113324..0a618a18f 100644 --- a/Server/src/main/java/core/game/content/consumable/Consumables.java +++ b/Server/src/main/java/core/game/content/consumable/Consumables.java @@ -285,7 +285,7 @@ public enum Consumables { /** Miscellaneous */ CHOCOLATE_BAR(new Food(new int[] {1973}, new HealingEffect(3))), PURPLE_SWEETS(new Food(new int[] {4561}, new HealingEffect(0))), - PURPLE_SWEETS_STACKABLE(new Food(new int[] {10476, 10476}, new MultiEffect(new EnergyEffect(10), new RandomHealthEffect(1, 3)), "The sugary goodness heals some energy.", "The sugary goodness is yummy.")), + PURPLE_SWEETS_STACKABLE(new Food(new int[] {10476}, new MultiEffect(new EnergyEffect(10), new RandomHealthEffect(1, 3)), "The sugary goodness heals some energy.", "The sugary goodness is yummy.")), FIELD_RATION(new Food(new int[] {7934}, new HealingEffect(10))), ROLL(new Food(new int[] {6963}, new HealingEffect(6))), TCHIKI_MONKEY_NUTS(new Food(new int[] {7573}, new HealingEffect(5), "You eat the Tchiki monkey nuts. They taste nutty.")), diff --git a/Server/src/main/java/core/game/node/entity/skill/slayer/SlayerManager.java b/Server/src/main/java/core/game/node/entity/skill/slayer/SlayerManager.java index d9bb373c9..ba749d6b1 100644 --- a/Server/src/main/java/core/game/node/entity/skill/slayer/SlayerManager.java +++ b/Server/src/main/java/core/game/node/entity/skill/slayer/SlayerManager.java @@ -113,10 +113,10 @@ public final class SlayerManager { flags.setCompletedTasks(flags.getCompletedTasks() + 1); if ((flags.getCompletedTasks() > 4 || flags.canEarnPoints() ) && flags.getMaster() != Master.TURAEL && flags.getPoints() < 64000) { int points = flags.getMaster().getTaskPoints()[0]; - if (flags.getTaskStreak() % 10 == 0) { - points = flags.getMaster().getTaskPoints()[1]; - } else if (flags.getTaskStreak() % 50 == 0) { + if (flags.getTaskStreak() % 50 == 0) { points = flags.getMaster().getTaskPoints()[2]; + } else if (flags.getTaskStreak() % 10 == 0) { + points = flags.getMaster().getTaskPoints()[1]; } flags.incrementPoints(points); if (flags.getPoints() > 64000) { diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/MorytaniaListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/region/MorytaniaListeners.kt index 3547a1ed3..ca4edd9cb 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/region/MorytaniaListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/region/MorytaniaListeners.kt @@ -1,10 +1,13 @@ package rs09.game.interaction.region -import core.game.node.entity.impl.ForceMovement -import core.game.world.map.Direction +import api.ContentAPI +import core.game.node.entity.skill.agility.AgilityHandler +import core.game.system.task.Pulse import core.game.world.map.Location import core.game.world.update.flag.context.Animation +import core.game.world.update.flag.context.Graphics import rs09.game.interaction.InteractionListener +import kotlin.random.Random /** * File to be used for anything Morytania related. @@ -19,8 +22,12 @@ class MorytaniaListeners : InteractionListener() { val GROTTO_BRIDGE = 3522 val outside = Location.create(3439, 3337, 0) val inside = Location.create(3442, 9734, 1) - private val RUNNING_ANIM = Animation(1995) - private val JUMP_ANIM = Animation(1603) + + private val swimAnim = Animation(6988) + private val jumpAnim = Animation(1603) + private val failWater = Location(3439,3330) + private val failMessage = "You nearly drown in the disgusting swamp." + private val splashGFX = Graphics(68) override fun defineListeners() { /* on(GROTTO_ENTRANCE,SCENERY,"enter"){ player, node -> @@ -34,10 +41,36 @@ class MorytaniaListeners : InteractionListener() { } on(GROTTO_BRIDGE,SCENERY,"jump"){ player, node -> - if (player.location.y == 3328) { - ForceMovement.run(player, node.location, node.location.transform(0, 3, 0), RUNNING_ANIM, JUMP_ANIM, Direction.NORTH, 15).endAnimation = Animation.RESET - } else if (player.location.y == 3332){ - ForceMovement.run(player, node.location, node.location.transform(0, -3, 0), RUNNING_ANIM, JUMP_ANIM, Direction.SOUTH, 15).endAnimation = Animation.RESET + val start = node.location + var failLand = Location(3438,3331) + var failAnim = Animation(770) + var fromGrotto = false + + ContentAPI.lock(player,10) + + // Switch to south facing animations if jumping from Grotto + if (start.y == 3331) { + fromGrotto = true + failAnim = Animation(771) + failLand = Location(3438,3328) + } + if (AgilityHandler.hasFailed(player, 1, 0.1)) { + val end = if (fromGrotto) failWater else start + AgilityHandler.forceWalk(player, -1, start, end, failAnim, 15, 0.0, null,0).endAnimation = swimAnim + AgilityHandler.forceWalk(player, -1, failWater, failLand, swimAnim, 15, 2.0, null,3) + ContentAPI.submitIndividualPulse(player, object : Pulse(2){ + override fun pulse(): Boolean { + ContentAPI.visualize(player,failAnim,splashGFX) + ContentAPI.teleport(player,failWater) + // Deal 1-6 damage but wait until the player is back on land + AgilityHandler.fail(player,0,failLand,swimAnim,Random.nextInt(1,7),failMessage) + return true + } + }) + } + else{ + val end = if (fromGrotto) start.transform(0,-3,0) else start.transform(0,3,0) + AgilityHandler.forceWalk(player, -1, start, end, jumpAnim, 15, 15.0, null,0) } return@on true }