forked from 2009Scape/Server
Added limestone chiseling.
Needed for construction. Limestone can only be chiseled when the player has reached level 12, and will give 6 (30 because of x5, unless the player has chosen x10 it will be 60) xp per cut stone.
This commit is contained in:
parent
36ca5ccb9a
commit
8559398e83
2 changed files with 108 additions and 0 deletions
|
|
@ -0,0 +1,70 @@
|
|||
package org.crandor.game.content.skill.free.crafting.limestone;
|
||||
|
||||
import org.crandor.game.content.skill.SkillPulse;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.game.world.update.flag.context.Animation;
|
||||
|
||||
/**
|
||||
*
|
||||
* The skill pulse for chiseling a limestone into a limestone brick.
|
||||
*
|
||||
* @author Jamix77
|
||||
*
|
||||
*/
|
||||
public class ChiselLimestonePulse extends SkillPulse<Item> {
|
||||
|
||||
/**
|
||||
* Represents the chisel item.
|
||||
*/
|
||||
private static final Item CHISEL = new Item(1755);
|
||||
|
||||
/**
|
||||
* Represents the ticks passed.
|
||||
*/
|
||||
private int ticks;
|
||||
|
||||
public ChiselLimestonePulse(Player player, Item node) {
|
||||
super(player, node);
|
||||
this.resetAnimation= false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkRequirements() {
|
||||
if (!player.getInventory().containsItem(CHISEL)) {
|
||||
return false;
|
||||
}
|
||||
if (!player.getInventory().containsItem(new Item(3211))) {
|
||||
return false;
|
||||
}
|
||||
if (player.getSkills().getLevel(Skills.CRAFTING) < 12) {
|
||||
player.getPacketDispatch().sendMessage("You need a crafting level of 12 to make limestone bricks.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animate() {
|
||||
if (ticks % 5 == 0 || ticks < 1) {
|
||||
player.getAudioManager().send(2586);
|
||||
player.animate(Animation.create(4470));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reward() {
|
||||
if (++ticks % 2 != 0) {
|
||||
return false;
|
||||
}
|
||||
if (player.getInventory().remove(new Item(3211))) {
|
||||
|
||||
player.getInventory().add(new Item(3420));
|
||||
|
||||
player.getSkills().addExperience(Skills.CRAFTING, 6, true);
|
||||
}
|
||||
return !player.getInventory().containsItem(new Item(3211));
|
||||
}
|
||||
|
||||
}
|
||||
38
Server/src/plugin/skill/crafting/ChiselLimestonePlugin.java
Normal file
38
Server/src/plugin/skill/crafting/ChiselLimestonePlugin.java
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package plugin.skill.crafting;
|
||||
|
||||
import org.crandor.game.content.skill.free.crafting.limestone.ChiselLimestonePulse;
|
||||
import org.crandor.game.interaction.NodeUsageEvent;
|
||||
import org.crandor.game.interaction.UseWithHandler;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.plugin.InitializablePlugin;
|
||||
import org.crandor.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* The plugin that starts the chisel limestone cutting pulse.
|
||||
* @author Jamix77
|
||||
*/
|
||||
@InitializablePlugin
|
||||
public final class ChiselLimestonePlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code GemCutPlugin} {@Code Object}
|
||||
*/
|
||||
public ChiselLimestonePlugin() {
|
||||
super(3211);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(1755, ITEM_TYPE, this);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
player.getPulseManager().run(new ChiselLimestonePulse(player, new Item(3211)));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue