From 3f0c44b1c3b9d6c6b8b96a5139dbe84c35e4bdf2 Mon Sep 17 00:00:00 2001 From: randy Date: Fri, 11 Apr 2025 12:07:51 -0600 Subject: [PATCH] Firemaking improments Improved the firemaking repeat pulse. Logs are now consumed after the space is verified, preventing loss of logs when running out of room. Additionally, the timing has changed to match the animation better. Firemaking now also repeats when done by using a log on a pyrelord. This requires a tinderbox in your inventory, so that the pulse can be interrupted by dropping it. Also fixed the bug where pyrelords could light logs you didn't have the firemaking level for. --- .../skill/firemaking/FireMakingPulse.java | 27 +++++----- .../skill/summoning/familiar/PyreLordNPC.java | 49 ++++++++++++------- 2 files changed, 45 insertions(+), 31 deletions(-) diff --git a/Server/src/main/content/global/skill/firemaking/FireMakingPulse.java b/Server/src/main/content/global/skill/firemaking/FireMakingPulse.java index a2612543d..7d9f0b35d 100644 --- a/Server/src/main/content/global/skill/firemaking/FireMakingPulse.java +++ b/Server/src/main/content/global/skill/firemaking/FireMakingPulse.java @@ -91,9 +91,14 @@ public final class FireMakingPulse extends SkillPulse { if (player.getAttribute("remove-log", false)) { player.removeAttribute("remove-log"); if (inInventory(player, node.getId(), 1)) { - replaceSlot(player, node.getSlot(), new Item(node.getId(), (node.getAmount() - 1)), node, Container.INVENTORY); + //replaceSlot(player, node.getSlot(), new Item(node.getId(), (node.getAmount() - 1)), node, Container.INVENTORY); + // Snowscape, remove any item instead of specific slot, and update the grounditem with our new location. + removeItem(player, new Item(node.getId(), 1), Container.INVENTORY); + this.groundItem = new GroundItem(node, player.getLocation(), player); GroundItemManager.create(groundItem); - } + } else { + return false; + } } return true; } @@ -110,25 +115,21 @@ public final class FireMakingPulse extends SkillPulse { return true; } */ - if (ticks == 0) { + if (ticks % 5 == 0) { player.animate(ANIMATION); } - if (++ticks % 3 != 0) { + if (++ticks % 5 != 0) { return false; } - if (ticks % 12 == 0) { - player.animate(ANIMATION); - } + if (!success()) { return false; } createFire(); - // Snowscape: attempt to remove another log. If successful, the pulse continues and the player makes another fire - if (removeItem(player, new Item(node.getId(), 1), Container.INVENTORY)) { - return false; - } else { - return true; - } + // Snowscape: return with the remove-log attribute, so the next pulse attempts to remove another log and start over + player.setAttribute("remove-log", true); + return false; + } diff --git a/Server/src/main/content/global/skill/summoning/familiar/PyreLordNPC.java b/Server/src/main/content/global/skill/summoning/familiar/PyreLordNPC.java index c4672b643..1e96d0229 100644 --- a/Server/src/main/content/global/skill/summoning/familiar/PyreLordNPC.java +++ b/Server/src/main/content/global/skill/summoning/familiar/PyreLordNPC.java @@ -23,6 +23,8 @@ import core.game.world.update.flag.context.Animation; import core.game.world.update.flag.context.Graphics; import core.plugin.Plugin; import core.plugin.ClassScanner; +import org.rs09.consts.Items; +import static core.api.ContentAPIKt.inInventory; /** * Represents the Pyrelord familiar. @@ -117,30 +119,41 @@ public class PyreLordNPC extends Familiar { player.getPacketDispatch().sendMessage("You can't light a fire here."); return false; } - familiar.lock(ticks); - familiar.animate(FIREMAKE_ANIMATION); - if (player.getInventory().remove(event.getUsedItem())) { - final GroundItem ground = GroundItemManager.create(event.getUsedItem(), familiar.getLocation(), player); + if (player.getSkills().getLevel(Skills.FIREMAKING) < log.getLevel()) { + player.getPacketDispatch().sendMessage("You need a firemaking level of " + log.getLevel() + " to light this log."); + return false; + } + familiar.lock(ticks); + familiar.animate(FIREMAKE_ANIMATION); + // Snowscape: reworked this pulse to repeat GameWorld.getPulser().submit(new Pulse(ticks, player, familiar) { @Override public boolean pulse() { - if (!ground.isActive()) { - return true; - } - final Scenery object = new Scenery(log.getFireId(), familiar.getLocation()); - familiar.moveStep(); - GroundItemManager.destroy(ground); - player.getSkills().addExperience(Skills.FIREMAKING, log.getXp() + 10); - familiar.faceLocation(object.getFaceLocation(familiar.getLocation())); - SceneryBuilder.add(object, log.getLife(), FireMakingPulse.getAsh(player, log, object)); - if (player.getViewport().getRegion().getId() == 10806) { - player.getAchievementDiaryManager().finishTask(player, DiaryType.SEERS_VILLAGE, 1, 9); - } - return true; + if (player.getInventory().remove(event.getUsedItem())) { + //familiar.lock(ticks-1); + familiar.animate(FIREMAKE_ANIMATION); + //final GroundItem ground = GroundItemManager.create(event.getUsedItem(), familiar.getLocation(), player); + //if (!ground.isActive()) { + // return false; + //} + final Scenery object = new Scenery(log.getFireId(), familiar.getLocation()); + //familiar.moveStep(); + //GroundItemManager.destroy(ground); + player.getSkills().addExperience(Skills.FIREMAKING, log.getXp() + 10); + familiar.faceLocation(object.getFaceLocation(familiar.getLocation())); + SceneryBuilder.add(object, log.getLife(), FireMakingPulse.getAsh(player, log, object)); + if (player.getViewport().getRegion().getId() == 10806) { + player.getAchievementDiaryManager().finishTask(player, DiaryType.SEERS_VILLAGE, 1, 9); + } + if (inInventory(player, Items.TINDERBOX_590, 1)) { + return false; + } + } + return true; } }); - } return true; + } }