Repository reorganisation

Unified kotlin and java into just src/main
Unified the rs09 and core packages
Took all content out of the core package, and placed it into the new content package
Reorganised all source code relating to content to be easier to find and explore
This commit is contained in:
Ceikry
2023-01-26 13:59:28 +00:00
committed by Ryan
parent e4b799c44a
commit a100affda2
3156 changed files with 24205 additions and 30585 deletions
@@ -0,0 +1,51 @@
/*
package core.game.node.entity.skill.fletching;
import core.game.dialogue.SkillDialogueHandler;
import core.game.dialogue.SkillDialogueHandler.SkillDialogue;
import core.game.node.entity.skill.fletching.items.bolts.Bolt;
import core.game.node.entity.skill.fletching.items.bolts.BoltPulse;
import org.crandor.game.interaction.NodeUsageEvent;
import org.crandor.game.interaction.UseWithHandler;
import org.crandor.game.node.entity.player.Player;
import org.crandor.net.packet.PacketRepository;
import org.crandor.net.packet.context.ChildPositionContext;
import org.crandor.net.packet.out.RepositionChild;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
*/
/**
* Represents the bolt creating plugin.
* @author 'Vexia
* @version 1.0
*//*
@InitializablePlugin
public final class BoltCreatePlugin extends UseWithHandler {
*/
/**
* Constructs a new {@code BoltCreatePlugin} {@code Object}.
*//*
public BoltCreatePlugin() {
super(314);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (Bolt bolt : Bolt.values()) {
addHandler(bolt.getItem().getId(), ITEM_TYPE, this);
}
return this;
}
@Override
public boolean handle(final NodeUsageEvent event) {
final Player player = event.getPlayer();
}
}
*/
@@ -0,0 +1,45 @@
//package core.game.node.entity.skill.fletching;
//
//import core.game.dialogue.SkillDialogueHandler;
//import core.game.dialogue.SkillDialogueHandler.SkillDialogue;
//import core.game.node.entity.skill.fletching.items.gem.GemBolt;
//import core.game.node.entity.skill.fletching.items.gem.GemBoltPulse;
//import org.crandor.game.interaction.NodeUsageEvent;
//import org.crandor.game.interaction.UseWithHandler;
//import org.crandor.game.node.entity.player.Player;
//import org.crandor.net.packet.PacketRepository;
//import org.crandor.net.packet.context.ChildPositionContext;
//import org.crandor.net.packet.out.RepositionChild;
//import org.crandor.plugin.InitializablePlugin;
//import org.crandor.plugin.Plugin;
//
///**
// * Represents the plugin used to handle gem bolt making.
// * @author 'Vexia
// * @version 1.0
// */
//@InitializablePlugin
//public class BoltGemPlugin extends UseWithHandler {
//
// /**
// * Constructs a new {@code BoltGemPlugin} {@code Object}.
// */
// public BoltGemPlugin() {
// super(45, 46, 9187, 9188, 9189, 9190, 9191, 9192, 9193, 9194);
// }
//
// @Override
// public Plugin<Object> newInstance(Object arg) throws Throwable {
// for (GemBolt bolt : GemBolt.values()) {
// addHandler(bolt.getBase().getId(), ITEM_TYPE, this);
// }
// return this;
// }
//
// @Override
// public boolean handle(final NodeUsageEvent event) {
// final Player player = event.getPlayer();
//
// }
//
//}
@@ -0,0 +1,49 @@
/*
package core.game.node.entity.skill.fletching;
import core.game.node.entity.skill.fletching.items.darts.Dart;
import org.crandor.game.interaction.NodeUsageEvent;
import org.crandor.game.interaction.UseWithHandler;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
import core.game.content.quest.touristrap.TouristTrap;
*/
/**
* Represents the plugin used to create a dart.
* @author 'Vexia
* @version 1.0
*//*
@InitializablePlugin
public final class DartCreatePlugin extends UseWithHandler {
*/
/**
* Constructs a new {@code DartCreatePlugin} {@code Object}.
*//*
public DartCreatePlugin() {
super(314);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
for (Dart dart : Dart.values()) {
addHandler(dart.getItem().getId(), ITEM_TYPE, this);
}
return this;
}
@Override
public boolean handle(NodeUsageEvent event) {
if (event.getPlayer().getQuestRepository().getQuest(TouristTrap.NAME).getStage(event.getPlayer()) < 60) {
event.getPlayer().getPacketDispatch().sendMessage("You need to start Tourist Trap in order to do this.");
return true;
}
event.getPlayer().getDialogueInterpreter().open(328933, event.getUsedItem(), event.getBaseItem());
return true;
}
}
*/
@@ -0,0 +1,137 @@
/*
package core.game.node.entity.skill.fletching;
import org.crandor.game.node.item.Item;
*/
/**
* Represents a fletching item to make.
* @author 'Vexia
*//*
public enum FletchItem {
ARROW_SHAFT(FletchType.LOG, new Item(52, 15), 1, 5), SHORTBOW(FletchType.LOG, new Item(50), 5, 5),
LONGBOW(FletchType.LOG, new Item(48), 10, 10),
OAK_SHORTBOW(FletchType.OAK, new Item(54), 20, 16.5),
OAK_LONGBOW(FletchType.OAK, new Item(56), 25, 25),
WILLOW_SHORTBOW(FletchType.WILLOW, new Item(60), 35, 33.3),
WILLOW_LONGBOW(FletchType.WILLOW, new Item(58), 40, 41.5),
MAPLE_SHORTBOW(FletchType.MAPLE, new Item(64), 50, 50),
MAPLE_LONGBOW(FletchType.MAPLE, new Item(62), 55, 58.3),
YEW_SHORTBOW(FletchType.YEW, new Item(68), 65, 55),
YEW_LONGBOW(FletchType.YEW, new Item(66), 70, 75),
MAGIC_SHORTBOW(FletchType.MAGIC, new Item(72), 80, 83.3),
MAGIC_LONGBOW(FletchType.MAGIC, new Item(70), 85, 91.5),
WOODEN_STOCK(FletchType.LOG, new Item(9440), 9, 6),
OAK_STOCK(FletchType.OAK, new Item(9442), 24, 16),
WILLOW_STOCK(FletchType.WILLOW, new Item(9444), 39, 22),
TEAK_STOCK(FletchType.TEAK, new Item(9446), 46, 27),
MAPLE_STOCK(FletchType.MAPLE, new Item(9448), 54, 32),
MAHOGANY_STOCK(FletchType.MAHOGANY, new Item(9450), 61, 41),
YEW_STOCK(FletchType.YEW, new Item(9452), 69, 50);
*/
/**
* Constructs a new {@code FletchItem.java} {@code Object}.
* @param type the type.
* @param product the product.
* @param level the level.
* @param experience the experience.
*//*
FletchItem(final FletchType type, final Item product, final int level, final double experience) {
this.type = type;
this.product = product;
this.level = level;
this.experience = experience;
}
*/
/**
* Represents the type this item pertaint o.
*//*
private FletchType type;
*/
/**
* Represents the product of this item.
*//*
private Item product;
*/
/**
* Represents the level.
*//*
private final int level;
*/
/**
* Represents the experience.
*//*
private final double experience;
*/
/**
* Gets the type.
* @return The type.
*//*
public FletchType getType() {
return type;
}
*/
/**
* Sets the type.
* @param type The type to set.
*//*
public void setType(FletchType type) {
this.type = type;
}
*/
/**
* Gets the product.
* @return The product.
*//*
public Item getProduct() {
return product;
}
*/
/**
* Sets the product.
* @param product The product to set.
*//*
public void setProduct(Item product) {
this.product = product;
}
*/
/**
* Gets the level.
* @return The level.
*//*
public int getLevel() {
return level;
}
*/
/**
* Gets the experience.
* @return The experience.
*//*
public double getExperience() {
return experience;
}
}
*/
@@ -0,0 +1,88 @@
/*
package core.game.node.entity.skill.fletching;
import org.crandor.game.component.Component;
import org.crandor.game.node.item.Item;
*/
/**
* Represents the multiple fletching types(log types)
* @author 'Vexia
*//*
public enum FletchType {
LOG(new Item(1511), FletchItem.ARROW_SHAFT, FletchItem.SHORTBOW, FletchItem.LONGBOW, FletchItem.WOODEN_STOCK), OAK(new Item(1521), FletchItem.OAK_SHORTBOW, FletchItem.OAK_LONGBOW, FletchItem.OAK_STOCK), WILLOW(new Item(1519), FletchItem.WILLOW_SHORTBOW, FletchItem.WILLOW_LONGBOW, FletchItem.WILLOW_STOCK), MAPLE(new Item(1517), FletchItem.MAPLE_SHORTBOW, FletchItem.MAPLE_LONGBOW, FletchItem.MAPLE_STOCK), TEAK(new Item(6333), FletchItem.TEAK_STOCK), MAHOGANY(new Item(6332), FletchItem.MAHOGANY_STOCK), YEW(new Item(1515), FletchItem.YEW_SHORTBOW, FletchItem.YEW_LONGBOW, FletchItem.YEW_STOCK), MAGIC(new Item(1513), FletchItem.MAGIC_SHORTBOW, FletchItem.MAGIC_LONGBOW);
*/
/**
* Constructs a new {@code FletchType} {@code Object}.
* @param log the log.
* @param items the item.s
*//*
FletchType(final Item log, final FletchItem... items) {
this.log = log;
this.items = items;
}
*/
/**
* Represents the log of this type.
*//*
private final Item log;
*/
/**
* Represents the fletching items of this type.
*//*
private FletchItem[] items;
*/
/**
* Gets the items.
* @return The items.
*//*
public FletchItem[] getItems() {
return items;
}
*/
/**
* Gets the log.
* @return The log.
*//*
public Item getLog() {
return log;
}
*/
/**
* Method used to get the component based on type.
* @return the component.
*//*
public Component getComponent() {
return items.length > 1 ? new Component(301 + items.length) : new Component(309);
}
*/
/**
* Method used to get the <code>FletchType</code> based on the log item.
* @param item the item.
* @return the fletch type.
*//*
public static FletchType forItem(final Item item) {
for (FletchType type : FletchType.values()) {
if (type.getLog().getId() == item.getId()) {
return type;
}
}
return null;
}
}
*/
@@ -0,0 +1,353 @@
package content.global.skill.fletching;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
import java.util.HashMap;
public class Fletching {
public static HashMap<Integer, FletchingItems[]>logMap = new HashMap<>();
public static HashMap<Integer, Bolts> boltMap = new HashMap<>();
public static HashMap<Integer, Darts> dartMap = new HashMap<>();
public static HashMap<Integer, ArrowHeads> arrowHeadMap = new HashMap<>();
public static HashMap<Integer, GemBolts> gemMap = new HashMap<>();
public static HashMap<Integer, GemBolts> tipMap = new HashMap<>();
public static HashMap<Integer, String> stringMap = new HashMap<>();
public static HashMap<Integer, Limb> limbMap = new HashMap<>();
static{
Items[] itemsArray = Items.values();
int thisLength = itemsArray.length;
for(int x = 0; x < thisLength; x++){
Items item = itemsArray[x];
logMap.putIfAbsent(item.id, item.items);
}
Bolts[] boltArray = Bolts.values();
thisLength = boltArray.length;
for(int x = 0; x < thisLength; x++){
Bolts bolt = boltArray[x];
boltMap.putIfAbsent(bolt.unfinished,bolt);
}
Darts[] dartArray = Darts.values();
thisLength = dartArray.length;
for(int x = 0; x < thisLength; x++){
Darts dart = dartArray[x];
dartMap.putIfAbsent(dart.unfinished,dart);
}
ArrowHeads[] ahArray = ArrowHeads.values();
thisLength = ahArray.length;
for(int x = 0; x < thisLength; x++){
ArrowHeads arrowhead = ahArray[x];
arrowHeadMap.putIfAbsent(arrowhead.unfinished,arrowhead);
}
GemBolts[] gbArray = GemBolts.values();
thisLength = gbArray.length;
for(int x = 0; x < thisLength; x++){
GemBolts gem = gbArray[x];
gemMap.putIfAbsent(gem.gem,gem);
tipMap.putIfAbsent(gem.tip,gem);
}
String[] stringArray = String.values();
thisLength = stringArray.length;
for(int x = 0; x < thisLength; x++){
String bow = stringArray[x];
stringMap.putIfAbsent(bow.unfinished,bow);
}
Limb[] limbsArray = Limb.values();
thisLength = limbsArray.length;
for(int x = 0; x < thisLength; x++){
Limb limb = limbsArray[x];
limbMap.putIfAbsent(limb.stock, limb);
}
}
public static FletchingItems[] getEntries(int id){
return logMap.get(id);
}
public static boolean isLog(int id){
return logMap.get(id) != null;
}
public static boolean isBolt(int id){
return boltMap.get(id) != null;
}
public static boolean isDart(int id){
return dartMap.get(id) != null;
}
public static boolean isArrowHead(int id){
return arrowHeadMap.get(id) != null;
}
public static boolean isGemTip(int id){
return tipMap.get(id) != null;
}
public static Item[] getItems(int id){
FletchingItems[] entry = getEntries(id);
Item items[] = {};
switch(entry.length){
case 1:
items = new Item[] {new Item(entry[0].id)};
break;
case 2:
items = new Item[] {new Item(entry[0].id), new Item(entry[1].id)};
break;
case 3:
items = new Item[] {new Item(entry[0].id), new Item(entry[1].id), new Item(entry[2].id)};
break;
case 4:
items = new Item[] {new Item(entry[0].id), new Item(entry[1].id), new Item(entry[2].id), new Item(entry[3].id)};
break;
}
return items;
}
public enum Limb {
WOODEN_STOCK(9440,9420,9454,9, 12, new Animation(4436)),
OAK_STOCK(9442,9422,9176,24, 32, new Animation(4437)),
WILLOW_STOCK(9444,9423,9457,39, 44, new Animation(4438)),
TEAK_STOCK(9446,9425,9459,46, 54, new Animation(4439)),
MAPLE_STOCK(9448,9427,9461,54, 64, new Animation(4440)),
MAHOGANY_STOCK(9450,9429,9463,61, 82, new Animation(4441)),
YEW_STOCK(9452,9431,9465,69, 100, new Animation(4442));
public int stock, limb, product,level;
public double experience;
public Animation animation;
Limb(int stock, int limb, int product, int level, double experience, Animation animation) {
this.stock = stock;
this.limb = limb;
this.product = product;
this.level = level;
this.experience = experience;
this.animation = animation;
}
}
public enum String{
//Bows
SHORT_BOW((byte) 1,50,841,5, 5, new Animation(6678)),
LONG_BOW((byte) 1,48,839,10, 10, new Animation(6684)),
OAK_SHORTBOW((byte) 1,54,843,20, 16.5, new Animation(6679)),
OAK_LONGBOW((byte) 1,56,845,25, 25, new Animation(6685)),
WILLOW_SHORTBOW((byte) 1,60,849,35, 33.3, new Animation(6680)),
WILLOW_LONGBOW((byte) 1,58,847,40, 41.5, new Animation(6686)),
MAPLE_SHORTBOW((byte) 1,64,853,50, 50, new Animation(6681)),
MAPLE_LONGBOW((byte) 1,62,851,55, 58.3, new Animation(6687)),
YEW_SHORTBOW((byte) 1,68,857,65, 67.5, new Animation(6682)),
YEW_LONGBOW((byte) 1,66,855,70, 75, new Animation(6688)),
MAGIC_SHORTBOW((byte) 1,72,861,80, 83.3, new Animation(6683)),
MAGIC_LONGBOW((byte) 1,70,859,85, 91.5, new Animation(6689)),
//crossbows
BRONZE_CBOW((byte) 2,9454,9174,9, 6, new Animation(6671)),
BLURITE_CBOW((byte) 2,9456,9176,24, 16, new Animation(6672)),
IRON_CBOW((byte) 2,9457,9177,39, 22, new Animation(6673)),
STEEL_CBOW((byte) 2,9459,9179,46, 27, new Animation(6674)),
MITHIRIL_CBOW((byte) 2,9461,9181,54, 32, new Animation(6675)),
ADAMANT_CBOW((byte) 2,9463,9183,61, 41, new Animation(6676)),
RUNITE_CBOW((byte) 2,9465,9185,69, 50, new Animation(6677));
public int unfinished,product,string,level;
public final double experience;
public final Animation animation;
String(byte indicator, final int unfinished, final int product, final int level, final double experience, final Animation animation) {
this.unfinished = unfinished;
this.product = product;
this.level = level;
this.experience = experience;
this.animation = animation;
switch(indicator & 0xFF){
case 1:
this.string = org.rs09.consts.Items.BOW_STRING_1777;
break;
case 2:
this.string = org.rs09.consts.Items.CROSSBOW_STRING_9438;
break;
default:
break;
}
}
}
public enum GemBolts {
OPAL(877, org.rs09.consts.Items.OPAL_1609, 45, 879, 11, 1.6),
PEARL(9140, org.rs09.consts.Items.OYSTER_PEARL_411, 46, 880, 41, 3.2),
PEARLS(9140, org.rs09.consts.Items.OYSTER_PEARLS_413, 46, 880, 41, 3.2),
JADE(9139, org.rs09.consts.Items.JADE_1611, 9187, 9335, 26, 2.4),
RED_TOPAZ(9141, org.rs09.consts.Items.RED_TOPAZ_1613, 9188, 9336, 48, 3.9),
SAPPHIRE(9142, org.rs09.consts.Items.SAPPHIRE_1607, 9189, 9337, 56, 4.7),
EMERALD(9142, org.rs09.consts.Items.EMERALD_1605, 9190, 9338, 58, 5.5),
RUBY(9143, org.rs09.consts.Items.RUBY_1603, 9191, 9339, 63, 6.3),
DIAMOND(9143, org.rs09.consts.Items.DIAMOND_1601, 9192, 9340, 65, 7),
DRAGONSTONE(9144, org.rs09.consts.Items.DRAGONSTONE_1615, 9193, 9341, 71, 8.2),
ONYX(9144, org.rs09.consts.Items.ONYX_6573, 9194, 9342, 73, 9.4);
public int gem,tip,base,product,level;
public double experience;
GemBolts(int base, int gem, int tip, int product, int level, double experience){
this.gem = gem;
this.tip = tip;
this.base = base;
this.product = product;
this.level = level;
this.experience = experience;
}
}
public enum ArrowHeads {
BRONZE_ARROW(39, 882, 1, 2.6),
IRON_ARROW(40, 884, 15, 3.8),
STEEL_ARROW(41, 886, 30, 6.3),
MITHRIL_ARROW(42, 888, 45, 8.8),
ADAMANT_ARROW(43, 890, 60, 11.3),
RUNE_ARROW(44, 892, 75, 13.8),
DRAGON_ARROW(11237, 11212, 90, 16.3),
BROAD_ARROW(13278, 4160, 52, 15);
public int unfinished,finished,level;
public double experience;
ArrowHeads(int unfinished, int finished, int level, double experience){
this.unfinished = unfinished;
this.finished = finished;
this.level = level;
this.experience = experience;
}
public Item getFinished(){
return new Item(finished);
}
public Item getUnfinished(){
return new Item(unfinished);
}
}
public enum Darts{
BRONZE_DART(819, 806, 1, 1.8),
IRON_DART(820, 807, 22, 3.8),
STEEL_DART(821, 808, 37, 7.5),
MITHRIL_DART(822, 809, 52, 11.2),
ADAMANT_DART(823, 810, 67, 15),
RUNE_DART(824, 811, 81, 18.8),
DRAGON_DART(11232, 11230, 95, 25);
public int unfinished, finished, level;
public double experience;
Darts(int unfinished, int finished, int level, double experience){
this.unfinished = unfinished;
this.finished = finished;
this.level = level;
this.experience = experience;
}
public Item getFinished(){
return new Item(finished);
}
public Item getUnfinished(){
return new Item(unfinished);
}
}
public enum Bolts{
BRONZE_BOLT(9375, 877, 9, 0.5),
BLURITE_BOLT(9376, 9139, 24, 1),
IRON_BOLT(9377, 9140, 39, 1.5),
SILVER_BOLT(9382, 9145, 43, 2.5),
STEEL_BOLT(9378, 9141, 46, 3.5),
MITHRIL_BOLT(9379, 9142, 54, 5),
ADAMANTITE_BOLT(9380, 9143, 61, 7),
RUNITE_BOLT(9381, 9144, 69, 10),
BROAD_BOLT(13279, 13280, 55, 3);
public int unfinished, finished, level;
public double experience;
Bolts(int unfinished, int finished, int level, double experience){
this.unfinished = unfinished;
this.finished = finished;
this.level = level;
this.experience = experience;
}
public Item getFinished(){
return new Item(finished);
}
public Item getUnfinished(){
return new Item(unfinished);
}
}
private enum Items{
STANDARD(1511,FletchingItems.ARROW_SHAFT, FletchingItems.SHORT_BOW, FletchingItems.LONG_BOW, FletchingItems.WOODEN_STOCK),
ACHEY(2862, FletchingItems.OGRE_ARROW_SHAFT),
OAK(1521, FletchingItems.OAK_SHORTBOW, FletchingItems.OAK_LONGBOW, FletchingItems.OAK_STOCK),
WILLOW(1519, FletchingItems.WILLOW_SHORTBOW, FletchingItems.WILLOW_LONGBOW, FletchingItems.WILLOW_STOCK),
MAPLE(1517, FletchingItems.MAPLE_SHORTOW, FletchingItems.MAPLE_LONGBOW, FletchingItems.MAPLE_STOCK),
YEW(1515, FletchingItems.YEW_SHORTBOW, FletchingItems.YEW_LONGBOW, FletchingItems.YEW_STOCK),
MAGIC(1513, FletchingItems.MAGIC_SHORTBOW, FletchingItems.MAGIC_LONGBOW),
TEAK(6333, FletchingItems.TEAK_STOCK),
MAHOGANY(6332, FletchingItems.MAHOGANY_STOCK);
FletchingItems[] items;
int id;
Items(int id, FletchingItems item_1, FletchingItems item_2, FletchingItems item_3, FletchingItems item_4){
items = new FletchingItems[] {item_1, item_2, item_3, item_4};
this.id = id;
}
Items(int id, FletchingItems item_1, FletchingItems item_2, FletchingItems item_3){
items = new FletchingItems[] {item_1, item_2, item_3};
this.id = id;
}
Items(int id, FletchingItems item_1, FletchingItems item_2){
items = new FletchingItems[] {item_1, item_2};
this.id = id;
}
Items(int id, FletchingItems item_1){
items = new FletchingItems[] {item_1};
this.id = id;
}
}
public enum FletchingItems {
//Standard logs
ARROW_SHAFT(52, 5, 1, 15),
SHORT_BOW(50, 5, 5, 1),
LONG_BOW(48, 10, 10, 1),
WOODEN_STOCK(9440, 6, 9, 1),
//Achey logs
OGRE_ARROW_SHAFT(2864, 6.4, 5, 4),
//Oak logs
OAK_SHORTBOW(54, 16.5, 20, 1),
OAK_LONGBOW(56,25,25,1),
OAK_STOCK(9442, 16, 24, 1),
//Willow logs
WILLOW_SHORTBOW(60, 33.3, 35, 1),
WILLOW_LONGBOW(58, 41.5, 40, 1),
WILLOW_STOCK(9444, 22, 39, 1),
//Maple logs
MAPLE_SHORTOW(64, 50, 50, 1),
MAPLE_LONGBOW(62, 58.3, 55, 1),
MAPLE_STOCK(9448, 32, 54, 1),
//Yew logs
YEW_SHORTBOW(68, 67.5, 65, 1),
YEW_LONGBOW(66, 75, 70, 1),
YEW_STOCK(9452, 50, 69, 1),
//Magic logs
MAGIC_SHORTBOW(72, 83.3, 80,1),
MAGIC_LONGBOW(70, 91.5, 85, 1),
//Teak
TEAK_STOCK(9446, 27, 46,1),
//Mahogany
MAHOGANY_STOCK(9450, 41.0, 61, 1);
int id,level,amount,logId;
double experience;
FletchingItems(int id, double experience, int level, int amount){
this.id = id;
this.level = level;
this.amount = amount;
this.experience = experience;
}
public Item getItem(){
return new Item(id);
}
}
}
@@ -0,0 +1,141 @@
package content.global.skill.fletching
import core.game.node.entity.skill.Skills
import content.global.skill.fletching.Fletching
import content.global.skill.fletching.items.arrow.ArrowHeadPulse
import content.global.skill.fletching.items.arrow.HeadlessArrowPulse
import content.global.skill.fletching.items.bow.StringPulse
import content.global.skill.fletching.items.crossbow.LimbPulse
import core.game.node.item.Item
import core.net.packet.PacketRepository
import core.net.packet.context.ChildPositionContext
import core.net.packet.out.RepositionChild
import org.rs09.consts.Components
import org.rs09.consts.Items
import org.rs09.consts.Items.BLUE_FEATHER_10089
import org.rs09.consts.Items.FEATHER_314
import org.rs09.consts.Items.ORANGE_FEATHER_10091
import org.rs09.consts.Items.RED_FEATHER_10088
import org.rs09.consts.Items.STRIPY_FEATHER_10087
import org.rs09.consts.Items.YELLOW_FEATHER_10090
import core.game.dialogue.SkillDialogueHandler
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
class FletchingListeners : InteractionListener {
val LIMBIDs = Fletching.Limb.values().map(Fletching.Limb::limb).toIntArray()
val STOCKIDs = Fletching.Limb.values().map(Fletching.Limb::stock).toIntArray()
val MITHRIL_BOLT = Items.MITHRIL_BOLTS_9142
val MITH_GRAPPLE_TIP = Items.MITH_GRAPPLE_TIP_9416
val ROPE = Items.ROPE_954
val MITH_GRAPPLE = Items.MITH_GRAPPLE_9418
val ROPE_GRAPPLE = Items.MITH_GRAPPLE_9419
val ARROW_SHAFT = Items.ARROW_SHAFT_52
val FLETCHED_SHAFT = Items.HEADLESS_ARROW_53
val UNFINISHED_ARROWS = Fletching.ArrowHeads.values().map(Fletching.ArrowHeads::unfinished).toIntArray()
val FEATHERS = intArrayOf(FEATHER_314,STRIPY_FEATHER_10087,RED_FEATHER_10088,BLUE_FEATHER_10089,YELLOW_FEATHER_10090,ORANGE_FEATHER_10091)
val UNSTRUNG_BOWS = Fletching.String.values().map(Fletching.String::unfinished).toIntArray()
val STRINGS = intArrayOf(Items.BOW_STRING_1777,Items.CROSSBOW_STRING_9438)
override fun defineListeners() {
onUseWith(IntType.ITEM,STRINGS,*UNSTRUNG_BOWS){ player, string, bow ->
val enum = Fletching.stringMap[bow.id] ?: return@onUseWith false
if(enum.string != string.id){
player.sendMessage("That's not the right kind of string for this.")
return@onUseWith true
}
val handler: SkillDialogueHandler =
object : SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, Item(enum.product)) {
override fun create(amount: Int, index: Int) {
player.pulseManager.run(StringPulse(player, string.asItem(), enum, amount))
}
override fun getAll(index: Int): Int {
return player.inventory.getAmount(string.asItem())
}
}
handler.open()
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, Components.SKILL_MULTI1_309, 2, 215, 10))
return@onUseWith true
}
onUseWith(IntType.ITEM,ARROW_SHAFT,*FEATHERS){ player, shaft, feather ->
val handler: SkillDialogueHandler =
object : SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, Item(FLETCHED_SHAFT)) {
override fun create(amount: Int, index: Int) {
player.pulseManager.run(HeadlessArrowPulse(player, shaft.asItem(), Item(feather.id), amount))
}
override fun getAll(index: Int): Int {
return player.inventory.getAmount(FLETCHED_SHAFT)
}
}
handler.open()
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, Components.SKILL_MULTI1_309, 2, 210, 10))
return@onUseWith true
}
onUseWith(IntType.ITEM,FLETCHED_SHAFT,*UNFINISHED_ARROWS){ player, shaft, unfinished ->
val head = Fletching.arrowHeadMap[unfinished.id] ?: return@onUseWith false
val handler: SkillDialogueHandler =
object : SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, head.getFinished()) {
override fun create(amount: Int, index: Int) {
player.pulseManager.run(ArrowHeadPulse(player, shaft.asItem(), head, amount))
}
override fun getAll(index: Int): Int {
return player.inventory.getAmount(head.getUnfinished())
}
}
handler.open()
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, Components.SKILL_MULTI1_309, 2, 210, 10))
return@onUseWith true
}
onUseWith(IntType.ITEM,MITHRIL_BOLT,MITH_GRAPPLE_TIP){ player, bolt, tip ->
if(player.skills.getLevel(Skills.FLETCHING) < 59){
player.sendMessage("You need a fletching level of 59 to make this.")
return@onUseWith true
}
if(player.inventory.remove(Item(MITHRIL_BOLT,1),tip.asItem())){
player.inventory.add(Item(MITH_GRAPPLE))
}
return@onUseWith true
}
onUseWith(IntType.ITEM,ROPE,MITH_GRAPPLE){ player, rope, grapple ->
if(player.skills.getLevel(Skills.FLETCHING) < 59){
player.sendMessage("You need a fletching level of 59 to make this.")
return@onUseWith true
}
if(player.inventory.remove(rope.asItem(),grapple.asItem())){
player.inventory.add(Item(ROPE_GRAPPLE))
}
return@onUseWith true
}
onUseWith(IntType.ITEM,LIMBIDs,*STOCKIDs){ player, limb, stock ->
val limbEnum = Fletching.limbMap[stock.id] ?: return@onUseWith false
if(limbEnum.limb != limb.id){
player.sendMessage("That's not the right limb to attach to that stock.")
return@onUseWith true
}
val handler: SkillDialogueHandler = object : SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, Item(limbEnum.product)){
override fun create(amount: Int, index: Int) {
player.pulseManager.run(LimbPulse(player, stock.asItem(), limbEnum, amount))
}
override fun getAll(index: Int): Int {
return player.inventory.getAmount(stock.asItem())
}
}
handler.open()
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, Components.SKILL_MULTI1_309, 2, 210, 10))
return@onUseWith true
}
}
}
@@ -0,0 +1,133 @@
package content.global.skill.fletching;
import content.global.skill.fletching.items.bolts.BoltPulse;
import content.global.skill.fletching.items.darts.DartPulse;
import org.rs09.consts.Items;
import core.game.dialogue.SkillDialogueHandler;
import core.game.dialogue.SkillDialogueHandler.SkillDialogue;
import core.game.interaction.NodeUsageEvent;
import core.game.interaction.UseWithHandler;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.net.packet.PacketRepository;
import core.net.packet.context.ChildPositionContext;
import core.net.packet.out.RepositionChild;
import core.plugin.Initializable;
import core.plugin.Plugin;
/**
* Represents the plugin used to open the fletching dialogue.
* @author Ceikry
*/
@Initializable
public class FletchingPlugin extends UseWithHandler {
public FletchingPlugin() {
super(819,820,821,822,823,824,11232,9375,9376,9377,9382,9378,9379,9380,9381,13279,1511,1521,1519,1517,1515,1513,2862,6332,6333, Items.MAHOGANY_LOGS_6332);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
// Knife
addHandler(946, ITEM_TYPE, this);
// Feathers plus colored feathers
addHandler(314, ITEM_TYPE,this);
addHandler(10087, ITEM_TYPE, this);
addHandler(10088, ITEM_TYPE, this);
addHandler(10089, ITEM_TYPE, this);
addHandler(10090, ITEM_TYPE, this);
addHandler(10091, ITEM_TYPE, this);
return this;
}
@Override
public boolean handle(final NodeUsageEvent event) {
final Player player = event.getPlayer();
//handle darts
if(Fletching.isDart(event.getUsedItem().getId())){
final Fletching.Darts dart = Fletching.dartMap.get(event.getUsedItem().getId());
SkillDialogueHandler handler = new SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, dart.getFinished()) {
@Override
public void create(final int amount, int index) {
player.getPulseManager().run(new DartPulse(player, event.getUsedItem(), dart, amount));
}
@Override
public int getAll(int index) {
return player.getInventory().getAmount(event.getUsedItem());
}
};
handler.open();
PacketRepository.send(RepositionChild.class, new ChildPositionContext(player, 309, 2, 230, 10));
return true;
}
//handle bolts
if(Fletching.isBolt(event.getUsedItem().getId()) || Fletching.isBolt(event.getUsedWith().getId())){
// figure out which of the used items is a bolt, and which is potentially a feather
final Fletching.Bolts bolt
= Fletching.isBolt(event.getUsedItem().getId())
? Fletching.boltMap.get(event.getUsedItem().getId())
: Fletching.boltMap.get(event.getUsedWith().getId());
final int featherId
= Fletching.isBolt(event.getUsedItem().getId())
? event.getUsedWith().getId()
: event.getUsedItem().getId();
final boolean hasFeather = (featherId == 314 || (featherId >= 10087 && featherId <= 10091));
if (hasFeather) {
SkillDialogueHandler handler = new SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, bolt.getFinished()) {
@Override
public void create(final int amount, int index) {
player.getPulseManager().run(new BoltPulse(player, event.getUsedItem(), bolt, new Item(featherId), amount));
}
@Override
public int getAll(int index) {
return player.getInventory().getAmount(event.getUsedItem());
}
};
handler.open();
PacketRepository.send(RepositionChild.class, new ChildPositionContext(player, 309, 2, 210, 10));
return true;
}
return false;
}
//handle logs
if(Fletching.isLog(event.getUsedItem().getId())) {
final Item log = event.getUsedItem();
Item[] items = Fletching.getItems(log.getId());
SkillDialogue dialLength = SkillDialogue.ONE_OPTION;
switch (items.length) {
case 2:
dialLength = SkillDialogue.TWO_OPTION;
break;
case 3:
dialLength = SkillDialogue.THREE_OPTION;
break;
case 4:
dialLength = SkillDialogue.FOUR_OPTION;
break;
}
SkillDialogueHandler handler = new SkillDialogueHandler(player, dialLength, items) {
@Override
public void create(final int amount, int index) {
final Fletching.FletchingItems item = Fletching.getEntries(log.getId())[index];
player.getPulseManager().run(new FletchingPulse(player, log, amount, item));
}
@Override
public int getAll(int index) {
return player.getInventory().getAmount(log);
}
};
handler.open();
return true;
}
return false;
}
}
@@ -0,0 +1,117 @@
package content.global.skill.fletching;
import core.tools.RandomFunction;
import core.game.node.entity.player.link.diary.DiaryType;
import core.game.world.map.zone.ZoneBorders;
import core.game.node.entity.skill.SkillPulse;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
import core.tools.StringUtils;
/**
* fletching skill pulse
* @author ceik
*/
public final class FletchingPulse extends SkillPulse<Item> {
/**
* Seers bank zone borders for the diary task
*/
private static final ZoneBorders bankZone = new ZoneBorders(2721,3493,2730,3487);
/**
* Represents the animation used in this generic pulse.
*/
private static final Animation ANIMATION = new Animation(1248);
/**
* Represents the item we are fletching.
*/
private Fletching.FletchingItems fletch;
/**
* Represents the amount to fletch.
*/
private int amount = 0;
/**
* Constructs a new {@code FletchingPulse.java} {@code Object}.
* @param player
* @param node
*/
public FletchingPulse(final Player player, final Item node, final int amount, final Fletching.FletchingItems fletch) {
super(player, node);
this.amount = amount;
this.fletch = fletch;
}
@Override
public boolean checkRequirements() {
if (player.getSkills().getLevel(Skills.FLETCHING) < fletch.level) {
player.getDialogueInterpreter().sendDialogue("You need a Fletching skill of " + fletch.level + " or above to make " + (StringUtils.isPlusN(fletch.getItem().getName().replace("(u)", "").trim()) ? "an" : "a") + " " + fletch.getItem().getName().replace("(u)", "").trim());
return false;
}
if (amount > player.getInventory().getAmount(node)) {
amount = player.getInventory().getAmount(node);
}
if (fletch == Fletching.FletchingItems.OGRE_ARROW_SHAFT) {
if (player.getQuestRepository().getQuest("Big Chompy Bird Hunting").getStage(player) == 0) {
player.getPacketDispatch().sendMessage("You must have started Big Chompy Bird Hunting to make those.");
return false;
}
}
return true;
}
@Override
public void animate() {
player.animate(ANIMATION);
}
@Override
public boolean reward() {
if(bankZone.insideBorder(player) && fletch == Fletching.FletchingItems.MAGIC_SHORTBOW) {
player.getAchievementDiaryManager().finishTask(player, DiaryType.SEERS_VILLAGE, 2, 2);
}
if (getDelay() == 1) {
super.setDelay(4);
return false;
}
if (player.getInventory().remove(node)) {
final Item item = new Item(fletch.id,fletch.amount);
if ( fletch == Fletching.FletchingItems.OGRE_ARROW_SHAFT ) {
item.setAmount(RandomFunction.random(3,6));
}
player.getInventory().add(item);
player.getSkills().addExperience(Skills.FLETCHING, fletch.experience, true);
String message = getMessage();
player.getPacketDispatch().sendMessage(message);
if (fletch.id == Fletching.FletchingItems.MAGIC_SHORTBOW.id
&& (new ZoneBorders(2721, 3489, 2724, 3493, 0).insideBorder(player)
|| new ZoneBorders(2727, 3487, 2730, 3490, 0).insideBorder(player))
&& !player.getAchievementDiaryManager().hasCompletedTask(DiaryType.SEERS_VILLAGE, 2, 2)) {
player.setAttribute("/save:diary:seers:fletch-magic-short-bow", true);
}
} else {
return true;
}
amount--;
return amount == 0;
}
/**
* Method used to get the message of the fletch.
* @return the message.
*/
public String getMessage() {
switch (fletch) {
case ARROW_SHAFT:
return "You carefully cut the wood into 15 arrow shafts.";
default:
return "You carefully cut the wood into " + (StringUtils.isPlusN(fletch.getItem().getName()) ? "an" : "a") + " " + fletch.getItem().getName().replace("(u)", "").trim() + ".";
}
}
}
@@ -0,0 +1,103 @@
package content.global.skill.fletching;
import content.global.skill.fletching.items.gem.GemBoltCutPulse;
import content.global.skill.fletching.items.gem.GemBoltPulse;
import core.game.interaction.NodeUsageEvent;
import core.game.interaction.UseWithHandler;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.net.packet.PacketRepository;
import core.net.packet.context.ChildPositionContext;
import core.net.packet.out.RepositionChild;
import core.plugin.Initializable;
import core.plugin.Plugin;
import core.game.dialogue.SkillDialogueHandler;
import core.game.dialogue.SkillDialogueHandler.SkillDialogue;
import org.rs09.consts.Items;
/**
* Represents the gem bolt creating plugin.
* @author Ceikry
* @version 2.0
*/
@Initializable
public final class GemBoltPlugin extends UseWithHandler {
Fletching.GemBolts bolt;
/**
* Constructs a new {@code GemBoltPlugin} {@code Object}.
*/
public GemBoltPlugin() {
super(Items.OPAL_BOLT_TIPS_45,
Items.PEARL_BOLT_TIPS_46,
Items.JADE_BOLT_TIPS_9187,
Items.TOPAZ_BOLT_TIPS_9188,
Items.SAPPHIRE_BOLT_TIPS_9189,
Items.EMERALD_BOLT_TIPS_9190,
Items.RUBY_BOLT_TIPS_9191,
Items.DIAMOND_BOLT_TIPS_9192,
Items.DRAGON_BOLT_TIPS_9193,
Items.ONYX_BOLT_TIPS_9194,
Items.OYSTER_PEARL_411,
Items.OYSTER_PEARLS_413,
Items.OPAL_1609,
Items.JADE_1611,
Items.RED_TOPAZ_1613,
Items.SAPPHIRE_1607,
Items.EMERALD_1605,
Items.RUBY_1603,
Items.DIAMOND_1601,
Items.DRAGONSTONE_1615,
Items.ONYX_6573);
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
addHandler(Items.CHISEL_1755, ITEM_TYPE, this);
for(Fletching.GemBolts gem : Fletching.GemBolts.values()){
addHandler(gem.base, ITEM_TYPE,this);
}
return this;
}
@Override
public boolean handle(final NodeUsageEvent event) {
final Player player = event.getPlayer();
bolt = Fletching.tipMap.get(event.getUsedItem().getId());
if(bolt == null){
bolt = Fletching.tipMap.get(event.getUsedWith().getId());
}
if(bolt != null){
SkillDialogueHandler handler = new SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, new Item(bolt.product)) {
@Override
public void create(final int amount, int index) {
player.getPulseManager().run(new GemBoltPulse(player, event.getUsedItem(), bolt, amount));
}
@Override
public int getAll(int index) {
return player.getInventory().getAmount(event.getUsedItem());
}
};
handler.open();
PacketRepository.send(RepositionChild.class, new ChildPositionContext(player, 309, 2, 210, 10));
} else {
final Fletching.GemBolts gem = Fletching.gemMap.get(event.getUsedItem().getId() == Items.CHISEL_1755 ? event.getBaseItem().getId() : event.getUsedItem().getId());
if(gem == null){
return false;
}
new SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, new Item(gem.gem)) {
@Override
public void create(final int amount, final int index) {
player.getPulseManager().run(new GemBoltCutPulse(player, event.getUsedItem(), gem, amount));
}
@Override
public int getAll(int index) {
return player.getInventory().getAmount(gem.gem);
}
}.open();
}
return true;
}
}
@@ -0,0 +1,123 @@
/*
package core.game.node.entity.skill.fletching.items.arrow;
import org.crandor.game.node.item.Item;
*/
/**
* Represents the enum storing the arrow head information.
* @author 'Vexia
* @note brutal arrows after quest.
*//*
public enum ArrowHead {
BRONZE_ARROW(new Item(39), new Item(882), 1, 2.6),
IRON_ARROW(new Item(40), new Item(884), 15, 3.8),
STEEL_ARROW(new Item(41), new Item(886), 30, 6.3),
MITHRIL_ARROW(new Item(42), new Item(888), 45, 8.8),
ADAMANT_ARROW(new Item(43), new Item(890), 60, 10),
RUNE_ARROW(new Item(44), new Item(892), 75, 13.8),
DRAGON_ARROW(new Item(11237), new Item(11212), 90, 16.3),
BROAD_ARROW(new Item(13278), new Item(4160), 52, 10);
*/
/**
* Constructs a new {@code ArrowHead.java} {@code Object}.
* @param item the item.
* @param product the product.
* @param level the level.
* @param experience the experience.
*//*
ArrowHead(Item item, Item product, int level, double experience) {
this.item = item;
this.product = product;
this.level = level;
this.experience = experience;
}
*/
/**
* Represents the arrow tip.
*//*
private final Item item;
*/
/**
* Represents the product item.
*//*
private final Item product;
*/
/**
* Represents the level required.
*//*
private final int level;
*/
/**
* Represents the experience gained.
*//*
private final double experience;
*/
/**
* Gets the item.
* @return The item.
*//*
public Item getTips() {
return item;
}
*/
/**
* Gets the product.
* @return The product.
*//*
public Item getProduct() {
return product;
}
*/
/**
* Gets the level.
* @return The level.
*//*
public int getLevel() {
return level;
}
*/
/**
* Gets the experience.
* @return The experience.
*//*
public double getExperience() {
return experience;
}
*/
/**
* Gets the arrow head.
* @param item the item.
* @return the arrow head.
*//*
public static ArrowHead forItem(final Item item) {
for (ArrowHead arrow : ArrowHead.values()) {
if (arrow.getTips().getId() == item.getId()) {
return arrow;
}
}
return null;
}
}
*/
@@ -0,0 +1,104 @@
package content.global.skill.fletching.items.arrow;
import content.global.skill.slayer.SlayerManager;
import core.game.node.entity.skill.SkillPulse;
import core.game.node.entity.skill.Skills;
import content.global.skill.fletching.Fletching;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents the arrow head pulse to complete the headless arrow.
* @author 'Vexia
*/
public class ArrowHeadPulse extends SkillPulse<Item> {
/**
* Represents the headless arrow item.
*/
private static final Item HEADLESS_ARROW = new Item(53);
/**
* Represents the arrow head.
*/
private final Fletching.ArrowHeads arrow;
/**
* Represents the sets to do.
*/
private int sets;
/**
* Constructs a new {@code ArrowHeadPulse.java} {@code Object}.
* @param player the player.
* @param node the node.
* @param arrow the arrow.
* @param sets the sets.
*/
public ArrowHeadPulse(final Player player, final Item node, final Fletching.ArrowHeads arrow, final int sets) {
super(player, node);
this.arrow = arrow;
this.sets = sets;
}
@Override
public boolean checkRequirements() {
if (arrow.unfinished == 4160) {
if (!SlayerManager.getInstance(player).flags.isBroadsUnlocked()) {
player.getDialogueInterpreter().sendDialogue("You need to unlock the ability to create broad arrows.");
return false;
}
}
if (player.getSkills().getLevel(Skills.FLETCHING) < arrow.level) {
player.getDialogueInterpreter().sendDialogue("You need a fletching level of " + arrow.level + " to do this.");
return false;
}
return true;
}
@Override
public void animate() {
}
@Override
public boolean reward() {
if (getDelay() == 1) {
super.setDelay(3);
}
Item tip = arrow.getUnfinished();
int tipAmount = player.getInventory().getAmount(arrow.unfinished);
int shaftAmount = player.getInventory().getAmount(HEADLESS_ARROW);
if (tipAmount >= 15 && shaftAmount >= 15) {
HEADLESS_ARROW.setAmount(15);
tip.setAmount(15);
player.getPacketDispatch().sendMessage("You attach arrow heads to 15 arrow shafts.");
} else {
int amount = tipAmount > shaftAmount ? shaftAmount : tipAmount;
HEADLESS_ARROW.setAmount(amount);
tip.setAmount(amount);
player.getPacketDispatch().sendMessage(amount == 1 ? "You attach an arrow head to an arrow shaft." : "You attach arrow heads to " + amount + " arrow shafts.");
}
if (player.getInventory().remove(HEADLESS_ARROW, tip)) {
player.getSkills().addExperience(Skills.FLETCHING, arrow.experience * tip.getAmount(), true);
Item product = arrow.getFinished();
product.setAmount(tip.getAmount());
player.getInventory().add(product);
}
HEADLESS_ARROW.setAmount(1);
tip.setAmount(1);
if (!player.getInventory().containsItem(HEADLESS_ARROW)) {
return true;
}
if (!player.getInventory().containsItem(tip)) {
return true;
}
sets--;
return sets == 0;
}
@Override
public void message(int type) {
}
}
@@ -0,0 +1,139 @@
package content.global.skill.fletching.items.arrow;
import org.rs09.consts.Items;
import core.game.node.entity.skill.SkillPulse;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents the arrow pulse for creating unfinished arrows.
* @author 'Vexia
*/
public final class HeadlessArrowPulse extends SkillPulse<Item> {
/**
* Represents the headless arrow item.
*/
private final Item HEADLESS_ARROW = new Item(Items.HEADLESS_ARROW_53);
/**
* Represents the arrow shaft item.
*/
private final Item ARROW_SHAFT = new Item(Items.ARROW_SHAFT_52);
/**
* Represents the feather items.
*/
private static final Item[] FEATHER = new Item[] {
new Item(Items.FEATHER_314),
new Item(Items.STRIPY_FEATHER_10087),
new Item(Items.RED_FEATHER_10088),
new Item(Items.BLUE_FEATHER_10089),
new Item(Items.YELLOW_FEATHER_10090),
new Item(Items.ORANGE_FEATHER_10091)
};
/**
* The feather being used.
*/
private Item feather;
/**
* Represents the amount to make.
*/
private int sets;
/**
* Represents if we should use sets, meaning we have 15 & 15 arrow shafts and feathers.
*/
private boolean useSets = false;
/**
* Constructs a new {@code ArrowPulse.java} {@code Object}.
* @param player the player.
* @param node the node.
*/
public HeadlessArrowPulse(Player player, Item node, Item feather, int sets) {
super(player, node);
this.sets = sets;
this.feather = feather;
}
@Override
public boolean checkRequirements() {
if (!player.getInventory().containsItem(ARROW_SHAFT)) {
player.getDialogueInterpreter().sendDialogue("You don't have any arrow shafts.");
return false;
}
if (feather == null || !player.getInventory().containsItem(feather)) {
player.getDialogueInterpreter().sendDialogue("You don't have any feathers.");
return false;
}
if (player.getInventory().contains(ARROW_SHAFT.getId(), 15) && player.getInventory().contains(feather.getId(), 15)) {
useSets = true;
} else {
useSets = false;
}
return true;
}
@Override
public void animate() {
}
@Override
public boolean reward() {
int featherAmount = player.getInventory().getAmount(feather);
int shaftAmount = player.getInventory().getAmount(ARROW_SHAFT);
if (getDelay() == 1) {
super.setDelay(3);
}
if (featherAmount >= 15 && shaftAmount >= 15) {
feather.setAmount(15);
ARROW_SHAFT.setAmount(15);
player.getPacketDispatch().sendMessage("You attach feathers to 15 arrow shafts.");
} else {
int amount = Math.min(featherAmount, shaftAmount);
feather.setAmount(amount);
ARROW_SHAFT.setAmount(amount);
player.getPacketDispatch().sendMessage(amount == 1
? "You attach a feathers to a shaft." : "You attach feathers to " + amount + " arrow shafts.");
}
if (player.getInventory().remove(feather, ARROW_SHAFT)) {
HEADLESS_ARROW.setAmount(feather.getAmount());
player.getSkills().addExperience(Skills.FLETCHING, HEADLESS_ARROW.getAmount(), true);
player.getInventory().add(HEADLESS_ARROW);
}
HEADLESS_ARROW.setAmount(1);
feather.setAmount(1);
ARROW_SHAFT.setAmount(1);
if (!player.getInventory().containsItem(ARROW_SHAFT)) {
return true;
}
if (!player.getInventory().containsItem(feather)) {
return true;
}
sets--;
return sets <= 0;
}
@Override
public void message(int type) {
}
/**
* Gets the feather item.
* @return the item.
*/
private Item getFeather() {
int length = FEATHER.length;
for (int i = 0; i < length; i++) {
Item f = FEATHER[i];
if (player.getInventory().containsItem(f)) {
return f;
}
}
return null;
}
}
@@ -0,0 +1,123 @@
/*
package core.game.node.entity.skill.fletching.items.bolts;
import org.crandor.game.node.item.Item;
*/
/**
* Represents an enum of bolts.
* @author 'Vexia
*//*
public enum Bolt {
BRONZE_BOLT(new Item(9375), new Item(877), 9, 0.5),
BLURITE_BOLT(new Item(9376), new Item(9139), 24, 1),
IRON_BOLT(new Item(9377), new Item(9140), 39, 1.5),
SILVER_BOLT(new Item(9382), new Item(9145), 43, 2.5),
STEEL_BOLT(new Item(9378), new Item(9141), 46, 3.5),
MITHRIL_BOLT(new Item(9379), new Item(9142), 54, 5),
ADAMANTITE_BOLT(new Item(9380), new Item(9143), 61, 7),
RUNITE_BOLT(new Item(9381), new Item(9144), 69, 10),
BROAD_BOLT(new Item(13279), new Item(13280), 55, 3);
*/
/**
* The item required.
*//*
private final Item item;
*/
/**
* The product recieved.
*//*
private final Item product;
*/
/**
* The level required.
*//*
private final int level;
*/
/**
* The experience gained.
*//*
private final double experience;
*/
/**
* Constructs a new {@code Bolt} {@code Object}.
* @param item the item.
* @param product the product.
* @param level the level.
* @param experience the experienece.
*//*
Bolt(Item item, Item product, int level, double experience) {
this.item = item;
this.product = product;
this.level = level;
this.experience = experience;
}
*/
/**
* Gets the item.
* @return The item.
*//*
public Item getItem() {
return item;
}
*/
/**
* Gets the product.
* @return The product.
*//*
public Item getProduct() {
return product;
}
*/
/**
* Gets the level.
* @return The level.
*//*
public int getLevel() {
return level;
}
*/
/**
* Gets the experience.
* @return The experience.
*//*
public double getExperience() {
return experience;
}
*/
/**
* Method used to get the bolt for the item.
* @param item the item.
* @return the bolt.
*//*
public static Bolt forItem(final Item item) {
for (Bolt bolt : Bolt.values()) {
if (bolt.getItem().getId() == item.getId()) {
return bolt;
}
}
return null;
}
}
*/
@@ -0,0 +1,125 @@
package content.global.skill.fletching.items.bolts;
import content.global.skill.slayer.SlayerManager;
import org.rs09.consts.Items;
import core.game.node.entity.skill.SkillPulse;
import core.game.node.entity.skill.Skills;
import content.global.skill.fletching.Fletching;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents the bolt pulse class to make bolts.
* @author ceik
*/
public final class BoltPulse extends SkillPulse<Item> {
/**
* Represents the feather item.
*/
private Item feather;
/**
* Represents possible feather Items
*/
private static final Item[] FEATHER = new Item[] {
new Item(Items.FEATHER_314),
new Item(Items.STRIPY_FEATHER_10087),
new Item(Items.RED_FEATHER_10088),
new Item(Items.BLUE_FEATHER_10089),
new Item(Items.YELLOW_FEATHER_10090),
new Item(Items.ORANGE_FEATHER_10091)
};
/**
* Represents the bolt.
*/
private final Fletching.Bolts bolt;
/**
* Represents the sets to do.
*/
private int sets;
/**
* Represents if we're using sets.
*/
private boolean useSets = false;
/**
* Constructs a new {@code BoltPulse.java} {@code Object}.
* @param player the player.
* @param node the node.
*/
public BoltPulse(Player player, Item node, final Fletching.Bolts bolt, final Item feather, final int sets) {
super(player, node);
this.bolt = bolt;
this.sets = sets;
this.feather = feather;
}
@Override
public boolean checkRequirements() {
if (bolt.getUnfinished().getId() == 13279) {
if (!SlayerManager.getInstance(player).flags.isBroadsUnlocked()) {
player.getDialogueInterpreter().sendDialogue("You need to unlock the ability to create broad bolts.");
return false;
}
}
if (player.getSkills().getLevel(Skills.FLETCHING) < bolt.level) {
player.getDialogueInterpreter().sendDialogue("You need a fletching level of " + bolt.level + " in order to do this.");
return false;
}
if (!player.getInventory().containsItem(feather)) {
return false;
}
if (!player.getInventory().containsItem(bolt.getUnfinished())) {
return false;
}
return true;
}
@Override
public void animate() {
}
@Override
public boolean reward() {
int featherAmount = player.getInventory().getAmount(feather);
int boltAmount = player.getInventory().getAmount(bolt.unfinished);
if (getDelay() == 1) {
super.setDelay(3);
}
final Item unfinished = bolt.getUnfinished();
if (featherAmount >= 10 && boltAmount >= 10) {
feather.setAmount(10);
unfinished.setAmount(10);
player.getPacketDispatch().sendMessage("You fletch 10 bolts.");
} else {
int amount = featherAmount > boltAmount ? boltAmount : featherAmount;
feather.setAmount(amount);
unfinished.setAmount(amount);
player.getPacketDispatch().sendMessage(amount == 1 ? "You attach a feather to a bolt." : "You fletch " + amount + " bolts");
}
if (player.getInventory().remove(feather, unfinished)) {
Item product = bolt.getFinished();
product.setAmount(feather.getAmount());
player.getSkills().addExperience(Skills.FLETCHING, product.getAmount() * bolt.experience, true);
player.getInventory().add(product);
}
feather.setAmount(1);
if (!player.getInventory().containsItem(feather)) {
return true;
}
if (!player.getInventory().containsItem(bolt.getUnfinished())) {
return true;
}
sets--;
return sets <= 0;
}
@Override
public void message(int type) {
}
}
@@ -0,0 +1,136 @@
/*
package core.game.node.entity.skill.fletching.items.bow;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.update.flag.context.Animation;
*/
/**
* Represents the enum of stringing bows.
* @author 'Vexia
*//*
public enum StringBow {
SHORT_BOW(new Item(50), new Item(841), 5, 5, new Animation(6678)),
LONG_BOW(new Item(48), new Item(839), 10, 10, new Animation(6684)),
OAK_SHORTBOW(new Item(54), new Item(843), 20, 16.5, new Animation(6679)),
OAK_LONGBOW(new Item(56), new Item(845), 25, 25, new Animation(6685)),
WILLOW_SHORTBOW(new Item(60), new Item(849), 35, 33.3, new Animation(6680)),
WILLOW_LONGBOW(new Item(58), new Item(847), 40, 41.5, new Animation(6686)),
MAPLE_SHORTBOW(new Item(64), new Item(853), 50, 50, new Animation(6681)),
MAPLE_LONGBOW(new Item(62), new Item(851), 55, 58.3, new Animation(6687)),
YEW_SHORTBOW(new Item(68), new Item(857), 65, 66, new Animation(6682)),
YEW_LONGBOW(new Item(66), new Item(855), 70, 75, new Animation(6688)),
MAGIC_SHORTBOW(new Item(72), new Item(861), 80, 83.3, new Animation(6683)),
MAGIC_LONGBOW(new Item(70), new Item(859), 85, 91.5, new Animation(6689));
StringBow(final Item item, final Item product, final int level, final double experience, final Animation animation) {
this.item = item;
this.product = product;
this.level = level;
this.experience = experience;
this.animation = animation;
}
*/
/**
* The item required.
*//*
private final Item item;
*/
/**
* The item product.
*//*
private final Item product;
*/
/**
* The level required.
*//*
private final int level;
*/
/**
* The experience required.
*//*
private final double experience;
*/
/**
* The animation of stringing.
*//*
private final Animation animation;
*/
/**
* Gets the item.
* @return The item.
*//*
public Item getItem() {
return item;
}
*/
/**
* Gets the product.
* @return The product.
*//*
public Item getProduct() {
return product;
}
*/
/**
* Gets the level.
* @return The level.
*//*
public int getLevel() {
return level;
}
*/
/**
* Gets the experience.
* @return The experience.
*//*
public double getExperience() {
return experience;
}
*/
/**
* Method used to get the animation.
* @return the animation.
*//*
public Animation getAnimation() {
return animation;
}
*/
/**
* Method used to get the string bow for the item.
* @param item the item.
* @return the string bow.
*//*
public static StringBow forItem(final int id) {
for (StringBow bw : StringBow.values()) {
if (bw.getItem().getId() == id) {
return bw;
}
}
return null;
}
}*/
@@ -0,0 +1,87 @@
package content.global.skill.fletching.items.bow;
import core.game.node.entity.player.link.diary.DiaryType;
import core.game.world.map.zone.ZoneBorders;
import core.game.node.entity.skill.SkillPulse;
import core.game.node.entity.skill.Skills;
import content.global.skill.fletching.Fletching;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents the skill pulse of stringing.
*
* @author Ceikry
*/
public class StringPulse extends SkillPulse<Item> {
/**
* Represents the string bow.
*/
private final Fletching.String bow;
/**
* The amount.
*/
private int amount;
/**
* Constructs a new {@code StringbowPlugin.java} {@code Object}.
*
* @param player the player.
* @param node the node.
*/
public StringPulse(Player player, Item node, final Fletching.String bow, int amount) {
super(player, node);
this.bow = bow;
this.amount = amount;
}
@Override
public boolean checkRequirements() {
if (getDelay() == 1) {
setDelay(2);
}
if (player.getSkills().getLevel(Skills.FLETCHING) < bow.level) {
player.getDialogueInterpreter().sendDialogue("You need a fletching level of " + bow.level + " to string this bow.");
return false;
}
if (!player.getInventory().containsItem(new Item(bow.string))) {
player.getDialogueInterpreter().sendDialogue("You seem to have run out of bow strings.");
return false;
}
animate();
return true;
}
@Override
public void animate() {
player.animate(bow.animation);
}
@Override
public boolean reward() {
if (player.getInventory().remove(new Item(bow.unfinished), new Item(bow.string))) {
player.getInventory().add(new Item(bow.product));
player.getSkills().addExperience(Skills.FLETCHING, bow.experience, true);
player.getPacketDispatch().sendMessage("You add a string to the bow.");
if (bow == Fletching.String.MAGIC_SHORTBOW
&& (new ZoneBorders(2721, 3489, 2724, 3493, 0).insideBorder(player)
|| new ZoneBorders(2727, 3487, 2730, 3490, 0).insideBorder(player))
&& player.getAttribute("diary:seers:fletch-magic-short-bow", false)) {
player.getAchievementDiaryManager().finishTask(player, DiaryType.SEERS_VILLAGE, 2, 2);
}
}
if (!player.getInventory().containsItem(new Item(bow.string)) || !player.getInventory().containsItem(new Item(bow.unfinished))) {
return true;
}
amount--;
return amount == 0;
}
@Override
public void message(int type) {
}
}
@@ -0,0 +1,97 @@
/*
package core.game.node.entity.skill.fletching.items.crossbow;
import core.game.node.entity.skill.SkillPulse;
import core.game.node.entity.skill.Skills;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.item.Item;
*/
/**
* Represents the skill pulse of stringing.
* @author 'Vexia
*//*
public class CrossbowPulse extends SkillPulse<Item> {
*/
/**
* Represents the bow string item.
*//*
private final Item BOW_STRING = new Item(9438);
*/
/**
* Represents the string bow.
*//*
private final StringCross bow;
*/
/**
* Represents the amount.
*//*
private int amount;
*/
/**
* Constructs a new {@code StringcrossbowPlugin.java} {@code Object}.
* @param player the player.
* @param node the node.
*//*
public CrossbowPulse(Player player, Item node, final StringCross bow, int amount) {
super(player, node);
this.bow = bow;
this.amount = amount;
}
@Override
public boolean checkRequirements() {
if (player.getSkills().getLevel(Skills.FLETCHING) < bow.getLevel()) {
player.getDialogueInterpreter().sendDialogue("You need a fletching level of " + bow.getLevel() + " to string this crossbow.");
return false;
}
if (!player.getInventory().containsItem(BOW_STRING)) {
player.getDialogueInterpreter().sendDialogue("You seem to have run out of bow strings.");
return false;
}
return true;
}
@Override
public void animate() {
player.animate(bow.getAnimation());
}
@Override
public boolean reward() {
if (getDelay() == 1) {
super.setDelay(5);
return false;
}
if (player.getInventory().remove(bow.getItem(), BOW_STRING)) {
player.getInventory().add(bow.getProduct());
player.getSkills().addExperience(Skills.FLETCHING, bow.getExperience(), true);
player.getPacketDispatch().sendMessage("You add a string to the crossbow.");
}
if (!player.getInventory().containsItem(BOW_STRING) || !player.getInventory().containsItem(bow.getItem())) {
return true;
}
amount--;
return amount == 0;
}
@Override
public void message(int type) {
switch (type) {
case 0:
break;
case 1:
break;
}
}
}*/
@@ -0,0 +1,128 @@
package content.global.skill.fletching.items.crossbow;
import core.game.node.item.Item;
import core.game.world.update.flag.context.Animation;
/**
* Represents the enum for limbs.
* @author 'Vexia
*/
public enum Limb {
WOODEN_STOCK(new Item(9440), new Item(9420), new Item(9454), 9, 12, new Animation(4436)),
OAK_STOCK(new Item(9442), new Item(9422), new Item(9176), 24, 32, new Animation(4437)),
WILLOW_STOCK(new Item(9444), new Item(9423), new Item(9457), 39, 44, new Animation(4438)),
TEAK_STOCK(new Item(9446), new Item(9425), new Item(9459), 46, 54, new Animation(4439)),
MAPLE_STOCK(new Item(9448), new Item(9427), new Item(9461), 54, 64, new Animation(4440)),
MAHOGANY_STOCK(new Item(9450), new Item(9429), new Item(9463), 61, 82, new Animation(4441)),
YEW_STOCK(new Item(9452), new Item(9431), new Item(9465), 69, 100, new Animation(4442));
/**
* Constructs a new {@code StringcrosbowPlugin.java} {@code Object}.
* @param stock the stock.
* @param limb the limb.
* @param product the product.
* @param level the level.
* @param experience the experience.
* @param animation the animation.
*/
Limb(Item stock, Item limb, Item product, int level, double experience, Animation animation) {
this.stock = stock;
this.limb = limb;
this.product = product;
this.level = level;
this.experience = experience;
this.animation = animation;
}
/**
* The stock.
*/
private final Item stock;
/**
* The limb.
*/
private final Item limb;
/**
* The product.
*/
private final Item product;
/**
* The level.
*/
private final int level;
/**
* The experience.
*/
private final double experience;
/**
* The animation.
*/
private final Animation animation;
/**
* Gets the stock.
* @return The stock.
*/
public Item getStock() {
return stock;
}
/**
* Gets the limb.
* @return The limb.
*/
public Item getLimb() {
return limb;
}
/**
* Gets the product.
* @return The product.
*/
public Item getProduct() {
return product;
}
/**
* Gets the level.
* @return The level.
*/
public int getLevel() {
return level;
}
/**
* Gets the experience.
* @return The experience.
*/
public double getExperience() {
return experience;
}
/**
* Gets the animation.
* @return The animation.
*/
public Animation getAnimation() {
return animation;
}
/**
* Method used to get the {@link Limb} for the item.
* @param item the item.
* @return the limb.
*/
public static Limb forItems(final Item item, final Item second) {
for (Limb l : Limb.values()) {
if (l.getLimb().getId() == item.getId() && l.getStock().getId() == second.getId() || l.getLimb().getId() == second.getId() && l.getStock().getId() == item.getId()) {
return l;
}
}
return null;
}
}
@@ -0,0 +1,52 @@
package content.global.skill.fletching.items.crossbow
import core.game.node.entity.player.Player
import core.game.node.entity.skill.SkillPulse
import core.game.node.entity.skill.Skills
import content.global.skill.fletching.Fletching
import core.game.node.item.Item
/**
* Represents the skill pulse of attaching limbs.
* @author Ceikry
*/
class LimbPulse(player: Player?, node: Item, private val limb: Fletching.Limb, private var amount: Int) : SkillPulse<Item?>(player, node) {
override fun checkRequirements(): Boolean {
if (player.skills.getLevel(Skills.FLETCHING) < limb.level) {
player.dialogueInterpreter.sendDialogue("You need a fletching level of " + limb.level + " to attach these limbs.")
return false
}
if (!player.inventory.containsItem(Item(limb.limb))) {
player.dialogueInterpreter.sendDialogue("That's not the correct limb to attach.")
return false
}
if(!player.inventory.containsItem(Item(limb.stock))){
player.dialogueInterpreter.sendDialogue("That's not the correct stock for that limb.")
return false
}
return player.inventory.containsItem(Item(limb.stock))
}
override fun animate() {
player.animate(limb.animation)
}
override fun reward(): Boolean {
if (delay == 1) {
super.setDelay(6)
return false
}
if (player.inventory.remove(Item(limb.stock), Item(limb.limb))) {
player.inventory.add(Item(limb.product))
player.skills.addExperience(Skills.FLETCHING, limb.experience, true)
player.packetDispatch.sendMessage("You attach the metal limbs to the stock.")
}
if (!player.inventory.containsItem(Item(limb.limb))) {
return true
}
amount--
return amount == 0
}
override fun message(type: Int) {}
}
@@ -0,0 +1,139 @@
/*
package core.game.node.entity.skill.fletching.items.crossbow;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.update.flag.context.Animation;
*/
/**
* Represents the enum of stringing crossbows.
* @author 'Vexia
*//*
public enum StringCross {
BRONZE_CBOW(new Item(9454), new Item(9174), 9, 6, new Animation(6671)),
BLURITE_CBOW(new Item(9456), new Item(9176), 24, 16, new Animation(6672)),
IRON_CBOW(new Item(9457), new Item(9177), 39, 22, new Animation(6673)),
STEEL_CBOW(new Item(9459), new Item(9179), 46, 27, new Animation(6674)),
MITHIRIL_CBOW(new Item(9461), new Item(9181), 54, 32, new Animation(6675)),
ADAMANT_CBOW(new Item(9463), new Item(9183), 61, 41, new Animation(6676)),
RUNITE_CBOW(new Item(9465), new Item(9185), 69, 50, new Animation(6677));
*/
/**
* Constructs a new {@code StringcrossbowPlugin.java} {@code Object}.
* @param item the item.
* @param product the product.
* @param level the level.
* @param experience the experience.
*//*
StringCross(final Item item, final Item product, final int level, final double experience, final Animation animation) {
this.item = item;
this.product = product;
this.level = level;
this.experience = experience;
this.animation = animation;
}
*/
/**
* The item required.
*//*
private final Item item;
*/
/**
* The item product.
*//*
private final Item product;
*/
/**
* The level required.
*//*
private final int level;
*/
/**
* The experience required.
*//*
private final double experience;
*/
/**
* The animation of stringing.
*//*
private final Animation animation;
*/
/**
* Gets the item.
* @return The item.
*//*
public Item getItem() {
return item;
}
*/
/**
* Gets the product.
* @return The product.
*//*
public Item getProduct() {
return product;
}
*/
/**
* Gets the level.
* @return The level.
*//*
public int getLevel() {
return level;
}
*/
/**
* Gets the experience.
* @return The experience.
*//*
public double getExperience() {
return experience;
}
*/
/**
* Method used to get the animation.
* @return the animation.
*//*
public Animation getAnimation() {
return animation;
}
*/
/**
* Method used to get the string bow for the item.
* @param item the item.
* @return the string bow.
*//*
public static StringCross forItem(final Item item) {
for (StringCross bw : StringCross.values()) {
if (bw.getItem().getId() == item.getId()) {
return bw;
}
}
return null;
}
}
*/
@@ -0,0 +1,96 @@
package content.global.skill.fletching.items.darts;
import core.game.node.item.Item;
/**
* Represents the enum to hold dart info.
* @author 'Vexia
*/
public enum Dart {
BRONZE_DART(new Item(819), new Item(806), 1, 1.8),
IRON_DART(new Item(820), new Item(807), 22, 3.8),
STEEL_DART(new Item(821), new Item(808), 37, 7.5),
MITHRIL_DART(new Item(822), new Item(809), 52, 11.2),
ADAMANT_DART(new Item(823), new Item(810), 67, 15),
RUNE_DART(new Item(824), new Item(811), 81, 18.8),
DRAGON_DART(new Item(11232), new Item(11230), 95, 25);
/**
* Constructs a new {@code Dart} {@code Object}.
* @param item the item.
* @param product the product.
* @param level the level.
* @param experience the experience.
*/
Dart(final Item item, final Item product, final int level, final double experience) {
this.item = item;
this.product = product;
this.level = level;
this.experience = experience;
}
/**
* Represents the item required.
*/
private final Item item;
/**
* Represents the product gained.
*/
private final Item product;
/**
* Represents the level required.
*/
private final int level;
/**
* Represents the experience gained.
*/
private final double experience;
/**
* Gets the item.
* @return The item.
*/
public Item getItem() {
return item;
}
/**
* Gets the product.
* @return The product.
*/
public Item getProduct() {
return product;
}
/**
* Gets the level.
* @return The level.
*/
public int getLevel() {
return level;
}
/**
* Gets the experience.
* @return The experience.
*/
public double getExperience() {
return experience;
}
/**
* Method used to get the dart for the item.
* @param item the item.
* @return the dart.
*/
public static Dart forItem(final Item item) {
for (Dart dart : Dart.values()) {
if (dart.getItem().getId() == item.getId()) {
return dart;
}
}
return null;
}
}
@@ -0,0 +1,98 @@
package content.global.skill.fletching.items.darts;
import core.game.node.entity.skill.SkillPulse;
import core.game.node.entity.skill.Skills;
import content.global.skill.fletching.Fletching;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents the dart pulse.
* @author ceikry
*/
public final class DartPulse extends SkillPulse<Item> {
/**
* Represents the feather item.
*/
private static final Item FEATHER = new Item(314);
/**
* Represents the dart.
*/
private final Fletching.Darts dart;
/**
* Represents the sets to make.
*/
private int sets;
/**
* Constructs a new {@code DartPulse.java} {@code Object}.
* @param player the player.
* @param node the node.
*/
public DartPulse(Player player, Item node, Fletching.Darts dart, int sets) {
super(player, node);
this.dart = dart;
this.sets = sets;
}
@Override
public boolean checkRequirements() {
if (player.getSkills().getLevel(Skills.FLETCHING) < dart.level) {
player.getDialogueInterpreter().sendDialogue("You need a fletching level of " + dart.level + " to do this.");
return false;
}
if (!player.getQuestRepository().isComplete("The Tourist Trap")){
player.getDialogueInterpreter().sendDialogue("You need to have completed Tourist Trap to fletch darts.");
return false;
}
return true;
}
@Override
public void animate() {
}
@Override
public boolean reward() {
if (getDelay() == 1) {
super.setDelay(3);
}
final Item unfinished = dart.getUnfinished();
final int dartAmount = player.getInventory().getAmount(unfinished);
final int featherAmount = player.getInventory().getAmount(FEATHER);
if (dartAmount >= 10 && featherAmount >= 10) {
FEATHER.setAmount(10);
unfinished.setAmount(10);
player.getPacketDispatch().sendMessage("You attach feathers to 10 darts.");
} else {
int amount = featherAmount > dartAmount ? dartAmount : featherAmount;
FEATHER.setAmount(amount);
unfinished.setAmount(amount);
player.getPacketDispatch().sendMessage(amount == 1 ? "You attach a feather to a dart." : "You attach feathers to " + amount + " darts.");
}
if (player.getInventory().remove(FEATHER, unfinished)) {
Item product = dart.getFinished();
product.setAmount(FEATHER.getAmount());
player.getSkills().addExperience(Skills.FLETCHING, dart.experience * product.getAmount(), true);
player.getInventory().add(product);
}
FEATHER.setAmount(1);
if (!player.getInventory().containsItem(FEATHER)) {
return true;
}
if (!player.getInventory().containsItem(dart.getUnfinished())) {
return true;
}
sets--;
return sets == 0;
}
@Override
public void message(int type) {
}
}
@@ -0,0 +1,101 @@
package content.global.skill.fletching.items.gem;
import core.game.node.item.Item;
/**
* Represents gems to cut into bolt tips.
* @author 'Vexia
* @date 01/12/2013
*/
public enum Gem {
OPAL(new Item(1609), new Item(45, 12), 11, 1.5),
JADE(new Item(1611), new Item(9187, 12), 26, 2.4),
RED_TOPAZ(new Item(1613), new Item(9188, 12), 48, 3.9),
SAPPHIRE(new Item(1607), new Item(9189, 12), 56, 4),
EMERALD(new Item(1605), new Item(9190, 12), 58, 5.5),
RUBY(new Item(1603), new Item(9191, 12), 63, 6.3),
DIAMOND(new Item(1601), new Item(9192, 12), 65, 7),
DRAGONSTONE(new Item(1615), new Item(9193, 12), 71, 8.2),
ONYX(new Item(6573), new Item(9194, 24), 73, 9.4);
/**
* Constructs a new {@code Gem.java} {@code Object}.
* @param gem the gem.
* @param bolt the bolt.
* @param level the level.
* @param experience the experience.
*/
Gem(Item gem, Item bolt, int level, double experience) {
this.gem = gem;
this.bolt = bolt;
this.level = level;
this.experience = experience;
}
/**
* Represents the gem.
*/
private final Item gem;
/**
* Represents the bolt.
*/
private final Item bolt;
/**
* Represents the level required.
*/
private final int level;
/**
* Represents the experience gained.
*/
private final double experience;
/**
* Gets the gem.
* @return The gem.
*/
public Item getGem() {
return gem;
}
/**
* Gets the bolt.
* @return The bolt.
*/
public Item getBolt() {
return bolt;
}
/**
* Gets the level.
* @return The level.
*/
public int getLevel() {
return level;
}
/**
* Gets the experience.
* @return The experience.
*/
public double getExperience() {
return experience;
}
/**
* Method used to get a gem for the item.
* @param item the item.
* @return the gem.
*/
public static Gem forItem(final Item item) {
for (Gem gem : values()) {
if (gem.getGem().getId() == item.getId()) {
return gem;
}
}
return null;
}
}
@@ -0,0 +1,144 @@
/*
package core.game.node.entity.skill.fletching.items.gem;
import org.crandor.game.node.item.Item;
*/
/**
* Represents a gem bolt.
* @author 'Vexia
* @date 01/12/2013
*//*
public enum GemBolt {
OPAL(new Item(877, 10), new Item(45, 10), new Item(879, 10), 11, 1.5),
PEARL(new Item(9140, 10), new Item(46, 10), new Item(880, 10), 41, 3.2),
JADE(new Item(9139, 10), new Item(9187, 10), new Item(9335, 10), 26, 2.4),
RED_TOPAZ(new Item(9141, 10), new Item(9188, 10), new Item(9336, 10), 48, 3.9),
SAPPHIRE(new Item(9142, 10), new Item(9189, 10), new Item(9337, 10), 56, 4),
EMERALD(new Item(9142, 10), new Item(9190, 10), new Item(9338, 10), 58, 5.5),
RUBY(new Item(9143, 10), new Item(9191, 10), new Item(9339, 10), 63, 6.3),
DIAMOND(new Item(9143, 10), new Item(9192, 10), new Item(9340, 10), 65, 7),
DRAGONSTONE(new Item(9144, 10), new Item(9193, 10), new Item(9341, 10), 71, 8.2),
ONYX(new Item(9144, 10), new Item(9194, 10), new Item(9342, 10), 73, 9.4);
*/
/**
* Constructs a new {@code GemBolt} {@code Object}.
* @param base the base.
* @param tip the tip.
* @param level the level.
* @param experience the experience.
*//*
GemBolt(Item base, Item tip, Item product, int level, double experience) {
this.base = base;
this.tip = tip;
this.product = product;
this.level = level;
this.experience = experience;
}
*/
/**
* Represents the base item.
*//*
private final Item base;
*/
/**
* Represents the tip to attach.
*//*
private final Item tip;
*/
/**
* Represents the product.
*//*
private final Item product;
*/
/**
* Represents the level.
*//*
private final int level;
*/
/**
* Represents the experience.
*//*
private final double experience;
*/
/**
* Gets the base.
* @return The base.
*//*
public Item getBase() {
return base;
}
*/
/**
* Gets the tip.
* @return The tip.
*//*
public Item getTip() {
return tip;
}
*/
/**
* Gets the product.
* @return The product.
*//*
public Item getProduct() {
return product;
}
*/
/**
* Gets the level.
* @return The level.
*//*
public int getLevel() {
return level;
}
*/
/**
* Gets the experience.
* @return The experience.
*//*
public double getExperience() {
return experience;
}
*/
/**
* Method used to get the gem bolt from the id.
* @param boltt the boltt.
* @param tip the tip.
* @return the bolt.
*//*
public static GemBolt forItems(final Item boltt, final Item tip) {
for (GemBolt bolt : values()) {
if (bolt.getBase().getId() == boltt.getId() && bolt.getTip().getId() == tip.getId() || bolt.getBase().getId() == tip.getId() && bolt.getTip().getId() == boltt.getId()) {
return bolt;
}
}
return null;
}
}
*/
@@ -0,0 +1,68 @@
package content.global.skill.fletching.items.gem
import core.game.node.entity.player.Player
import core.game.node.entity.skill.SkillPulse
import core.game.node.entity.skill.Skills
import content.global.skill.fletching.Fletching.GemBolts
import core.game.node.item.Item
import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items
/**
* Represents the gem cutting pulse(gem to bolt).
* @author Ceikry
*/
class GemBoltCutPulse
/**
* Constructs a new `GemCutPulse.java` `Object`.
* @param player the player.
* @param node the node.
* @param amount the amount.
*/(player: Player?, node: Item?,
/**
* Represents the gem we're cutting.
*/
private val gem: GemBolts,
/**
* Represents the amount to make.
*/
private var amount: Int) : SkillPulse<Item?>(player, node) {
/**
* Represents the ticks passed.
*/
private var ticks = 0
override fun checkRequirements(): Boolean {
if (player.skills.getLevel(Skills.FLETCHING) < gem.level) {
player.dialogueInterpreter.sendDialogue("You need a Fletching level of " + gem.level + " or above to do that.")
return false
}
return player.inventory.containsItem(Item(gem.gem))
}
override fun animate() {
if (ticks % 6 == 0) {
player.animate(ANIMATION)
}
}
override fun reward(): Boolean {
if (++ticks % 5 != 0) {
return false
}
val reward = if (gem.gem == Items.OYSTER_PEARLS_413) Item(gem.tip, 24) else Item(gem.tip, 12)
if (player.inventory.remove(Item(gem.gem))) {
player.inventory.add(reward)
player.skills.addExperience(Skills.FLETCHING, gem.experience, true)
}
amount--
return amount <= 0
}
companion object {
/**
* Represents the cutting animation.
*/
private val ANIMATION = Animation(6702)
}
}
@@ -0,0 +1,87 @@
package content.global.skill.fletching.items.gem;
import core.game.node.entity.skill.SkillPulse;
import core.game.node.entity.skill.Skills;
import content.global.skill.fletching.Fletching;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents the attaching of a gem bolt to a premade bolt.
* @author Ceikry
*/
public final class GemBoltPulse extends SkillPulse<Item> {
/**
* Represents the gem bolt being made.
*/
private Fletching.GemBolts bolt;
/**
* Represents the sets to make.
*/
private int sets = 0;
/**
* Represents the ticks passed.
*/
private int ticks;
/**
* Constructs a new {@code GemBoltPulse} {@code Object}.
* @param player the player.
* @param node the node.
* @param sets the sets.
*/
public GemBoltPulse(Player player, Item node, Fletching.GemBolts bolt, int sets) {
super(player, node);
this.bolt = bolt;
this.sets = sets;
}
@Override
public boolean checkRequirements() {
if (player.getSkills().getLevel(Skills.FLETCHING) < bolt.level) {
player.getDialogueInterpreter().sendDialogue("You need a Fletching level of " + bolt.level + " or above to do that.");
return false;
}
if (!player.getInventory().containsItem(new Item(bolt.base)) || !player.getInventory().containsItem(new Item(bolt.tip))) {
return false;
}
return true;
}
@Override
public void animate() {
}
@Override
public boolean reward() {
if (++ticks % 3 != 0) {
return false;
}
int baseAmount = player.getInventory().getAmount(bolt.base);
int tipAmount = player.getInventory().getAmount(bolt.tip);
Item base = new Item(bolt.base);
Item tip = new Item(bolt.tip);
Item product = new Item(bolt.product);
if(baseAmount >= 10 && tipAmount >= 10){
base.setAmount(10);
tip.setAmount(10);
product.setAmount(10);
} else {
int amount = baseAmount > tipAmount ? tipAmount : baseAmount;
base.setAmount(amount);
tip.setAmount(amount);
product.setAmount(amount);
}
if (player.getInventory().remove(base,tip)) {
player.getInventory().add(product);
player.getSkills().addExperience(Skills.FLETCHING, bolt.experience * product.getAmount(), true);
player.getPacketDispatch().sendMessage(product.getAmount() == 1 ? "You attach the tip to the bolt." : "You fletch " + product.getAmount() + " bolts.");
}
sets--;
return sets <= 0;
}
}
@@ -0,0 +1,85 @@
package content.global.skill.fletching.items.grapple;
import core.game.node.entity.skill.SkillPulse;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
/**
* Represents the skill pulse used to create a mith grapple.
* @author 'Vexia
* @date 21/12/2013
*/
public final class GrapplePulse extends SkillPulse<Item> {
/**
* Represents the mith grapple tip.
*/
private static final Item MITH_GRAPPLE = new Item(9418);
/**
* Represents the mithril grapple tio.
*/
private static final Item GRAPPLE_TIP = new Item(9416);
/**
* Represents the mithril bolt.
*/
private static final Item MITHRIL_BOLT = new Item(9142);
/**
* Represents the amount of the grapple to make.
*/
private int amount;
/**
* Constructs a new {@code GrapplePulse} {@code Object}.
* @param player the player.
* @param node the node.
* @param amount the amount.
*/
public GrapplePulse(Player player, Item node, int amount) {
super(player, node);
this.amount = amount;
}
@Override
public boolean checkRequirements() {
int inventoryAmount = player.getInventory().getAmount(GRAPPLE_TIP);
if (amount > inventoryAmount) {
amount = inventoryAmount;
}
if (!player.getInventory().containsItem(GRAPPLE_TIP) || !player.getInventory().containsItem(MITHRIL_BOLT)) {
return false;
}
if (player.getSkills().getLevel(Skills.FLETCHING) < 59) {
player.getDialogueInterpreter().sendDialogue("You need a fletching level of at least 59 in order to do this.");
return false;
}
return true;
}
@Override
public void animate() {
}
@Override
public boolean reward() {
if (getDelay() == 1) {
setDelay(3);
return false;
}
if (player.getInventory().remove(GRAPPLE_TIP) && player.getInventory().remove(MITHRIL_BOLT)) {
player.getInventory().add(MITH_GRAPPLE);
player.getSkills().addExperience(Skills.FLETCHING, 5, true);
}
amount--;
return amount < 1;
}
@Override
public void message(int type) {
}
}