forked from 2009Scape/Server
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.
This commit is contained in:
parent
b3196a282c
commit
3f0c44b1c3
2 changed files with 45 additions and 31 deletions
|
|
@ -91,9 +91,14 @@ public final class FireMakingPulse extends SkillPulse<Item> {
|
|||
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<Item> {
|
|||
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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue